3.1 KiB
19 — Trace persistence, event-time state and replay
Status: PLANNED; no implementation claim Requirements: R-016,R-018,R-019,R-021 Dependencies: 12,17,18; bounded storage primitives from15 may be reused after their guarantees are checked.
Ownership and boundaries
Proposed Astra schema/state-capture design, Sol bounded storage/query implementation. NEW include/vls/debug/trace/, src/debug/trace/, tests/debug/trace/. Root serializes schema/migrations. Future assignments must verify the then-current baseline and exact disjoint paths; these proposed scopes do not authorize work in another repository.
Contracts and data flow
TraceManifest binds schema/backend/compiler, source/context identities, captured-source manifest, ordered event/value records and terminal status. Records reference stable session-local IDs, never compiler addresses. Replay cursor movement creates a new inspection generation. Replay performs no target re-execution or state mutation.
Implementation sequence
- Persist event-time value snapshots or validated deltas with explicit parent dependencies, type descriptions and source origins. Bound recursive value expansion and represent cycles/opaque/unavailable state.
- Write append-only committed chunks with integrity checks and recoverable boundaries; publish completion only after all required records are durable. Distinguish completed, failed, cancelled, expired and truncated.
- Implement cursor stepping/seeking and historical frame/value reconstruction independently of a live compiler. Keep enough captured source to render a trace after project files change.
- Enforce256MiB/1M-event per-session limits plus memory/queue budgets. Default traces remain local/private; explicit export carries provenance and source disclosure, never automatic upload.
Failure behavior and constraints
Reject incompatible/corrupt schemas and missing delta ancestry rather than invent historical values. Recover only a verified committed prefix after crash. Limit termination visibly marks truncation; no completion marker on partially written output. User-exported traces are not silently evicted as cache.
Acceptance scenarios
- Compare live stop observations to replay at matching events, including nested constraints/reflection and cyclic values.
- Change/delete original source, restart without compiler availability and inspect captured replay correctly.
- Truncate/corrupt chunks, exceed limits, cancel mid-write and test cursor generation/stale handle rejection with deterministic fixtures.
Verification and integration
Proposed NEW CTest label: trace-replay. Once implemented, register a nonzero suite and run:
dev cpp-gcc -c ctest --test-dir build/bootstrap -L trace-replay --output-on-failure
This future command is not evidence that the label/tests exist now. Before dispatch, bind the fixtures above to actual targets and record prerequisites/side effects. Require fresh independent review of the implemented contract and affected integrations. Preserve old trace formats read-only or give a clear incompatibility result. Migrations write a separate output and retain the original; never reinterpret incompatible event IDs in place.