feat(scheduler-sim-decision-trace): wire tracing into the simulation driver
Task 5.3: session hooks around each sim session; trace-only decisions are handled first and skip verification, recording, echo and breakpoints; traced decisions are emitted after the echo gate and before the breakpoint check; reconstructed dispatches get reconstructed records; unclaimed traces are freed at both decision free sites. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
6bac16812c
commit
a1cb9cba4b
6 changed files with 743 additions and 7 deletions
|
|
@ -268,7 +268,7 @@
|
|||
- the file copy byte-equal to the console output.
|
||||
- _Requirements: 1.6, 7.1, 7.2, 7.3, 8.1, 8.5_
|
||||
|
||||
- [ ] 5. Wire the trace into the REPL and the simulation driver
|
||||
- [x] 5. Wire the trace into the REPL and the simulation driver
|
||||
- [x] 5.1 Make every white-box test that includes REPL or simulation sources compile the trace sources, and register the trace REPL sources with the simulation isolation checks
|
||||
- Add the trace control, store and renderer sources to the simulation isolation library and to the simulation isolation test's scan list.
|
||||
- Find the tests with the design's full include-pattern search. To the 26 tests that include the REPL or simulation-loop sources, add the trace REPL sources.
|
||||
|
|
@ -286,7 +286,7 @@
|
|||
- Done when REPL tests pass under ASAN for help sections and alignment, command routing, the `set output` rejection and the traced-round rollup, and the updated baseline test passes.
|
||||
- _Requirements: 1.11, 7.3, 7.4, 8.4, 8.6, 10.4, 10.5_
|
||||
|
||||
- [ ] 5.3 Wire tracing into the simulation driver's session and decision flow
|
||||
- [x] 5.3 Wire tracing into the simulation driver's session and decision flow
|
||||
- **Session hooks:** session begin runs after a successful begin-session and before reconciliation. Session end runs after the decision stream ends.
|
||||
- **Drain loop:**
|
||||
- trace-only decisions are handled first, with no verification, recording, echo or breakpoint check;
|
||||
|
|
@ -372,3 +372,4 @@
|
|||
- 4.6: the session hooks and emitter are in repl_trace_emit.c: `repl_trace_session_begin/end(sim)` and `repl_trace_on_decision/on_trace_only(sim, d)`, declared in repl_internal.h. `sim_print_decision` is now exported from sim.h. Session begin stamps `session_no = rs->session_count`, which sim_loop.c increments in `xce_repl_check_begin_round` before `xce_core_begin_session`. 5.3 must call session_begin after a successful begin-session and before signal_go/reconciliation, and session_end after the decision stream ends. Emission moves the record to the store (d->trace=NULL); write errors are reported once per session. policy_name is not stamped; capture falls back to the core picker. repl_trace_emit.c is not yet in sched_sim_isolation_lib or its scan (5.1).
|
||||
- 5.1: all 26 tests that include repl.c/sim_loop.c now `#include` the five REPL trace sources (repl_trace_render.c, repl_trace_render_outcome.c, repl_trace_store.c, repl_trace.c, repl_trace_emit.c) and the four core trace sources, exactly once. sched_sim_isolation_lib carries all nine trace sources. test_sim_isolation.c's `test_sim_trace_repl_sources_are_isolated` scans the REPL trace files plus repl_trace_render.h; stdio is allowed there, controller symbols are not. A new REPL trace file must be added to the 26 tests, the lib and the scan. test_sim_startup.c includes only sim.c, so if sim.c starts calling trace code it needs the sources too.
|
||||
- 5.2: repl.h now has the interactive-only gates `xce_repl_trace_session_begin/end(sim)` and `xce_repl_check_trace/xce_repl_check_trace_only(sim, d)`; the two check gates also no-op when d->trace is NULL. 5.3 calls these from sim_loop.c. `trace` is routed with the raw line, `info trace` is in usage and help, `set output` checks `repl_trace_file_conflicts` first, and quit/EOF call `repl_trace_shutdown`. The continue-mode rollup prints a traced round on its own via `rs->trace.round_traced`. The baseline transcript changed only in the help and info-usage lines; regenerating also rewrites the .replay fixtures' wall-clock fields, so restore those. Pre-existing: repl_count_jobs (repl.c) never destroys its iterator, leaking 16 B per continue round; the rollup tests run with detect_leaks=0.
|
||||
- 5.3: sim_loop.c calls the repl.h gates. Session begin runs after a successful begin-session and before reconcile/signal_go; session end runs after the drain and verify tail, before plugin_end_session. The drain loop handles TRACE first (skipping verify, record, echo and breakpoint), then echo gate, `check_trace`, `check_decision`, `rec_free`, free. The reconstructed block uses the new gate `xce_repl_trace_reconstructed` (`repl_trace_on_reconstructed` in repl_trace_emit.c). Settles the 1.7 OPEN item (both free sites). A reviewer's trace-on vs trace-off run of the contention fixture gave byte-identical --sim-output, identical verify and identical decisions.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue