feat(scheduler-sim-discrete-clock): retire --sim-speed as a warn-once no-op, end-to-end CLI tests (task 2.3)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Rongsong Shen 2026-09-29 05:06:06 +00:00
parent 05320e777b
commit eb5f339541
Signed by untrusted user: rshen
GPG key ID: 80533536B0EB651C
3 changed files with 311 additions and 24 deletions

View file

@ -11,7 +11,7 @@ Test-first throughout (red → green → refactor). Every sub-task leaves the bu
- _Requirements: 2.3, 2.4, 2.5_
- _Boundary: CliCompat, scheduler test build_
- [ ] 2. Core: pin the simulator clock, remove the REPL speed parameter, retire the CLI option
- [x] 2. Core: pin the simulator clock, remove the REPL speed parameter, retire the CLI option
- [x] 2.1 (P) Pin the simulation-mode clock so it moves only at recorded timestamps
- Write the tests first in the new test binary, each passing a non-zero speed through the still-present simulator argument so they fail on the current code: after start the clock equals the chosen snapshot's timestamp and stays equal after a real sleep, with the core holding the frozen speed setting; with a stand-in allocator that sleeps and a recorded session start that is not a whole second, the session start seen inside the session equals the recorded one exactly, and simulation output has that session start, a zero session duration and every decision timestamp equal to it, with at least one decision per session; a session start earlier than the preceding event, and events earlier than the start snapshot, set the clock to exactly those values and the replay completes; a mid-replay snapshot followed by the end marker leaves the clock at the last event's timestamp after the run and after a sleep, with the start timestamp pinned so the real skip branch runs; the same recording replayed twice gives identical logical timestamps and decisions in both outputs, ignoring only the wall-clock header field (design.md, Testing Strategy: Unit (SimClock), Integration (replay loop)).
- Make simulator startup always select the frozen clock setting and drop the speed parameter from the start-clock function. The start-clock function keeps writing the shadow copy, now always the frozen setting, because `info config` and the startup test still read it; the simulator's speed argument is no longer read. Both are removed in 3.1.
@ -27,7 +27,7 @@ Test-first throughout (red → green → refactor). Every sub-task leaves the bu
- Done when the REPL tests pass and no REPL output or help text offers a speed setting.
- _Requirements: 1.5, 3.1, 3.2, 3.3, 3.4, 3.5_
- _Boundary: ReplSet, ReplHelp, ReplInfo_
- [ ] 2.3 Retire `--sim-speed` on the command line and prove the default command line end to end
- [x] 2.3 Retire `--sim-speed` on the command line and prove the default command line end to end
- Write the tests first in the new test binary, running the built scheduler binary as a child process on a fixture the test writes (session start not a whole second, a pending job before each session), draining its stdout before collecting the exit status: without the option it exits 0, its output has exact session starts, zero durations and decision timestamps equal to the session start, and its log has no warning; with each of `7`, `abc`, `-1` and an empty value (fresh output and log files per run) it exits 0, its output matches the default run except the wall-clock header field, and its log has exactly one warning naming the value; a repeated option logs one warning naming the last value; a trailing option with no value exits non-zero; an interactive run at end of input logs exactly one warning; `--help` describes the option as deprecated and mentions no real-time or as-fast-as-possible mode.
- Stop defaulting, validating and passing a simulation speed; call the warning helper once right after the logger starts and, when the option was given, drain and restart the logger there while still single-threaded; update the option's help text and the comment that cites its numeric validation; the flag-meaning comments that describe the simulator speed argument are left to 3.1 (design.md, Modified Files: `main.c`; Error Handling).
- Done when the end-to-end and help tests pass; the runs with `abc`, `-1`, an empty value and `7`, the repeated-option run, the interactive run and the help test fail against the pre-change command-line handling, while the run without the option is a regression guard that 2.1 already makes pass.