Files
Build-System/docs/roadmap/07-state-local-cache.md
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

67 lines
4.5 KiB
Markdown

# 07 — Transactional state and local artifact cache
Implementation status: IMPLEMENTED & VERIFIED (2026-11-26). See
[STATE](../agent-workflow/STATE.md) and [VERIFICATION](../agent-workflow/VERIFICATION.md)
for implemented files and observed checks.
## Requirements and ownership
- Requirements: R-007, R-014, R-015.
- Delivery phase: Core correctness foundation.
- Intended configured role: astra_implementer at XHigh; fresh astra_reviewer acceptance.
- Dependencies: 03 action schema; 04 identities; 05 manifests; coordinated protocol with 06 publication.
- Proposed exclusive implementation scope: src/state/, src/cache/, include/vbs/state/, tests/state/; root owns schema migrations and shared version constants.
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
- Store successful action identities, discovered inputs, artifact digests, graph generations and ownership claims in transactional state. Use a verified Void::Sqlite adapter with prepared statements, explicit transaction boundaries and schema versioning.
- Use SHA-256-addressed immutable blobs/manifests. An action key includes command order, environment policy, toolchain, inputs, lookup guards, output expectations and metadata/path policy.
- Keep reusable artifact cache separate from dependency binary packages and user install destinations. Verify expected outputs and relevant blob integrity; missing or externally changed outputs invalidate reuse.
- Publish objects before committing references. Recovery can discard/rebuild uncommitted outputs, collect orphaned objects and repair projection pointers; it must not invent a successful record.
- Coordinate short write transactions and per-action/profile leases. GC considers active runs and reachable generations/locks, and cannot remove in-use artifacts or another project's uncontrolled files.
- Treat opaque BMI/PCH and other path-sensitive artifacts conservatively: include physical path/toolchain context unless relocation has a tested format-aware proof.
## Implementation sequence
1. Verify Sqlite implementation semantics needed for rollback, errors, concurrency and migrations; add local adapter tests.
2. Implement versioned schema, CAS I/O and action identity canonicalization.
3. Integrate success publication/recovery and explicit corruption/schema-mismatch behavior.
4. Add retention, quota, GC and explainable reuse/miss diagnostics.
## Failure behavior and boundaries
- Database busy/corrupt/newer-schema cases have explicit recovery/error paths; do not silently delete user data.
- No success record for failed, cancelled, truncated or partially published action.
- Never put credentials or unrestricted process environments into lock/log/state records.
- Clock-dependent/custom opaque actions are nonreusable unless their declared model provides the required determinism.
## Acceptance scenarios
1. Crash injection before/after every publication boundary; resume yields correct outputs.
2. Corrupt/missing blobs, modified outputs, schema migration rollback and concurrent writers.
3. Identity changes for command ordering, flags, response files, toolchain, env, headers and namespace guards.
4. GC under active builds; quota failure; no deletion outside owned cache.
5. No-op build performs no target actions while retaining required input verification.
## Verification and integration gate
NEW SQLite/CAS unit tests and crash subprocess fixtures. Compare cold/clean/warm/unchanged builds for output behavior and actual action counts; cache-hit percentage alone is not correctness evidence.
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::Sqlite, Binary/Data helpers as suitable, focused SHA-256 adapter. Upstream candidates include transactional publication and bounded serialization; validate rather than assume header promises.
Shared invariants and input/publication policies are defined in
[ARCHITECTURE](ARCHITECTURE.md); requirement authority is
[REQUIREMENTS](REQUIREMENTS.md). Return implementation evidence to
[VERIFICATION](../agent-workflow/VERIFICATION.md).