feat(scheduler-sim-repl-verbosity): task 1.2 - implement job identifier range compression

Implements repl_fmt_jobid_range() in repl.c (per design.md's "no new
production .c file" commitment), grouping job-array identifiers by base
and compressing contiguous index runs into [lo-hi] ranges. All 5 of task
1.1's RED-phase tests now pass.

Went through one review round: an initial GREEN implementation placed
the function in a new file (repl_jobid_range.c) to sidestep a linker
issue in the lean test target from task 1.1. Review found and verified
a cleaner fix: link the test against the full scheduler_srcs object list
(mirroring the existing sched_scheduler_connect_test precedent), which
resolves the same symbols without a new file. Remediated accordingly;
bug-1762 in buglog.json documents the investigation.

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 08:39:52 +00:00
parent f165e3a751
commit b639fae162
No known key found for this signature in database
GPG key ID: 5BCDAAE0123E9FE2
5 changed files with 788 additions and 434 deletions

View file

@ -974,21 +974,40 @@ sched_repl_equivalence_test = executable(
dependencies: [scheduler_test_deps, libedit_dep],
install: false)
# RED-phase contract test for the REPL's job-identifier range compressor
# (scheduler-sim-repl-verbosity spec, task 1.1, Requirement 4). Unlike every
# other sched_repl_*_test above, this is NOT a white-box #include of
# ../src/repl.c and friends -- repl_fmt_jobid_range() is a pure formatter
# with no xce_sched_sim_driver_t/xce_sched_core_t dependency, so this file
# declares it as a plain extern instead (see test_repl_output_compression.c's
# own header comment for the full rationale). As of task 1.1, the function
# has no definition anywhere in this codebase (task 1.2 adds it), so this
# target is EXPECTED to fail at link time -- that is task 1.1's own
# Observable evidence, not a defect in this build file.
# Contract test for the REPL's job-identifier range compressor
# (scheduler-sim-repl-verbosity spec, task 1.1/1.2, Requirement 4).
# repl_fmt_jobid_range() lives in ../src/repl.c (design.md's File Structure
# Plan: "implements the new shared jobid-range-compression helper ... in
# repl.c"), but repl.c's own dependency surface is too large for the lean
# "#include the one file under test" pattern the other lightweight REPL
# tests use (test_repl_output_compression.c declares repl_fmt_jobid_range()
# as a plain extern rather than #include-ing repl.c -- see that file's own
# header comment: repl.c's repl_dispatch() references repl_cmd_break/
# repl_cmd_info/repl_cmd_set/... from sibling files repl_break.c/
# repl_info.c/repl_params.c, and a directly-linked .o -- unlike an archive
# member -- requires ALL its undefined symbols resolved regardless of
# whether the calling code path is ever exercised). So instead this target
# links the real scheduler_srcs object list, the same technique
# sched_scheduler_connect_test below established for the identical "real
# production dependency surface, avoid textual inclusion" problem.
# scheduler_srcs (parent meson.build) minus src/main.c (this test file
# supplies its own main()) -- built via a loop, same as
# scheduler_connect_test_srcs below, so it can never drift from the
# production source list. No `-Wl,--wrap=` or `-DXCE_SCHEDULER_C_PATH` is
# needed here: this test never calls sched_init() or reaches networking
# code, it only exercises the pure repl_fmt_jobid_range() formatter.
repl_output_compression_test_srcs = ['test_repl_output_compression.c']
foreach f : scheduler_srcs
if f != 'src/main.c'
repl_output_compression_test_srcs += ['../' + f]
endif
endforeach
sched_repl_output_compression_test = executable(
'sched_repl_output_compression_test',
['test_repl_output_compression.c'],
repl_output_compression_test_srcs,
include_directories:[incdir],
dependencies: [scheduler_test_deps],
dependencies: [scheduler_deps, unity_dep],
install: false)
# Tests for the scheduler's unified candidate-list connect/rejoin pipeline