4.7 KiB
09 — Compilation databases and editor selection
Implementation status: planned, except the initial bootstrap when marked verified in STATE. This document is an implementation contract, not a report that the capability exists.
Requirements and ownership
- Requirements: R-003, R-008, R-014.
- Delivery phase: Core developer experience.
- Intended configured role: sol_implementer at XHigh; fresh astra_reviewer acceptance.
- Dependencies: 02/03 configured graph; 04 typed compiler commands; 05 path mapping; 07 generation publication; 08 feature metadata when selected.
- Proposed exclusive implementation scope: src/editor/, include/vbs/editor/, tests/editor/; project selection state schema root-owned.
Before dispatch, reconcile these paths with the real HEAD, write a full task spec, lint it, and transfer shared-file ownership explicitly. Paths that do not yet exist are NEW. Source-disjoint work still coordinates shared state, ports and build directories.
Design and interfaces
- Emit standard JSON command objects using argv arrays, logical source file, working directory and output. Cover all enabled configured targets in a profile even when execution selects a subset; preserve multiple meaningful commands for a source.
- Build a typed projection from physical snapshot execution paths to editable sources and compatible immutable generated views. Project response files structurally. Never replace arbitrary macro/string contents. Preserve exact execution records separately.
- Maintain immutable editor generations and per-profile compile_commands.json. A managed build-root pointer and optional project-root alias select the current generation without overwriting unrelated user files.
- Assign project-level monotonically ordered selection tickets. Single-profile builds reserve intent and publish after valid configuration. Multiple profiles require --editor-profile from their selection. Manual use creates a newer request; watchers refresh without selecting.
- Coordinate short publication locks with revision checks. Older compilation/configuration completion cannot replace newer metadata. Recover stale filesystem pointers from authoritative state after crashes.
- Publish valid metadata independently of target success. Missing generated inputs have readiness diagnostics; invalid/unresolved graphs retain a clearly stale previous generation rather than fabricated commands.
Implementation sequence
- Implement deterministic standard JSON export from typed compile records.
- Implement logical/physical mappings and immutable generated editor views.
- Implement selection tickets, managed alias ownership and atomic publication/recovery.
- Connect build/manual use/metadata watch and add diagnostics for stale or unrepresentable commands.
Failure behavior and boundaries
- Reject ambiguous opaque path rewriting rather than corrupt arguments.
- A failing compile does not undo a valid editor selection; failed configuration does not silently select stale data.
- Do not remove a generation while clangd or an active selection/run can still reference it.
- Do not mix debug headers/BMIs with release or another graph generation.
Acceptance scenarios
- Spaces/Unicode/quotes, response files, duplicate source commands, generated headers and module flags.
- Single/multiple-profile selection, explicit manual switch and reverse-order completion races.
- Atomic replacement readers never observe truncated JSON; crash recovery repairs pointers.
- Adding/deleting/renaming sources refreshes metadata even when an unrelated compile fails.
- Selected target subset leaves other configured editor entries available; user-owned root file preserved.
Verification and integration gate
NEW JSON and race fixtures plus actual clangd parse checks for supported toolchains/features. Record database validity separately from editor support. Exercise planned vbs compdb use/watch only after implementation.
Acceptance requires observed results for these scenarios, the affected regression suite, reviewed cross-component contracts, and a fresh independent review. Record unrun checks and environment limitations; tests passing alone do not waive an invariant. No merge, push or deployment is authorized by a review verdict.
VoidLibrary reuse and upstream candidates
Void data/path utilities behind correctly escaped serialization. Follow Clang JSONCompilationDatabase specification; no shell-command parser as the primary representation.
Shared invariants and input/publication policies are defined in ARCHITECTURE; requirement authority is REQUIREMENTS. Return implementation evidence to VERIFICATION.