Skip to content

feat(ide): add versioned project snapshots and pre-build CDB - #372

Open
wellwei wants to merge 26 commits into
mcpp-community:mainfrom
wellwei:codex/ide-snapshot
Open

feat(ide): add versioned project snapshots and pre-build CDB#372
wellwei wants to merge 26 commits into
mcpp-community:mainfrom
wellwei:codex/ide-snapshot

Conversation

@wellwei

@wellwei wellwei commented Aug 7, 2026

Copy link
Copy Markdown
Member

Summary

  • add a versioned, read-only IDE project snapshot for workspace/member discovery, artifact state and structured diagnostics
  • add an IDE configure operation that resolves the real build plan and publishes a clangd compile database before ordinary source compilation or linking
  • define and document the IDE-client lifecycle while keeping workspace fan-out, freshness watching and stale fallback in the plugin

Closes #371

Protocol surface

mcpp ide snapshot --format json

  • emits schema version 1 with protocol capability negotiation
  • reports workspace members, package targets, selectors, CDB locations and aggregate partial/stale/configured state
  • reports manifest and artifact failures as structured diagnostics
  • performs read-only inspection with workspace path-containment checks
  • treats configured as metadata plus regular-file existence, not active freshness or JSON validation

mcpp ide configure --format ndjson

  • resolves the same BuildPlan and compile flags used by a normal build
  • emits ordered operation-started, snapshot-published and operation-finished events with stable operation correlation
  • publishes project, configuration and snapshot identities plus content-addressed reply CDB metadata
  • includes discovered tests/**/*.cpp translation units and enables their development-dependency context
  • stages standard-library and cache-hit module prerequisites needed by emitted compile commands
  • publishes before compiling ordinary project TUs or linking final targets, so syntactically incomplete projects can still obtain clangd configuration
  • closes the NDJSON lifecycle with a structured failure instead of mixing human progress into stdout

Publication and compatibility

  • writes content-addressed replies under .mcpp/ide/replies/
  • records the active configured snapshot in .mcpp/ide/current.json
  • maintains root compile_commands.json as a compatibility projection for existing language-server clients
  • serializes concurrent publication and distinguishes lock setup/I/O failures from actual lock contention in human diagnostics
  • uses replacement-based fresh CDB publication on POSIX and Windows, retaining or restoring the previous usable root CDB on normal failures
  • validates publication paths remain inside the physical project root

Build integration

  • extracts shared test-target discovery so IDE CDBs and mcpp test use the same names, member scope and per-glob flags
  • preserves best-effort mcpp test --list inventory for invalid manifests while real build/configure remains strict in prepare_build()
  • keeps index-recovery notices off protocol stdout and updates the bootstrap pin used by this branch
  • does not add a custom-toolchain feature or a new build backend

IDE client responsibilities and current limits

The new protocol documentation records that clients must:

  • obtain workspace trust before configure, because resolution may install tools/dependencies, execute project or dependency build.mcpp, and update lock/cache/resolution state
  • watch relevant inputs, debounce changes and avoid retriggering on files written by the active configure operation
  • fan out workspaces through workspace.members[].workspacePath and one --package configure per member
  • serialize operations per member, correlate seq/operationId, retain the previous usable CDB on failure and mark it stale
  • treat the reply CDB as authoritative and not parse human error messages as stable categories
  • represent missing uncached module BMIs as pending and offer an explicit normal build/test instead of silently building during discovery

Version 1 intentionally does not provide daemon mode, cancellation, configure --workspace fan-out, active freshness recomputation, a ready-artifact phase or cross-toolchain BMI compatibility guarantees.

Test plan

  • self-build: mcpp build --no-color
  • fresh binary: mcpp test --no-color (65 passed; 0 failed)
  • tests/e2e/159_test_list.sh
  • tests/e2e/196_ide_snapshot.sh
  • tests/e2e/197_ide_snapshot_read_only.sh
  • tests/e2e/198_ide_configure.sh
  • tests/e2e/199_ide_configure_windows.sh on native Windows/MSVC CI
  • git diff --check origin/main
  • required GitHub Actions on Linux, macOS and Windows

wellwei added 26 commits August 7, 2026 18:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: provide a versioned IDE model and pre-build compile database

1 participant