feat(scheduler-sim-decision-trace): emit traces inline and apply settings at session boundaries
Task 4.6: session begin makes the next settings current, stamps the session number and publishes them to the core; session end withdraws and releases them. Emission marks the round traced, flushes the collapsed range and reprints the suppressed echo in continue mode, renders to the console and the trace file with identical bytes, and stores the record. sim_print_decision is exported unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
27cad0b0b7
commit
4df29606f6
9 changed files with 941 additions and 4 deletions
|
|
@ -179,7 +179,7 @@
|
|||
- _Requirements: 4.1, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8, 4.9, 5.1, 5.2, 5.6, 5.7, 5.8_
|
||||
- _Depends: 2.2, 3.3_
|
||||
|
||||
- [ ] 4. Simulator REPL trace surface
|
||||
- [x] 4. Simulator REPL trace surface
|
||||
- [x] 4.1 Render trace records to text, test first (P)
|
||||
- **Hierarchy:** header, selection, requirements, cluster-wide checks and plans, positions and hosts, then the outcome. Every budgeted entry renders as exactly one line, in the order shown in the design's example.
|
||||
- **Summary level:** renders position summaries with per-limit names.
|
||||
|
|
@ -246,7 +246,7 @@
|
|||
- _Requirements: 8.2, 8.3, 8.4, 8.5, 8.6, 8.7_
|
||||
- _Depends: 4.3, 4.4_
|
||||
|
||||
- [ ] 4.6 Emit traces inline and apply settings at session boundaries, test first
|
||||
- [x] 4.6 Emit traces inline and apply settings at session boundaries, test first
|
||||
- At session begin:
|
||||
- reset the per-round traced and flushed flags;
|
||||
- make the next settings current, stamping the session number and resetting the position;
|
||||
|
|
@ -369,3 +369,4 @@
|
|||
- 4.3: `trace` is parsed from the raw line by repl_trace.c. The settings are a refcounted REPL-side wrapper around xce_sched_trace_ctl_t (trace.h untouched), held as `next`/`cur` in xce_repl_trace_state_t together with session_in_progress, round_traced and round_flushed. The 1.3 bare-id item is settled: an array-aligned bare id adds both an exact and a whole-array selector, so later elements match; status shows that as `<base>[*]`. A range expands to one exact selector per element. The wrapper frees `ctl.policy_name` on its last release, so 4.6 must heap-allocate it. Nothing frees next/cur at REPL shutdown yet, so 4.5/4.6 must add the shutdown path; routing `trace` from repl.c is 5.2.
|
||||
- 4.4: the driver holds its own copy of the scheduler log path in `sim->log_path` (from `sched_sim_args_t.log_path`, else `SCHED_DEFAULT_LOG_PATH` in sim.h, "/tmp/xce_scheduler.log"). The log is always open in sim mode, so 4.5 can `stat(sim->log_path)` for its dev/ino same-file check.
|
||||
- 4.5: the trace FILE* and its dev/ino belong to the refcounted settings, and the last unref flushes and closes it. New functions in repl_internal.h: `repl_trace_settings_file()`, `repl_trace_file_conflicts(sim, path)` (5.2 wires it into `set output`) and `repl_trace_shutdown(sim)` (5.2 calls it on quit/EOF). Shutdown clears core.trace_ctl, releases cur/next, then calls store_fini, which memsets the trace state, so keep that order. 4.6 must emit only through `cur`'s file while it still holds `cur`, and flush after every record, because two append streams may share one file.
|
||||
- 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).
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue