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:
Rongsong Shen 2026-10-08 14:42:27 +00:00
parent 27cad0b0b7
commit 4df29606f6
Signed by untrusted user: rshen
GPG key ID: 80533536B0EB651C
9 changed files with 941 additions and 4 deletions

View file

@ -2797,3 +2797,29 @@ sched_repl_trace_file_test = executable(
test('scheduler repl trace file test',
sched_repl_trace_file_test, suite: 'scheduler')
# scheduler-sim-decision-trace task 4.6: the trace session hooks and inline
# trace emission (design.md "SimIntegration", "ReplTraceControl",
# "Drain-loop emission order"; Requirements 1.6, 7.1-7.3, 8.1, 8.5).
# Session begin/end publish and withdraw the settings; step-mode placement;
# continue-mode flush, then echo, then trace; the per-round flags reset at
# session begin; the file copy byte-equal to the console. Links every
# scheduler source except main.c, so the emitter calls the real collapsed-
# range flush (repl_rollup.c) and echo printer (sim_loop.c). Leak detection
# stays on.
sched_repl_trace_emit_test_srcs = ['test_repl_trace_emit.c']
foreach f : scheduler_srcs
if f != 'src/main.c'
sched_repl_trace_emit_test_srcs += ['../' + f]
endif
endforeach
sched_repl_trace_emit_test = executable(
'sched_repl_trace_emit_test',
sched_repl_trace_emit_test_srcs,
include_directories:[incdir],
dependencies: [scheduler_deps, unity_dep],
install: false)
test('scheduler repl trace emit test',
sched_repl_trace_emit_test, suite: 'scheduler')