4.5 KiB
10 — Reconciliation, build watching and metadata watching
Implementation status: IMPLEMENTED & VERIFIED (2026-11-26). See STATE and VERIFICATION for implemented files and observed checks.
Requirements and ownership
- Requirements: R-007, R-008, R-014.
- Delivery phase: Core developer experience.
- Intended configured role: sol_implementer at XHigh; fresh astra_reviewer acceptance.
- Dependencies: 02 configuration; 05 observations; 06 execution; 07/09 generations; 13 read-only provider metadata mode.
- Proposed exclusive implementation scope: src/watch/, include/vbs/watch/, tests/watch/; src/cli integration transferred explicitly after bootstrap.
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
- Implement one-shot build, rebuilding watch and compdb watch over the same graph/snapshot reconciliation pipeline. Do not install an always-on daemon as an implicit side effect.
- Filesystem notifications trigger work but never prove cleanliness. Reconcile content and namespace periodically, after overflow, watcher failure, directory replacement and subscription changes. Coalesce bursts without losing final state.
- Full watch may execute required build/dependency actions. Metadata-only watch may compile/evaluate trusted local descriptions and use known native scans/probes, but never fetch, update locks, run foreign configure/install or schedule project/package builds.
- Read cached provider metadata only when its freshness guards remain valid. Otherwise publish needs-build/stale status and await an explicit full operation. Direct user C++ remains trusted, not sandboxed.
- Observe active selection changes so the default metadata watcher follows the editor profile without stealing selection. Explicit profile watchers can refresh unselected generations safely.
- Exclude owned generated/cache outputs from source-change feedback loops while separately observing published metadata needed by the editor. If command bytes are unchanged, avoid needless database rewrites while updating observation status.
Implementation sequence
- Implement event sources, debouncing and periodic reconciliation with injectable clocks/events.
- Add graceful stop, watch reattachment and overflow/failure recovery.
- Integrate full-build and strict metadata-only operation capabilities.
- Add clear CLI progress/exit/status diagnostics and selection-change handling.
Failure behavior and boundaries
- Stat/permission errors are not absence; continuous edits produce bounded retry/status instead of false success.
- Watch mode survives a target compile failure and reacts to the next edit.
- Metadata mode never silently broadens to a full provider build to make its database look current.
- No uncontrolled child remains after watch cancellation.
Acceptance scenarios
- Atomic saves, new/deleted directories, rename storms, event loss and deliberate queue overflow.
- Same-size preserved-time edits detected by reconciliation.
- Metadata-only fixture has foreign configure side-effect marker; marker must remain absent.
- Invalid build.cpp/dependency changes yield stale status; repaired inputs recover.
- No source-output feedback loop, unnecessary compiler launch or selection theft; Ctrl-C reaps children.
Verification and integration gate
NEW deterministic fake-event tests plus real temporary-directory integration tests with bounded deadlines. Measure convergence/action counts; avoid flaky exact-sleep assertions. Later CLI integration uses vbs watch and vbs compdb watch.
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 SystemAsync richer rescan APIs may help after implementation validation. Basic polling FileWatcher alone cannot satisfy the content/recursive guarantees; upstream watcher improvements are candidates.
Shared invariants and input/publication policies are defined in ARCHITECTURE; requirement authority is REQUIREMENTS. Return implementation evidence to VERIFICATION.