myxce/.kiro/specs/scheduler-sim-step-verbosity/tasks.md
Rongsong Shen 6a2aa47f5e
test(scheduler-sim-step-verbosity): task 1.1 - RED tests for preamble dedup
Adds 6 failing tests for the Event Echo Preamble Deduplicator
(Requirements 1.1-1.4, 2.2): a second echoed event sharing its
predecessor's rendered timestamp+session omits its preamble; two
events across a session boundary both print their own preamble; the
critical raw-vs-rendered nuance (Requirement 1.3) - two events whose
raw nanosecond timestamps genuinely differ but whose rendered,
second-granularity timestamp and session are identical still dedupe,
with a fixture-premise self-check proving the two raw values really
do render identically; the first echoed event in a fresh session
always prints its preamble; a structural event under continue mode
after suppressed routine events follows the same rule; event content
and ordering are unaffected regardless of the preamble decision.

Lands in a new test_repl_step_verbosity.c (1010 lines, 6 tests) rather
than extending test_repl_event_echo.c (705 lines) - proactive split
per this file family's established practice, since appending would
have pushed that file well past the project's ~1000-line trigger.
Registered in testsuite/meson.build. No production code touched.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YAWMhfRJFnmmnG8h97yUDd
2026-09-03 03:54:01 +00:00

3.9 KiB

Implementation Plan

  • 1. Core: event echo preamble deduplication

  • 1.1 Write failing tests for preamble deduplication across consecutive echoed events

    • Cover: two consecutive echoed events with identical rendered timestamp and session omit the second's preamble; two consecutive events with a different session both print their own preamble; two consecutive events whose raw high-resolution timestamps differ but whose rendered timestamp and session are identical still dedupe; the first echoed event in a fresh REPL session always prints its preamble; a structural event echoed under continue mode after a stretch of suppressed routine events follows the same rule; every event's own content line and ordering remain present and unaffected regardless of the preamble decision
    • Observable: the new test cases fail against today's REPL, which prints the timestamp/session preamble unconditionally before every echoed event
    • After adding the new test cases, check test_repl_event_echo.c's resulting line count against this project's ~1000-line split trigger (design.md's File Structure Plan); if approached or exceeded, split the preamble-dedup tests into a new test_repl_step_verbosity.c (duplicating shared fixture helpers per this file family's established convention) and register the new file's test target in testsuite/meson.build
    • Requirements: 1.1, 1.2, 1.3, 1.4, 2.2
    • Boundary: Event Echo Preamble Deduplicator
  • 1.2 Implement the preamble deduplication cache and print-skip logic

    • Add the last-printed rendered timestamp and session cache to the REPL session state, zero-initialized alongside the state's existing fields; update the event echo path to compare the candidate rendered timestamp and session against the cache, printing and updating it only when either has changed (or no preamble has been printed yet this session), while always still printing the event's own content line unconditionally
    • Observable: all tests from 1.1 pass; a captured transcript shows exactly one preamble line per distinct rendered (timestamp, session) run of consecutive echoed events, with every event's own content line still present
    • After landing the implementation change, re-check repl_break.c's line count against its already-accepted 949-line residual (design.md's Architecture Integration); if it meaningfully exceeds that residual, evaluate extracting repl_print_event_summary() and its Event Echo Gate neighbors into a new file rather than pre-splitting speculatively
    • Requirements: 1.1, 1.2, 1.3, 1.4, 2.2
    • Boundary: Event Echo Preamble Deduplicator
  • 2. Validation: regression and real-transcript verification

  • 2.1 Verify every other REPL command and mode's existing behavior remain unchanged outside the preamble's own deduplication

    • Confirm which events are echoed, event ordering, event content, and every other REPL command's behavior and output match their pre-feature baseline exactly except for the preamble line's now-conditional printing; confirm no scheduling decision or simulation state changed as a result of this feature
    • Observable: the existing REPL test suite's pre-existing assertions all still pass, updated only where a specific assertion pinned the old always-print-preamble shape for two events that legitimately share rendered context (each such update documented with which acceptance criterion justifies it), and a step-mode transcript comparison against the pre-feature baseline shows no textual difference outside the preamble line's presence or absence
    • Requirements: 2.1, 2.3, 2.4
  • 2.2 Run the full scheduler test suite and re-verify against a realistic multi-event transcript

    • Observable: the full test suite passes with no regressions, and a step/continue pass over a transcript containing several consecutive same-context events shows the preamble collapsing to one line per distinct context while every event's own content line still appears in order
    • Requirements: 1.1, 1.2, 1.3, 1.4, 2.1, 2.2, 2.3, 2.4