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
This commit is contained in:
Rongsong Shen 2026-09-03 03:54:01 +00:00
parent 1374540954
commit 6a2aa47f5e
No known key found for this signature in database
GPG key ID: 5BCDAAE0123E9FE2
3 changed files with 1050 additions and 1 deletions

View file

@ -1,7 +1,7 @@
# Implementation Plan
- [ ] 1. Core: event echo preamble deduplication
- [ ] 1.1 Write failing tests for preamble deduplication across consecutive echoed events
- [x] 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`

View file

@ -965,6 +965,42 @@ sched_repl_event_echo_test = executable(
dependencies: [scheduler_test_deps, libedit_dep],
install: false)
# Contract test for the interactive simulation REPL's Event Echo Preamble
# Deduplicator component (scheduler-sim-step-verbosity spec, task 1.1,
# Requirements 1 and 2 "collapse the repeated timestamp/session preamble
# across consecutive same-context echoed events"): two consecutive echoed
# events sharing the same rendered (second-granularity) timestamp and
# displayed session omit the second's preamble line while still printing
# its own content line; events spanning a session boundary each print their
# own full preamble; two events whose raw high-resolution timestamps differ
# but whose rendered timestamp and session are identical still dedupe (the
# design's central "rendered value, not raw ns" nuance); the first echoed
# event of a fresh REPL session always prints its preamble; the same rule
# applies to a structural event echoed under `continue` mode after a
# stretch of suppressed routine events; and event content/ordering stay
# unaffected by the preamble decision at N=3 consecutive same-context
# events. THIS TASK (1.1) IS RED-PHASE ONLY -- see this file's own header
# comment. Same white-box #include pattern and forked-child/real-stdout-
# capture technique as sched_repl_event_echo_test above (core.c,
# core_clock.c, core_events.c, core_session.c, decision.c, plugin.c,
# plugins/builtin_fcfs.c, recording.c, recording_session.c, sim.c,
# sim_loop.c, sim_record.c, sim_verify.c,
# snapshot.c/snapshot_wire.c/snapshot_load.c, repl.c, repl_fmt.c,
# repl_rollup.c, repl_break.c, repl_info.c, repl_params.c). Split into its
# own file from the start rather than appended to test_repl_event_echo.c
# (705 lines before this feature) -- design.md's File Structure Plan flags
# this file's ~1000-line split trigger, and this task's six behavioral
# cases plus their own preamble-construction helper would have pushed it
# well past that threshold; the same reasoning that already split
# test_repl_round_rollup.c/test_repl_event_echo.c/test_repl_prompt_context.c/
# test_sim_print_decision_gate.c out of test_repl_execution_control.c.
sched_repl_step_verbosity_test = executable(
'sched_repl_step_verbosity_test',
['test_repl_step_verbosity.c'],
include_directories:[incdir],
dependencies: [scheduler_test_deps, libedit_dep],
install: false)
# Contract test for the interactive simulation REPL's Prompt Context
# component (scheduler-sim-repl-verbosity spec, task 6.1, Requirement 5.5
# "REPL prompt shows session/timestamp"): the readline() prompt is the
@ -1563,6 +1599,9 @@ test('scheduler repl round rollup test',
test('scheduler repl event echo test',
sched_repl_event_echo_test, suite: 'scheduler',
env: ['ASAN_OPTIONS=detect_leaks=0'])
test('scheduler repl step verbosity test',
sched_repl_step_verbosity_test, suite: 'scheduler',
env: ['ASAN_OPTIONS=detect_leaks=0'])
test('scheduler repl prompt context test',
sched_repl_prompt_context_test, suite: 'scheduler',
env: ['ASAN_OPTIONS=detect_leaks=0'])

File diff suppressed because it is too large Load diff