feat(scheduler-sim-repl-verbosity): task 3.1 - RED-phase Event Echo Gate tests

Adds 4 tests in a new test_repl_event_echo.c covering mode-aware event
echo suppression and ending an active collapsed range on structural
events/breakpoint hits (Requirements 1.1-1.4, 3.5, 3.6). Job-free
fixtures (QUEUE_UPDATE/WORKERS_PUSH only) sidestep bug-1595's
jobid-reuse hazard entirely rather than merely avoiding it. 3 of 4
tests fail as expected RED evidence; the 4th (step-mode regression
check) correctly passes since it exercises unchanged behavior.

New file rather than extending test_repl_execution_control.c (already
over the 800-line cap at 937 lines) - applying the same file-size
lesson from tasks 2.1/2.2 proactively, decided before implementation
rather than after a review round.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YAWMhfRJFnmmnG8h97yUDd
This commit is contained in:
Rongsong Shen 2026-09-02 12:34:45 +00:00
parent 921c72bb40
commit f587a441ac
No known key found for this signature in database
GPG key ID: 5BCDAAE0123E9FE2
4 changed files with 742 additions and 4 deletions

View file

@ -114,9 +114,12 @@ flowchart TD
- `src/scheduler/include/repl.h` — no functional change expected; existing inline wrappers already cover the gating points this feature needs.
### New/Modified Test Files
**Correction (post-review, task 2.1)**: `test_repl_execution_control.c` was already over this project's 800-line cap (937 lines) before this feature's work began. Landing task 2.1's Round Rollup tests there per the original plan below pushed it to 1563 lines — nearly double the cap, and past the ~1000-line threshold this exact spec family already treats as a split trigger (`test_repl_snapshot_params.c` was split out of `test_repl_breakpoints_inspection.c` for precisely this reason; see that file's own meson.build comment). Round Rollup's tests (task 2.1, and any Round-Rollup-internal portion of later tasks, e.g. Requirement 3.5's flush-on-structural-event/breakpoint interaction) now live in a new `src/scheduler/testsuite/test_repl_round_rollup.c` instead, duplicating (not sharing) whatever pre-existing static fixture helpers it needs — the established convention this same file pair (`test_repl_breakpoints_inspection.c`/`test_repl_snapshot_params.c`) already follows, rather than factoring out a shared test-helper header. `test_repl_execution_control.c` remains the target for Requirement 1's Event Echo Gate tests, the `sim_print_decision` gate tests, the Requirement 5 no-regression checks, the new prompt-content tests (Requirement 5.5), and `help`-listing structure tests (Requirement 7.1-7.4) — but re-check its line count before landing each of those; if it approaches the cap again, split further rather than growing past it.
- `src/scheduler/testsuite/test_repl_execution_control.c` — child-process output-capture tests covering Requirement 1, the Requirement 5 no-regression checks (this file already drives `sched_sim_driver_run()` end-to-end and captures real process output via `child_continue_then_inspect`-style helpers); also gains the new prompt-content tests (Requirement 5.5) and `help`-listing structure tests (Requirement 7.1-7.4) — the natural home given it already exercises `readline()`/prompt-adjacent behavior and no `help` test exists anywhere today.
- `src/scheduler/testsuite/test_repl_round_rollup.c` (new, per the Correction above) — child-process output-capture tests for Requirements 2 and 3 (per-round decision summary, collapsing, the shared flush entry point, and its call from `xce_repl_on_replay_complete`).
**Correction (post-review, task 2.1)**: `test_repl_execution_control.c` was already over this project's 800-line cap (937 lines) before this feature's work began. Landing task 2.1's Round Rollup tests there per the original plan below pushed it to 1563 lines — nearly double the cap, and past the ~1000-line threshold this exact spec family already treats as a split trigger (`test_repl_snapshot_params.c` was split out of `test_repl_breakpoints_inspection.c` for precisely this reason; see that file's own meson.build comment). Round Rollup's tests (task 2.1, and any Round-Rollup-internal portion of later tasks, e.g. Requirement 3.5's flush-on-structural-event/breakpoint interaction) now live in a new `src/scheduler/testsuite/test_repl_round_rollup.c` instead, duplicating (not sharing) whatever pre-existing static fixture helpers it needs — the established convention this same file pair (`test_repl_breakpoints_inspection.c`/`test_repl_snapshot_params.c`) already follows, rather than factoring out a shared test-helper header. `test_repl_execution_control.c` remains at its restored 937-line pre-feature size (still over cap on its own, a pre-existing condition this feature doesn't need to fix) and is the target only for the Requirement 5 no-regression checks, the new prompt-content tests (Requirement 5.5), and `help`-listing structure tests (Requirement 7.1-7.4) — re-check its line count before landing each of those; if it approaches ~1000+ lines again, split further rather than growing past it.
**Correction (post-review, task 3.1)**: applying the same reasoning that split Round Rollup's tests out in task 2.1 — Requirement 1's Event Echo Gate tests are comparable in scope (4 behavioral cases: routine-event suppression, step-mode-unaffected, structural-event-ends-range, breakpoint-ends-range) and would push the already-over-cap `test_repl_execution_control.c` (937 lines) well past 1300+ lines. They instead live in a new `src/scheduler/testsuite/test_repl_event_echo.c`, duplicating pre-existing fixture helpers per this file family's established convention, decided proactively before implementation rather than after a review round.
- `src/scheduler/testsuite/test_repl_execution_control.c` — the Requirement 5 no-regression checks (this file already drives `sched_sim_driver_run()` end-to-end and captures real process output via `child_continue_then_inspect`-style helpers); also gains the new prompt-content tests (Requirement 5.5) and `help`-listing structure tests (Requirement 7.1-7.4) — the natural home given it already exercises `readline()`/prompt-adjacent behavior and no `help` test exists anywhere today.
- `src/scheduler/testsuite/test_repl_round_rollup.c` (new, per the task 2.1 Correction above) — child-process output-capture tests for Requirements 2 and 3 (per-round decision summary, collapsing, the shared flush entry point, and its call from `xce_repl_on_replay_complete`).
- `src/scheduler/testsuite/test_repl_event_echo.c` (new, per the task 3.1 Correction above) — child-process output-capture tests for Requirement 1 (mode-aware event echo classification, ending an active collapsed range on structural events/breakpoint hits).
- `src/scheduler/testsuite/test_repl_output_compression.c` (new) — focused unit tests for the jobid-range-compression helper (Requirement 4): a pure function, tested without the process harness.
- `src/scheduler/testsuite/test_repl_resource_formatting.c` (new) — focused unit tests for the byte/megabyte classification and adaptive human-scaling helpers (Requirement 6.1, 6.2, 6.5): pure functions, tested without the process harness, mirroring `test_repl_output_compression.c`'s pattern.
- `src/scheduler/testsuite/test_repl_breakpoints_inspection.c` — extended with `info worker`/`info resource` table-layout and units-mode-display tests (Requirement 6.6, alongside its existing `info worker`/`info resource` tests) and `break`'s enriched unrecognized-event-type error test (Requirement 7.5, alongside the existing `test_break_unrecognized_event_type_rejected`).

View file

@ -29,7 +29,7 @@
- _Boundary: Round Rollup_
- [ ] 3. (P) Core: mode-aware event echo, including ending an active collapsed range on structural events or breakpoint hits — Depends: 2.2
- [ ] 3.1 (P) Write failing tests for suppressing routine event chatter and for ending an active collapsed range at the right moments
- [x] 3.1 (P) Write failing tests for suppressing routine event chatter and for ending an active collapsed range at the right moments
- Cover: a routine per-tick event (a job status change, job progress update, job resource-usage update, queue update, or partial/delta resource-value update) produces no line under continuous execution; the same event still produces a line while single-stepping; a structural change (new jobs, workers, or resources arriving, a full resource-value snapshot arriving, or configuration pushed) still produces a line under continuous execution and ends any active collapsed range first; an event matching a breakpoint still interrupts continuous execution regardless of its classification, and ends any active collapsed range before the interruption is shown
- Observable: the new test cases fail against today's unconditional per-event echo, which has no classification or range-ending behavior
- _Requirements: 1.1, 1.2, 1.3, 1.4, 3.5, 3.6_