feat(scheduler-sim-decision-trace): wire the trace commands into the REPL

Task 5.2: trace is routed with the raw line and info trace through info;
help gains a Trace section; set output rejects open trace files; quit
and EOF shut tracing down; the continue-mode rollup reports a traced
round on its own; repl.h gains the interactive-only trace gates. The
baseline transcript changes only in the help and info-usage lines.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Rongsong Shen 2026-10-08 15:15:04 +00:00
parent 8931833132
commit 6bac16812c
Signed by untrusted user: rshen
GPG key ID: 80533536B0EB651C
9 changed files with 820 additions and 3 deletions

View file

@ -154,4 +154,58 @@ static inline void xce_repl_check_replay_complete(xce_sched_sim_driver_t* sim)
}
}
/*
* Decision trace gates (scheduler-sim-decision-trace spec, task 5.2;
* design.md "SimIntegration"; Requirements 7.1-7.3, 11.3). The entry
* points live in repl_trace_emit.c and are declared here, like the
* xce_repl_on_* hooks above, so this header stays self-contained. Each
* gate forwards only when the REPL is interactive, so a non-interactive
* simulation never publishes trace settings or prints a trace (11.3):
* - xce_repl_trace_session_begin: after a successful core begin-session,
* before reconciliation; makes the next settings current and
* publishes them to the scheduling core.
* - xce_repl_trace_session_end: after the decision stream ends;
* withdraws the published settings.
* - xce_repl_check_trace: a decision carrying a trace record, after the
* echo gate and before the breakpoint check; takes d->trace.
* - xce_repl_check_trace_only: an XCE_DECISION_TRACE decision (a traced
* selection with no decision), handled before anything else.
*/
extern void repl_trace_session_begin(xce_sched_sim_driver_t* sim);
extern void repl_trace_session_end(xce_sched_sim_driver_t* sim);
extern void repl_trace_on_decision(xce_sched_sim_driver_t* sim,
xce_decision_t* d);
extern void repl_trace_on_trace_only(xce_sched_sim_driver_t* sim,
xce_decision_t* d);
static inline void xce_repl_trace_session_begin(xce_sched_sim_driver_t* sim)
{
if (sim->interactive) {
repl_trace_session_begin(sim);
}
}
static inline void xce_repl_trace_session_end(xce_sched_sim_driver_t* sim)
{
if (sim->interactive) {
repl_trace_session_end(sim);
}
}
static inline void xce_repl_check_trace(xce_sched_sim_driver_t* sim,
xce_decision_t* d)
{
if (sim->interactive && (d->trace != NULL)) {
repl_trace_on_decision(sim, d);
}
}
static inline void xce_repl_check_trace_only(xce_sched_sim_driver_t* sim,
xce_decision_t* d)
{
if (sim->interactive && (d->trace != NULL)) {
repl_trace_on_trace_only(sim, d);
}
}
#endif