Native VBS and CMake builds of the server and every registered suite: protocol and document sync, VBS/compdb providers, stock GCC diagnostics (including in-process default profile preparation), the stock occurrence observer and hover/definition, the bounded Scheduler, C++ module graph, scan and artifact cache with real CMI production, the context-aware symbol index with schema-2 snapshot migration, navigation and guarded rename, reflection provenance with splice-origin extraction, index-backed completion and signature help, live GCC worker control with a registered DAP suite, and the Neovim and VS Code clients. VoidLibrary follows main. The private GCC 16.2.0 frontend is reproduced from the versioned patches and verified stepping reflection/template code with projected values 17/34 and 41/82.
8.1 KiB
Retain one verified immutable compiler recording for debugger queries
Task ID: T-REPLAY-RECORDING-019 Role: astra_implementer Status: READY
1. Context and baseline
Shared feat/implement-roadmap ca04975 plus standalone vls_gcc_probe/journal. At Trace.cpp:938–993 replay(path,sequence) opens and validates a whole physical journal and returns all captured source/diagnostics for each call; a DAP connection cannot use that for every stack or source query. The previous trace owner is finished. T-PLAN-DAP-020 confirmed real 17/34 and 22/44 stops at sequences 6,10,21,25 and a fixed process outcome. The journal hash chain and typed compiler event rules already exist.
2. Objective and deliverables
Implement one immutable C++ recording object which validates a bounded journal once, retains the verified prefix, provides bounded event navigation and historical cursor/stack/value queries, and exposes captured source and process outcome. Preserve the old replay CLI/API behavior for all existing cases. The forthcoming DAP service and custom views share this object.
3. Scope and non-goals
Recorded inspection only. No DAP transport, live process/control changes, generalized new compiler record format, re-opening arbitrary source filenames, or claims for unavailable template/constraint/physical facts.
4. Files to inspect
Inspect experiments/frontend/gcc-worker/{Trace.hpp,Trace.cpp,Main.cpp,Supervisor.cpp}, tests/debug/TraceTests.cpp, tests/native/GccSupervisor.py, docs/agent-workflow/tasks/T-GCC-TRACE-019.md, docs/roadmap/{18-live-debugging,19-recorded-replay,20-dap-service,21-inspection-api}.md (resolve actual roadmap 19 filename). Root has real fixed local recordings under build/plan-dap-020/capture-16mqf07g/ with compiler unavailable permitted at replay time.
5. Write ownership and coordination
Write scope: experiments/frontend/gcc-worker/Trace.hpp; experiments/frontend/gcc-worker/Trace.cpp; tests/debug/RecordingTests.cpp Existing TraceTests.cpp, Supervisor, console CLI, DAP sources and build files remain under other ownership. Preserve their contracts. Private build/replay-recording-019 allowed for benign test inputs. No Git mutations or additional agents.
6. Implementation or investigation approach
Re-use the actual JournalReader/Timeline validation and verified-prefix semantics. During one open from the explicitly supplied file acquire owned source/diagnostics/outcome/verified event transitions. Avoid duplicate parsers or O(event_count * stack_depth) retained per-event snapshots. Index the actual event ordinals/types, frame IDs, active call ancestry/phase/last value as useful; retain time-specific data, including a provisional result preceding a failed leave. Permit a fixed initial decode or bounded in-memory reconstruction consistent with the current 4096-event/1 MiB limits; paging metadata should not rebuild the cursor per item. Expose lookup of the next/previous actual observed integral stops/values without synthesizing calls. A result/source handle retains the recording independent of path replacement or deletion. Never reread the journal when inspecting/stepping. Do not modify the append format or transcript checks.
7. Interfaces and data contracts
NEW vls::gcc::ReplayRecording (exact names to freeze with root): static open(absolute_path) -> expected<shared_ptr,string>; event_count(), bounded page of verified event summaries carrying seq/kind/optional frame/parent; cursor_at(seq) containing post-event frames/lastLeave/stop and identity, without copying captured source/diagnostic bytes; recording metadata/status for partial, corrupt, completed/cancelled/failed+exit, immutable source/diagnostics access. Provide historical stage just AFTER event, before any following recorded command; final cursor reflects later authorization/outcome. Digests/nonce/PID are recorded identities, distinct from DAP handles. Retain truthful sourceKind from compiler. Unknown/unavailable, event outside verified prefix, start/past end and cut tails produce explicit outcomes. Keep replay(path,optional_seq) as a compatible wrapper including capture fields. Document any cursor scale limits and support DAP access to source as raw bytes with separate UTF8 validation upstream.
8. Dependencies and integration
The replay consumer needs each observed integer-value event, plus its immediately following matching compiler stop when present. A recorded value in an unattended run is a cursor point, even when the compiler never paused there. Coalesce that value and optional matching stop into one debugger navigation point in the session layer. Preserve both raw verified ordinals in the recording API. Never copy a subsequent action, ack or finish into an earlier event-time state. Keep journal outcome/partial status at the recording level. Actual fixtures have E5 provisional value, E6 stopped, E7 acknowledged, E8 leave returned and E9 outer value. Source bytes last for the recording lifetime; pause-generation references belong to the consumer. Planner reviewed real journal, returns live stop handshake to separate ownership. Root handles DAP adapters, views and tests on an actual compiler recording. CMake/VBS already compile Trace.cpp. Root will add RecordingTests.cpp to vls_trace_tests. No compiler rebuild or license decision is required.
9. Edge cases security and performance
Existing file/record/stream caps and per-record hash checks stay effective. Add aggregate index/storage/format caps consistent with current producer; never allocate proportional to untrusted claimed file length. Deep nested frames cannot cause quadratic stored memory at open. Distinguish truncation from invalid/corrupt tail, accepted prefix from completion, bad manifest from partial later failure. DAP cursors must be immutable, thread-safe reads, stable after client disconnect/old cursor release, bounded terminal/source copying. Handle binary source (do not convert arbitrary bytes to a JSON string), dirty concurrent append, and no fabricated execution success.
10. Acceptance criteria
The immutable resumed-event detail must retain the acknowledged compiler stop ordinal and action. A recorded step and a continue can otherwise produce identical cursor state after the ack. Compare the real E11 acknowledgement in source17-stepped.vls and source17-every-return.vls, or equivalent exact prefixes, and a journal with command authorization but no ack. Authorization alone must remain pending. Existing 13 trace and native supervisor tests remain green. New cases: open once then unlink, overwrite, replace path: old recording still returns old inner 17 and outer34; a separately opened newer capture sees 41/82. Repeated concurrent seeks, bounded paging and deep nesting, duplicate/invalid/out-of-range ordinals; authorized command vs actual resumed; failed cleanup after provisional value; manifest-only and corrupt/truncated suffix; source with NUL/invalid UTF-8, missing process outcome. Verify a real four-stop recording durably from parent-provided fixture where feasible. Release exact API early so DAP owner can build.
11. Verification commands and evidence
Run dev cpp-gcc -c g++ -std=c++26 -freflection -Iinclude -Ibuild/voidlibrary/current/include -fsyntax-only experiments/frontend/gcc-worker/Trace.cpp tests/debug/RecordingTests.cpp. Private linked runner with actual Void libraries allowed. Root re-registers in native+CMake and uses vls_gcc_probe replay on the T-PLAN-DAP-020 actual recordings. clang-format --dry-run on owned paths. Return actual cases and timings.
12. Constraints and stop conditions
Do not implement DAP or alter accepted v1 compiler event authorization. If requirement needs an incompatible recording format or source/privilege decision, report the evidence and complete the independent immutable-reader portions.
13. Authorization and decisions
All roadmap plans authorized D-022, separate branch native VBS D-025, GPT-6.2 Max D-027. T-REPLAY-RECORDING-019 normal read-only artifact usage does not choose an instrumentation technology. No Git staging/release.
14. Return format
T-REPLAY-RECORDING-019 DONE/PARTIAL, frozen API and time/space bounds, real artifacts, record count/seek evidence, actual test results and limitations. Notify root at compilation-ready and release.