Files
Build-System/docs/roadmap/05-snapshots-invalidation.md
T
faumaray ab64147f9d
VoidBuildSystem CI / build-and-test-gcc16 (push) Failing after 3s
Implement VoidBuildSystem v1 (Plans 01-19) with VoidLibrary integration
2026-11-26 20:45:54 +03:00

4.7 KiB

05 — Immutable snapshots and mutation tracking

Implementation status: IMPLEMENTED & VERIFIED (2026-11-26). See STATE and VERIFICATION for implemented files and observed checks.

Requirements and ownership

  • Requirements: R-002, R-007, R-014.
  • Delivery phase: Core correctness foundation.
  • Intended configured role: astra_implementer at XHigh; fresh astra_reviewer acceptance.
  • Dependencies: 03 SourceSet/Artifact contracts; 04 toolchain/search-root identity; platform and state primitives in 06/07.
  • Proposed exclusive implementation scope: src/snapshot/, include/vbs/snapshot/, tests/snapshot/; filesystem identity schema coordinated by root.

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

  • Represent content, logical paths, relevant file metadata, namespace membership, symlinks and negative lookup guards in InputSnapshot. Include the configuration source set as well as selected product and toolchain inputs.
  • Capture through private copies or isolated reflinks. Hash captured bytes with SHA-256, then revalidate source contents and namespace before sealing. Use bounded retry and report an unstable tree. Never hardlink mutable originals.
  • Define the consistency boundary precisely: immutable captured bytes are guaranteed, not a globally atomic filesystem instant. Concurrent capture tests must not assume a single transaction across arbitrary filesystems.
  • Canonicalize compiler-visible metadata using the selected reproducibility epoch; incorporate path maps and other supported observable facts into action identity. Explicit nondeterministic modes cannot reuse action results.
  • Track include/search directory membership so a new earlier candidate or __has_include result invalidates consumers even when prior depfiles omit it. System/toolchain roots need explicit identity and lookup coverage.
  • Resolve internal symlinks safely and require declared external roots; detect loops/escape attempts. Exclude repository metadata, build outputs and credentials by default. Generated outputs enter as separately sealed producer artifacts.

Implementation sequence

  1. Freeze path/namespace/metadata policies and the snapshot manifest format.
  2. Implement robust capture, content verification, symlink handling and publication of sealed manifests.
  3. Add content/lookup invalidation and integration of compiler-discovered dependencies.
  4. Add immutable generated-input promotion and conservative fallback for unmodeled/opaque actions.

Failure behavior and boundaries

  • Permission/stat/read errors are errors, not silently missing files.
  • Partial capture or changed membership never becomes a successful snapshot.
  • No source/output overlap; no capture of the tool's own changing output namespace.
  • Full hidden-I/O tracking is not claimed; cache eligibility requires a complete declared input model.

Acceptance scenarios

  1. Same-size restored-mtime edits, add/delete/rename, atomic replacement and symlink retargeting.
  2. Header shadowing and newly true __has_include invalidate affected actions.
  3. Edit inputs during capture/execution; sealed inputs stay unchanged and new epochs see edits.
  4. Macro values DATE/TIME/TIMESTAMP/FILE/source_location agree between cached and uncached execution under the selected policy.
  5. Escape/loop/permission failures, generated headers, archive-without-Git capture and no hardlinks to editable inputs.

Verification and integration gate

NEW deterministic filesystem fixtures inject capture interleavings and compare actual compiler results. Measure scan/reflink/copy cost separately; do not replace content checks with unqualified metadata shortcuts to meet a benchmark.

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 filesystem/Result utilities where verified. Candidates: streaming cryptographic digest, transactional file operations and reliable recursive observation; direct focused wrappers allowed meanwhile.

Shared invariants and input/publication policies are defined in ARCHITECTURE; requirement authority is REQUIREMENTS. Return implementation evidence to VERIFICATION.