feat(scheduler-core): implement REPL snapshot capture and simulation parameter commands (task 12.3)

Adds `snapshot [FILE]` and `set speed|output|verify ...`/`info config`
(Req 5 AC 22 "Snapshots"/"Simulation parameters") to the interactive
simulation REPL.

`snapshot` reuses sim_record.c's existing sim_record_write_header_and_
snapshot() (task 11.5) rather than reimplementing capnp encoding, so
the produced file is genuinely loadable via a fresh --sim invocation
-- the task's own Observable. `set speed`/`set output`/`set verify`
mutate fields sim_loop.c and core_clock.c already read fresh on every
event/session, so no new hook points were needed and sim_loop.c stays
untouched at exactly 800/800 lines (this project's hard per-file cap).

New repl_params.c is a fourth sibling in the repl.c/repl_break.c/
repl_info.c split (task 12.2's precedent) -- neither existing file had
headroom left under the 800-line cap for this task's own logic.

Scheduler suite: 36/36 clean (was 35/35). Review independently
reproduced the RED-phase probe and additionally verified the
snapshot round-trip Observable is non-vacuous.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JPPXeKSUXUqcqvzNXY1rzJ
This commit is contained in:
Rongsong Shen 2026-08-07 10:25:32 +00:00
parent 2fecea3592
commit 2329dbf2a8
Signed by: rshen
SSH key fingerprint: SHA256:8Vf2pZ3h6rJa7EhGK+WaAQ9Mta/apZvteW6g9U/WKKk
18 changed files with 2755 additions and 110 deletions

View file

@ -21,6 +21,7 @@ scheduler_srcs = [
'src/repl.c',
'src/repl_break.c',
'src/repl_info.c',
'src/repl_params.c',
'src/schedobj.c',
'src/plugin.c',
'src/resource.c',
@ -80,23 +81,24 @@ sched_core_isolation_lib = static_library(
# Task 11.3 (scheduler-core spec, Req 5 AC 17): isolated compile target for
# the simulation driver's own files, consumed by
# testsuite/test_sim_isolation.c to prove at build time that
# sim.c/sim_loop.c/sim_record.c/repl.c/repl_break.c/repl_info.c reference
# zero controller-facing symbols (client/netio/xceapi/delay/idgen). All
# files are compiled together into ONE archive -- task 11.2 added
# sim_loop.c as a sibling file to task 11.1's sim.c, task 11.5 added
# sim_record.c as a third, task 12.1 added repl.c as a fourth, and task
# 12.2 adds repl_break.c/repl_info.c as a fifth/sixth (task 12.2's own
# 800-line-cap split of repl.c's breakpoint/state-inspection logic --
# sim.c/sim_loop.c/sim_record.c/repl.c/repl_break.c/repl_info.c/
# repl_params.c reference zero controller-facing symbols (client/netio/
# xceapi/delay/idgen). All files are compiled together into ONE archive --
# task 11.2 added sim_loop.c as a sibling file to task 11.1's sim.c, task
# 11.5 added sim_record.c as a third, task 12.1 added repl.c as a fourth,
# task 12.2 added repl_break.c/repl_info.c as a fifth/sixth (task 12.2's
# own 800-line-cap split of repl.c's breakpoint/state-inspection logic --
# repl_internal.h's own "Why a split at all" section has the full
# rationale); covering only a subset of them would repeat core.c's own
# siblings' (core_events.c/core_session.c/core_clock.c)
# never-mechanically-covered gap for the sim driver. Same "compiling to an
# object is enough, no real linking needed" rationale as
# rationale), and task 12.3 adds repl_params.c as a seventh (the same
# split, extended again for `snapshot`/`set`); covering only a subset of
# them would repeat core.c's own siblings' (core_events.c/core_session.c/
# core_clock.c) never-mechanically-covered gap for the sim driver. Same
# "compiling to an object is enough, no real linking needed" rationale as
# sched_core_isolation_lib above.
sched_sim_isolation_lib = static_library(
'sched_sim_isolation',
['src/sim.c', 'src/sim_loop.c', 'src/sim_record.c', 'src/repl.c',
'src/repl_break.c', 'src/repl_info.c'],
'src/repl_break.c', 'src/repl_info.c', 'src/repl_params.c'],
include_directories: incdir,
dependencies: scheduler_deps,
install: false)