feat(scheduler-sim-repl-verbosity): task 8.2 - implement resource table rendering

Rewrites info worker's/info resource's resource-listing loops from a
flat, unconditional fprintf into a 3-pass, section-grouped table
(Consumable/Capacity, Load Metrics, Static Hardware Attributes),
units_mode-aware value rendering (raw/human/both, including swp's
MB->bytes conversion), whole-number formatting with no trailing .00
outside the consumable value=/used= pair, and jobid-range-compression
adoption for info worker's assigned-job listing (Requirements 6.4-6.6,
4.5). All 10 of task 8.1's tests pass. Preserves every named prior-bug
invariant (bug-1727's avail_v-as-total, bug-1613's consumable/
non-consumable split, bug-1593's GLOBAL/SHARED filter, bug-1688's
.caps-bound iteration).

Fixes one pre-existing test (bug-1688, predating this spec) whose
"value=5.00" assertion for a whole-number non-consumable resource
directly conflicts with Requirement 6.5's intentional no-trailing-.00
change - same class of fix as task 4.2's pre-existing-test updates.

repl_info.c grew from 985 to 1267 lines (58% over the 800-line cap,
worse than any other file this spec touched) - but unlike repl.c/
repl_break.c, it was already 23% over cap before this spec began.
Review empirically confirmed a narrow helper-only extraction doesn't
achieve compliance (still 41% over), and a compliance-achieving split
would mean restructuring ~690 lines of pre-existing display logic
this feature doesn't otherwise touch - a larger scheduler-core-level
decision, accepted as a residual rather than folded into this task.

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 19:32:29 +00:00
parent e48e222bd1
commit 9db99964f0
No known key found for this signature in database
GPG key ID: 5BCDAAE0123E9FE2
4 changed files with 415 additions and 130 deletions

View file

@ -333,6 +333,8 @@ void repl_build_prompt(xce_sched_sim_driver_t* sim, char* buf, size_t bufsz);
- `info worker`'s and `info resource`'s resource-listing loops are rewritten from an unstructured per-resource `fprintf` into an aligned table, grouped into labeled sections where applicable to that listing (consumable/capacity resources with a `used=` split; load/utilization metrics; static hardware attributes such as `type`/`model`/`cpuf`/`maxcpus`/`ndisks` — `info resource`'s cluster-wide GLOBAL/SHARED scope, per bug-1593, may not populate every section). Column widths are computed once (a shared field-width format), not hand-padded per line.
- Never alters the underlying stored/wire value or the deterministic outcome of a replay (Requirement 6.4) — display-only, same discipline `test.c`'s own `format_bytes_human()` doc comment states ("the stored/wire value stays raw bytes always, this never feeds back into anything").
**Accepted residual (post-review, task 8.2)**: implementing the table/grouping rendering pushed `repl_info.c` from 985 to 1267 lines (58% over the 800-line cap). Unlike `repl.c`/`repl_break.c`, `repl_info.c` was already 23% over cap (985 lines) before this spec touched it at all — this is inherited debt, not something this feature introduced from a clean baseline. Review empirically tried the narrow extraction (moving just this task's new classification/formatting helpers — `repl_classify_worker_resval_section`/`repl_classify_resource_def_section`/`repl_format_numeric_resource_value`, 137 lines — into the existing `repl_fmt.c`): it only reaches 1130 lines, still 41% over cap, the same "doesn't achieve compliance" outcome that got task 6.2's single-function split rejected as disproportionate. Achieving genuine compliance would require extracting the entire pre-existing `repl_info_worker_one()`/`repl_info_resource_one()`/`repl_info_resource()` display bodies (~690 lines) into a new domain file — a materially larger structural change (new `meson.build` entries, ~20 test files' `#include` lists) restructuring code this feature doesn't otherwise touch, which is a `scheduler-core`-level cleanup decision, not something to fold into this feature's own scope. Accepted in place; revisit only if a future `info`-command spec (e.g. `scheduler-sim-diagnostics`) adds enough new content here to make a full domain split worth doing on its own merits.
**Dependencies**
- Inbound: `repl_info_worker()`, `repl_info_resource()` (repl_info.c) (P0); `repl_cmd_set()` (repl_params.c) (P0)
- Outbound: none beyond standard C formatting — a self-contained classification/formatting pair, same shape as the Jobid Range Compressor

View file

@ -91,7 +91,7 @@
- _Requirements: 6.4, 6.5, 6.6, 4.5_
- _Boundary: Resource Value Formatter, Jobid Range Compressor_
- [ ] 8.2 (P) Implement the grouped table rendering for `info worker` and `info resource`
- [x] 8.2 (P) Implement the grouped table rendering for `info worker` and `info resource`
- Replace the flat per-resource print loop with a shared, grouped, aligned-column table renderer reading `rs->units_mode`; adopt the jobid-range-compression helper for the assigned-job listing
- Observable: all tests from 8.1 pass; a live `info worker all` against a real captured worker reproduces the hand-validated grouped-table shape instead of 20 unstructured lines
- _Requirements: 6.4, 6.5, 6.6, 4.5_