feat(scheduler-sim-repl-verbosity): task 4.2 - retire redundant per-decision echo
Gates sim_print_decision() so the bare per-decision line no longer prints under continue mode, making the Round Rollup's summary the sole source of decision output (Requirement 2.3, closing bug-1610). step mode and non-interactive/headless runs are completely unaffected (Requirements 5.1, 5.4). Implemented as a file-local inline wrapper in sim_loop.c rather than repl.h, since the gated function is static to that file and repl.h can't see repl_state's internals without leaking them to every other repl.h consumer. Fixes 3 pre-existing tests (predating this spec, from scheduler-core) that pinned the now-intentionally-changed bare-line behavior under continue mode - each fixed differently based on its actual purpose rather than uniformly: two kept continue mode with their anchor switched to the Round Rollup's summary (since they specifically test continue-mode breakpoint interruption, which step mode would trivialize), one switched to step mode (since its actual invariant - print-before-breakpoint-check call order - is mode-independent and continue mode no longer has any observable anchor for it). Review caught a second, unguarded sim_print_decision() call site in sim_reconcile_unaccounted_jobs() (added by an earlier, separately- merged spec) that design.md's boundary never accounted for - per the review, this is actually the dominant real-world path for DISPATCH decisions in replay mode, so leaving it unguarded would have defeated Requirement 2.3's "sole source of decision output" claim for the common case. Gated it through the same wrapper; added 2 new tests. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YAWMhfRJFnmmnG8h97yUDd
This commit is contained in:
parent
3d08a43a35
commit
d9109b7c4b
7 changed files with 386 additions and 39 deletions
|
|
@ -1768,12 +1768,12 @@ static void test_event_breakpoint_pauses_repl_at_matching_event(void)
|
|||
char aux_dir[PATH_MAX];
|
||||
char script_path[PATH_MAX];
|
||||
char capture_path[PATH_MAX];
|
||||
char pend_marker[80];
|
||||
char round_marker[96];
|
||||
char jobid_buf[64];
|
||||
FILE* f;
|
||||
char* captured;
|
||||
char* bp_pos;
|
||||
char* pend_pos;
|
||||
char* round_pos;
|
||||
|
||||
f = write_header_and_snapshot(replay_path, sizeof(replay_path),
|
||||
"_evbp");
|
||||
|
|
@ -1798,14 +1798,24 @@ static void test_event_breakpoint_pauses_repl_at_matching_event(void)
|
|||
|
||||
captured = run_group_d_and_capture(replay_path, script_path, capture_path);
|
||||
|
||||
/* bug-1591: sim_print_decision() (sim_loop.c) now renders jobids via
|
||||
* fmt_jobid(), not raw %llu -- this marker must match that same
|
||||
* human-readable form. */
|
||||
/* scheduler-sim-repl-verbosity task 4.2 (Req 2.3, bug-1610): under
|
||||
* `continue` mode sim_print_decision()'s bare per-decision line no
|
||||
* longer prints -- the Round Rollup (repl_rollup.c) reports the
|
||||
* session's decision instead, deferred until the collapsed range
|
||||
* ends. This fixture has exactly one round, so that range is only
|
||||
* flushed (and printed) by xce_repl_on_replay_complete()'s
|
||||
* repl_round_collapse_flush() call, triggered by the script's
|
||||
* trailing `quit`. Look for that round-rollup summary's
|
||||
* "jobids=<...>" field instead of the old bare "PEND jobid=<...>"
|
||||
* line as evidence the session's decision was eventually processed
|
||||
* -- bug-1591's fmt_jobid()-vs-raw-%llu fix applies equally to
|
||||
* repl_fmt_jobid_range()'s single-jobid rendering (repl.c), which is
|
||||
* byte-identical to fmt_jobid()'s own non-array format. */
|
||||
fmt_jobid(jobid_buf, sizeof(jobid_buf), 4242ULL);
|
||||
snprintf(pend_marker, sizeof(pend_marker), "PEND jobid=%s", jobid_buf);
|
||||
snprintf(round_marker, sizeof(round_marker), "jobids=%s", jobid_buf);
|
||||
|
||||
bp_pos = strstr(captured, "hit breakpoint 1 @ event #4: JOB_STATE_CHANGE");
|
||||
pend_pos = strstr(captured, pend_marker);
|
||||
bp_pos = strstr(captured, "hit breakpoint 1 @ event #4: JOB_STATE_CHANGE");
|
||||
round_pos = strstr(captured, round_marker);
|
||||
|
||||
TEST_ASSERT_NOT_NULL_MESSAGE(
|
||||
bp_pos, "the breakpoint must fire exactly at event #4 (jobid=222), "
|
||||
|
|
@ -1813,11 +1823,12 @@ static void test_event_breakpoint_pauses_repl_at_matching_event(void)
|
|||
TEST_ASSERT_NULL_MESSAGE(
|
||||
strstr(captured, "@ event #3"),
|
||||
"the breakpoint must NOT have fired on event #3 (jobid=111)");
|
||||
TEST_ASSERT_NOT_NULL_MESSAGE(pend_pos,
|
||||
TEST_ASSERT_NOT_NULL_MESSAGE(round_pos,
|
||||
"the session's own PEND decision must "
|
||||
"still have run after the resumed "
|
||||
"still have run (reported via the round "
|
||||
"rollup summary) after the resumed "
|
||||
"breakpoint pause");
|
||||
TEST_ASSERT_TRUE_MESSAGE(bp_pos < pend_pos,
|
||||
TEST_ASSERT_TRUE_MESSAGE(bp_pos < round_pos,
|
||||
"the event breakpoint (mid-batch, before "
|
||||
"push_events) must be reported BEFORE the "
|
||||
"session's own decision output");
|
||||
|
|
@ -1854,10 +1865,24 @@ static void test_decision_breakpoint_pauses_after_decision_output(void)
|
|||
make_tmp_dir(aux_dir, sizeof(aux_dir), "_decbpaux");
|
||||
snprintf(script_path, sizeof(script_path), "%s/script.txt", aux_dir);
|
||||
snprintf(capture_path, sizeof(capture_path), "%s/capture.out", aux_dir);
|
||||
/* task 12.5 (bug-1594): trailing `quit` -- see the event-breakpoint
|
||||
* test above for why. */
|
||||
write_text_file(script_path,
|
||||
"break DECISION type=PEND\ncontinue\ncontinue\nquit\n");
|
||||
/* scheduler-sim-repl-verbosity task 4.2 (Req 2.3, bug-1610): `continue`
|
||||
* mode now suppresses sim_print_decision()'s bare per-decision line
|
||||
* entirely (the Round Rollup reports it instead, deferred until the
|
||||
* collapsed range ends), so this fixture's single round would leave no
|
||||
* "PEND jobid=..." text to anchor the print-before-breakpoint-check
|
||||
* ordering this test exists to prove. That ordering
|
||||
* (sim_print_decision() then xce_repl_on_decision()'s breakpoint
|
||||
* check, sim_loop.c) is a mode-independent call-sequence invariant --
|
||||
* xce_repl_check_decision() (repl.h) gates only on `sim->interactive`,
|
||||
* never on REPL mode -- so `step` mode observes it exactly as well as
|
||||
* `continue` did, and `step` still prints the bare per-decision line
|
||||
* unconditionally (Requirement 5.1, unaffected by task 4.2). `step 1`
|
||||
* pauses after session 1 completes, but the decision breakpoint below
|
||||
* fires and nests its own repl_command_loop() first, so the trailing
|
||||
* `quit` is read from within THAT nested loop -- same "quit ends the
|
||||
* child deterministically" requirement as the `continue` scripts above,
|
||||
* just reached via a different pause mechanism. */
|
||||
write_text_file(script_path, "break DECISION type=PEND\nstep 1\nquit\n");
|
||||
|
||||
captured = run_group_d_and_capture(replay_path, script_path, capture_path);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue