feat(scheduler-sim-repl-verbosity): task 7.2 - implement resource formatting helpers

Implements repl_is_bytes_valued_resource()/repl_format_bytes_human()
(mirroring xce_test's confirmed is_bytes_valued_resource()/
format_bytes_human() precedent exactly) and the units_mode setting
(explicitly defaulted to both, not left to zero-init) wired into
set units raw|human|both alongside the existing set speed/output/verify
branches (Requirements 6.1-6.3). All 8 of task 7.1's tests pass.

Split repl_format_ts_human(), the Jobid Range Compressor (task 1.2),
and these two new helpers out of repl.c into a new repl_fmt.c: adding
them in place pushed repl.c to 929 lines (16.1% over the 800-line
cap), and unlike task 6.2's single-function split attempt (which
didn't even achieve compliance), bundling these three pure-formatter
groups together does - repl.c settles at 587 lines, repl_fmt.c at 402,
both comfortably under cap. Required a matching #include line in the
20 test files that white-box #include repl.c, plus extending
test_sim_isolation.c's forbidden-include/symbol scan to cover the new
file, following the repl_rollup.c split precedent from task 2.2.

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 17:45:06 +00:00
parent 11fe6194ce
commit 5ee1d6cb08
No known key found for this signature in database
GPG key ID: 5BCDAAE0123E9FE2
29 changed files with 634 additions and 317 deletions

View file

@ -20,6 +20,7 @@ scheduler_srcs = [
'src/sim_verify.c',
'src/sim_record.c',
'src/repl.c',
'src/repl_fmt.c',
'src/repl_rollup.c',
'src/repl_break.c',
'src/repl_info.c',
@ -96,7 +97,7 @@ sched_core_isolation_lib = static_library(
# Task 11.3 (scheduler-core spec, Req 5 AC 17): isolated compile target for
# the simulation driver's own files, consumed by
# testsuite/test_sim_isolation.c to prove at build time that
# sim.c/sim_loop.c/sim_record.c/repl.c/repl_break.c/repl_info.c/
# sim.c/sim_loop.c/sim_record.c/repl.c/repl_fmt.c/repl_break.c/repl_info.c/
# repl_params.c/sim_picker.c reference zero controller-facing symbols
# (client/netio/xceapi/delay/idgen). All files are compiled together into
# ONE archive -- task 11.2 added sim_loop.c as a sibling file to task
@ -105,19 +106,23 @@ sched_core_isolation_lib = static_library(
# fifth/sixth (task 12.2's own 800-line-cap split of repl.c's
# breakpoint/state-inspection logic -- repl_internal.h's own "Why a split
# at all" section has the full rationale), task 12.3 added repl_params.c
# as a seventh (the same split, extended again for `snapshot`/`set`), and
# as a seventh (the same split, extended again for `snapshot`/`set`),
# bug-1567's fix added sim_picker.c as an eighth (sim_loop.c's own
# "zero line-budget headroom" -- same reason its siblings above exist --
# so the fix's picker-registration + post-load picker-rebuild-walk logic
# lives here instead of growing sim_loop.c past its cap); covering only a
# subset of them would repeat core.c's own siblings' (core_events.c/
# core_session.c/core_clock.c) never-mechanically-covered gap for the sim
# driver. Same "compiling to an object is enough, no real linking needed"
# rationale as sched_core_isolation_lib above.
# lives here instead of growing sim_loop.c past its cap), and the
# scheduler-sim-repl-verbosity spec's task 7.2 remediation added repl_fmt.c
# as a ninth (repl.c's own 800-line-cap split of its shared, dependency-free
# formatting helpers -- repl_fmt.c's own header comment has the full
# rationale); covering only a subset of them would repeat core.c's own
# siblings' (core_events.c/core_session.c/core_clock.c)
# never-mechanically-covered gap for the sim driver. Same "compiling to an
# object is enough, no real linking needed" rationale as
# sched_core_isolation_lib above.
sched_sim_isolation_lib = static_library(
'sched_sim_isolation',
['src/sim.c', 'src/sim_loop.c', 'src/sim_picker.c', 'src/sim_record.c',
'src/repl.c', 'src/repl_break.c', 'src/repl_info.c',
'src/repl.c', 'src/repl_fmt.c', 'src/repl_break.c', 'src/repl_info.c',
'src/repl_params.c', 'src/repl_rollup.c'],
include_directories: incdir,
dependencies: scheduler_deps,