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:
parent
11fe6194ce
commit
5ee1d6cb08
29 changed files with 634 additions and 317 deletions
|
|
@ -44,9 +44,9 @@
|
|||
### Allowed Dependencies
|
||||
- Existing `xce_sched_repl_state_s` fields (`mode`, `last_n_dispatch`/`last_n_pend`/`last_n_preempt`, `session_count`) — repl_internal.h.
|
||||
- The existing `core->jobs` iteration idiom (`iter_make`/`iter_next`, `JOB_IS_PEND`) already used by `repl_info_jobs()`.
|
||||
- Existing helpers `fmt_jobid_ex()` (lib/utils.c) and `repl_format_ts_human()` (repl.c).
|
||||
- Existing helpers `fmt_jobid_ex()` (lib/utils.c) and `repl_format_ts_human()` (`repl_fmt.c` post-review, task 7.2 Correction below — originally `repl.c`).
|
||||
- Must not add a new call site to `sim_loop.c`'s main loop beyond gating the two calls that already exist there (`sim_print_decision`, the `xce_repl_check_event` wrapper) — that file is documented at its line-budget ceiling (repl.h's own header comment).
|
||||
- `xce_sched_repl_state_s.session_count` and `xce_core_now()`/`repl_format_ts_human()` (repl.c) for the prompt's session/timestamp content — no new state needed for that part.
|
||||
- `xce_sched_repl_state_s.session_count` and `xce_core_now()`/`repl_format_ts_human()` (`repl_fmt.c` post-review, task 7.2 Correction below — originally `repl.c`) for the prompt's session/timestamp content — no new state needed for that part.
|
||||
- `repl_break.c`'s existing `BP_KIND_TABLE` (currently `static`/file-local) — exposed via one new shared accessor declared in `repl_internal.h`, rather than duplicated as a second hardcoded list, so `help` and the unrecognized-event-type error can never drift out of sync with each other or with the table itself.
|
||||
- The existing `repl_command_loop()` call site's `readline(XCE_REPL_PROMPT)` (repl.c:439) — this feature makes the prompt argument dynamic in place; no new call site.
|
||||
- `src/controller/testsuite/test.c`'s `is_bytes_valued_resource()`/`format_bytes_human()` as a design *precedent* only (same classification list, same adaptive B/KB/MB/GB/TB/PB algorithm) — not a shared symbol, since `xce_test` and `xce_scheduler` are separate binaries; the scheduler gets its own `repl_*`-named port of the same logic.
|
||||
|
|
@ -88,7 +88,7 @@ flowchart TD
|
|||
**Architecture Integration**:
|
||||
- Selected pattern: a state accumulator attached to the existing round-boundary hook (`xce_repl_post_session_check`), exposing one shared flush entry point that `repl_break.c`'s event/breakpoint/decision hooks and `repl.c`'s replay-completion hook all call — no new hook call sites added to `sim_loop.c`.
|
||||
- Domain/feature boundaries: the Round Rollup's state and flush/print logic live in `repl_rollup.c` (split out of `repl.c` post-review — see Correction below); `repl_break.c` calls the flush entry point but does not own or mutate the collapse state directly; `sim_loop.c` only gains a mode gate on its two existing calls.
|
||||
- Existing patterns preserved: `repl.h`'s `sim->interactive`-gated inline-wrapper convention; `repl.c`'s shared-helper convention (`repl_format_ts_human`, `repl_split_tokens`) extended with two new shared helpers (range compression, staying in `repl.c`; and the round-rollup flush entry point, now implemented in `repl_rollup.c` per the Correction below, declared in `repl_internal.h` for `repl.c`/`repl_break.c` to call).
|
||||
- Existing patterns preserved: `repl.h`'s `sim->interactive`-gated inline-wrapper convention; `repl.c`'s shared-helper convention (`repl_format_ts_human`, `repl_split_tokens`) extended with new shared helpers (range compression and the resource-formatting helpers, now in `repl_fmt.c` per the task 7.2 Correction below; and the round-rollup flush entry point, now implemented in `repl_rollup.c` per the task 2.2 Correction below), declared in `repl_internal.h` for `repl.c`/`repl_break.c`/`repl_info.c`/`repl_params.c` to call.
|
||||
- New components rationale: deciding "print now vs. extend silently" requires comparing against the *previous* round's fingerprint, which must persist across separate `xce_repl_post_session_check()` invocations — hence new persistent fields on `xce_sched_repl_state_s` rather than function-local state. The flush entry point exists because three independent call sites (round boundary, breakpoint hit, replay completion) across two files all need to end an active range the same way.
|
||||
- Steering compliance: one domain per file preserved; `snake_case`/`repl_*` naming conventions followed throughout. **Correction (post-review, task 2.2, supersedes "no new production `.c` file needed" above)**: task 2.2's first pass kept the Round Rollup entirely inside `repl.c`, per this bullet's original text. That pushed `repl.c` to 1160 lines — 45% over this project's 800-line-per-file cap (`src/scheduler/CLAUDE.md`) — while review confirmed the logic itself was correct. The Round Rollup's fingerprint-build/pend-jobid-query/emit/flush/round-process functions (`repl_jobid_u64_cmp` through `repl_round_rollup_process`) now live in a new `src/scheduler/src/repl_rollup.c`, following the exact domain-split precedent this same file family already established for `repl_break.c`/`repl_info.c`/`repl_params.c` (`repl_internal.h`'s own "Why a split at all" section) — one more sibling sharing state via `repl_internal.h`, not a departure from that pattern. `repl.c`'s `repl_count_jobs()` becomes non-static so `repl_rollup.c`'s pend-jobid query can call it; both it and `repl_round_rollup_process()` gain `extern` declarations in `repl_internal.h`. `repl.c`'s own wiring calls (`xce_repl_post_session_check()`/`xce_repl_on_replay_complete()`) are unchanged. Tasks 6 (REPL Prompt Context) and 9 (Help & Breakpoint Discoverability/`BP_KIND_TABLE`) remain correctly targeted at `repl.c` — different domains (prompt construction, help/breakpoint-table rendering) with no Round Rollup logic of their own, unaffected by this correction.
|
||||
|
||||
|
|
@ -104,10 +104,13 @@ flowchart TD
|
|||
**Correction (post-review, task 2.2)**: keeping the Round Rollup's logic inside `repl.c`, as the original `repl.c`/`repl_internal.h` entries below described, pushed that file to 1160 lines — 45% over this project's 800-line cap (`src/scheduler/CLAUDE.md`) — even though review confirmed the logic itself was correct. The Round Rollup's fingerprint/query/emit/flush/process functions now live in a new `src/scheduler/src/repl_rollup.c` instead, matching this exact file family's established domain-split precedent (`repl_break.c`/`repl_info.c`/`repl_params.c` already split out of `repl.c` by domain, per `repl_internal.h`'s own "Why a split at all" section) rather than growing `repl.c` further. The `repl.c` and `repl_internal.h` entries below, and the new `repl_rollup.c` entry, reflect this. Tasks 6 (REPL Prompt Context) and 9 (Help & Breakpoint Discoverability) are unaffected — both remain correctly targeted at `repl.c`, a different domain with no Round Rollup logic of its own.
|
||||
|
||||
**Accepted residual (post-review, task 2.2)**: after the split, `repl.c` settled at 808 lines — 1% over the 800-line cap, down from the original 1160-line (45% over) violation. Verified empirically (not assumed): trimming the two doc comments this task added to their practical minimum recovers only 9 of the needed 17+ lines, and deleting both entirely would still leave 801. Getting strictly under 800 would require another file split for single-digit lines, which is disproportionate churn given this codebase already tolerates comparable or larger legacy exceptions (`scheduler.c` at 1382 lines, `plugins/builtin_fcfs.c` at 1026 lines, both noted in `src/scheduler/CLAUDE.md` as "do not use... as precedent for new files" but tolerated in place). 808 lines is accepted as this task's final state; if tasks 6/9's later `repl.c` additions push it meaningfully further over, revisit with a fresh split decision at that point rather than trimming comments further now.
|
||||
- `src/scheduler/src/repl_internal.h` — extend `xce_sched_repl_state_s` with round-collapse state fields (see Data Models), a new `units_mode` field (Requirement 6), and declare the new shared jobid-range-compression helper, resource-formatting helpers, and the `BP_KIND_TABLE` accessor (Requirement 7); post-review (Correction above), also declares `repl_count_jobs()` and `repl_round_rollup_process()` `extern` so `repl_rollup.c` can call the former and `repl.c` can call the latter.
|
||||
|
||||
**Correction (post-review, task 7.2)**: task 7.2's Resource Value Formatter helpers (`repl_is_bytes_valued_resource()`/`repl_format_bytes_human()`) landed directly in `repl.c`, exactly as this section's original text directed, pushing it to 929 lines — 16.1% over the 800-line cap (`src/scheduler/CLAUDE.md`) — while review confirmed the logic itself was correct. Unlike task 6.2's `repl_build_prompt()`/`repl_prompt.c` extraction attempt (tried and reverted — see the REPL Prompt Context component's own "Accepted residual" below — because even after absorbing 19 test files' worth of new `#include` churn, `repl.c` still only dropped to 814 lines, still over cap, for a 15-line function), this remediation moves a materially larger, genuinely cohesive block: `repl_format_ts_human()` (pre-existing, bug-1587), the entire Jobid Range Compressor (`xce_repl_jobid_group_t`/`repl_jobid_groups_free`/`repl_jobid_group_add_idx`/`repl_jobid_idx_cmp`/`repl_jr_appendf`/`repl_fmt_jobid_range`, task 1.2), and this task's `repl_is_bytes_valued_resource()`/`repl_format_bytes_human()` — three groups of pure, read-only formatting helpers this file family's own shared-helper convention already treated as a natural unit (none of them depend on `xce_sched_sim_driver_t`/`xce_sched_core_t` or any REPL session state) — into a new `src/scheduler/src/repl_fmt.c`, following the same `repl_rollup.c` domain-split precedent (task 2.2's Correction above). This achieves genuine compliance: `repl.c` settles at 587 lines, well under the 800-line cap, and `repl_fmt.c` itself is a self-contained 402-line file. `repl_internal.h`'s existing `extern` declarations for all of these functions are unchanged (only their doc comments now note the new defining file) — only which `.c` file DEFINES them changes, so every caller elsewhere in `repl.c`/`repl_break.c`/`repl_info.c`/`repl_params.c` keeps working unmodified. Added to both `scheduler_srcs` and `sched_sim_isolation_lib`'s source list in `src/scheduler/meson.build`, immediately after `repl.c` (matching `repl_rollup.c`'s own placement); every white-box test file that `#include`s `repl.c` directly (20 files, confirmed via `grep -rl '#include "\.\./src/repl\.c"' src/scheduler/testsuite/`) also gains a matching `#include "../src/repl_fmt.c"` line immediately after its existing `#include "../src/repl.c"`; `test_sim_isolation.c` gains a matching `XCE_SIM_REPL_FMT_C_PATH`-driven read/strip/assert/free block in both `test_sim_never_includes_forbidden_headers` and `test_sim_never_calls_forbidden_symbols`, mirroring the existing `repl_rollup_c`/`repl_params_c` pattern (`repl_rollup.c` was already covered by this scan since task 2.2's own commit; the only gap found was in the separate `test_sim_source_paths_are_readable` diagnostic sanity-check function, which does not affect actual isolation coverage and was left as-is). `sched_repl_output_compression_test`/`sched_repl_resource_formatting_test` (tasks 1.1/7.1) need no `#include` change: per bug-1762's fix, both already link the real `scheduler_srcs` object list rather than white-box `#include`-ing `repl.c`, so they pick up `repl_fmt.c`'s new definitions automatically once it is added to `scheduler_srcs`.
|
||||
- `src/scheduler/src/repl_internal.h` — extend `xce_sched_repl_state_s` with round-collapse state fields (see Data Models), a new `units_mode` field (Requirement 6), and declare the new shared jobid-range-compression helper, resource-formatting helpers, and the `BP_KIND_TABLE` accessor (Requirement 7); post-review (Correction above), also declares `repl_count_jobs()` and `repl_round_rollup_process()` `extern` so `repl_rollup.c` can call the former and `repl.c` can call the latter. Post-review (task 7.2 Correction above): the `extern` declarations for `repl_format_ts_human()`/`repl_fmt_jobid_range()`/`repl_is_bytes_valued_resource()`/`repl_format_bytes_human()` are unchanged in shape or signature — only their doc comments were updated to point at `repl_fmt.c` as the new defining file instead of `repl.c`.
|
||||
- `src/scheduler/src/repl_break.c` — `xce_repl_on_event()` gains routine-vs-structural event classification gated on `rs->mode` (Requirement 1); `repl_print_event_summary()`'s `JOB_PUSH`-style cases adopt the jobid-range-compression helper (Requirement 4); `xce_repl_on_event()`, `xce_repl_on_begin_round()`, and `xce_repl_on_decision()` each call the Round Rollup's flush entry point before printing a structural-event line or before re-entering `repl_command_loop()` on a breakpoint hit (Requirement 3.5, 3.6); `repl_cmd_break()`'s unrecognized-event-type error gains the full valid-event-type listing, rendered via a new shared accessor over the existing `BP_KIND_TABLE` (Requirement 7.5); `repl_cmd_delete()` already fixed independently (bug-1761, `strtol`+endptr validation) — no further change needed here for this spec.
|
||||
- `src/scheduler/src/repl.c` — `xce_repl_post_session_check()` calls the Round Rollup's round-boundary fingerprint/collapse logic, and `xce_repl_on_replay_complete()` calls its flush entry point before printing the existing replay-complete banner (Requirements 2, 3; post-review Correction above: the Round Rollup's own logic — fingerprint build, collapse, flush, emit — now lives in the new `repl_rollup.c` below, not here); implements the new shared jobid-range-compression helper (Requirement 4), following the file's existing shared-helper convention; `repl_command_loop()`'s `readline(XCE_REPL_PROMPT)` call gains a per-iteration dynamically-built prompt (Requirement 5.5); `repl_print_help()` is rewritten into labeled, consistently-aligned sections, `info config` moves next to the other `info` lines, and the `break` line grows the same `BP_KIND_TABLE`-derived event-type listing `repl_break.c`'s error message uses (Requirement 7).
|
||||
- `src/scheduler/src/repl.c` — `xce_repl_post_session_check()` calls the Round Rollup's round-boundary fingerprint/collapse logic, and `xce_repl_on_replay_complete()` calls its flush entry point before printing the existing replay-complete banner (Requirements 2, 3; post-review Correction above: the Round Rollup's own logic — fingerprint build, collapse, flush, emit — now lives in the new `repl_rollup.c` below, not here); `repl_command_loop()`'s `readline(XCE_REPL_PROMPT)` call gains a per-iteration dynamically-built prompt (Requirement 5.5); `repl_print_help()` is rewritten into labeled, consistently-aligned sections, `info config` moves next to the other `info` lines, and the `break` line grows the same `BP_KIND_TABLE`-derived event-type listing `repl_break.c`'s error message uses (Requirement 7). **Correction (post-review, task 7.2, above)**: this bullet's original text also claimed repl.c "implements the new shared jobid-range-compression helper (Requirement 4), following the file's existing shared-helper convention" — that helper, `repl_format_ts_human()`, and this task's own `repl_is_bytes_valued_resource()`/`repl_format_bytes_human()` now live in the new `repl_fmt.c` below instead, not here.
|
||||
- `src/scheduler/src/repl_rollup.c` (new, post-review — Correction above) — the Round Rollup's own fingerprint-build/pend-jobid-query/emit/flush/round-boundary-process logic (Requirements 2, 3), split out of `repl.c` to stay under the 800-line cap; shares state with `repl.c` via `repl_internal.h`, matching `repl_break.c`/`repl_info.c`/`repl_params.c`'s established split; added to `scheduler_srcs` in `src/scheduler/meson.build` immediately after `repl.c`.
|
||||
- `src/scheduler/src/repl_fmt.c` (new, post-review, task 7.2 — Correction above) — `repl_format_ts_human()` (pre-existing), the Jobid Range Compressor's `repl_fmt_jobid_range()` and its private grouping helpers (Requirement 4), and the Resource Value Formatter's `repl_is_bytes_valued_resource()`/`repl_format_bytes_human()` (Requirement 6.1, 6.2) — three groups of pure, read-only formatting helpers with zero dependency on sim/core/repl state, split out of `repl.c` to stay under the 800-line cap; shares declarations with `repl.c`/`repl_break.c`/`repl_info.c`/`repl_params.c` via `repl_internal.h` (whose existing `extern` entries for these functions are unchanged); added to both `scheduler_srcs` and `sched_sim_isolation_lib`'s source list in `src/scheduler/meson.build`, immediately after `repl.c`.
|
||||
- `src/scheduler/src/repl_info.c` — new resource-value classification/scaling helpers (byte-denominated list, `swp`'s megabyte special case, whole-number formatting) and a table/grouping rewrite of `repl_info_worker()`'s and `repl_info_resource()`'s resource-listing loops, both reading `rs->units_mode` (Requirement 6); the assigned-job listing in `repl_info_worker()` adopts the jobid-range-compression helper (Requirement 4.5).
|
||||
- `src/scheduler/src/repl_params.c` — `repl_cmd_set()` gains a `units raw|human|both` branch alongside the existing `speed`/`output`/`verify` branches, storing the selection on the new `rs->units_mode` field (Requirement 6.2, 6.3).
|
||||
- `src/scheduler/src/sim_loop.c` — the existing call site invoking `sim_print_decision()` gains a `continue`-mode gate, mirroring `repl.h`'s inline-wrapper convention (Requirements 2, 5). **Correction (post-review, task 4.2 remediation)**: this bullet's original "the existing call site" (singular) undercounted the file's actual production call sites — `sim_loop.c` has TWO direct calls to `sim_print_decision()`, `sched_sim_driver_run()`'s main decision-drain loop (this bullet's original target) AND `sim_reconcile_unaccounted_jobs()`'s reconstructed-decision report (added by the sibling scheduler-sim-decision-parity/scheduler-sim-eager-reconciliation specs, unrelated in authorship but real production code that reports DISPATCH decisions through this exact channel). Since that reconciliation path is a primary source of DISPATCH decisions surfacing in replay mode, leaving it unguarded reproduced bug-1610's own duplication there too. Both call sites now route through `sim_print_decision_gate()` — see the `sim_print_decision` Gate component's own Correction below for the updated Boundary Commitment.
|
||||
|
|
@ -150,10 +153,10 @@ See the Architecture Pattern & Boundary Map diagram above — it is the only non
|
|||
|-----------|---------------|--------|---------------|---------------------------|-----------|
|
||||
| Event Echo Gate | REPL / repl_break.c | Classify each event as routine or structural and gate the per-event echo by mode | 1.1-1.4 | `rs->mode` (P0), Round Rollup flush entry point (P0) | State |
|
||||
| Round Rollup | REPL / repl_rollup.c (post-review; see Correction, was repl.c) | Build a per-round fingerprint, print it, or extend/flush a collapsed range; expose a flush entry point callable from breakpoint/structural-event/replay-complete sites | 2.1-2.4, 3.1-3.6 | `core->jobs` query (P0), existing decision tally (P0) | State, Service |
|
||||
| Jobid Range Compressor | REPL / repl.c (shared helper) | Compress array-job identifier lists into index ranges | 4.1-4.5 | `fmt_jobid_ex` decomposition (P0) | Service |
|
||||
| Jobid Range Compressor | REPL / repl_fmt.c (shared helper; post-review, task 7.2 — was repl.c, see Correction) | Compress array-job identifier lists into index ranges | 4.1-4.5 | `fmt_jobid_ex` decomposition (P0) | Service |
|
||||
| `sim_print_decision` gate | Sim driver / sim_loop.c | Suppress the direct per-decision print when the Round Rollup will report it instead | 2.3, 5.1 | REPL mode state (P0) | State |
|
||||
| REPL Prompt Context | REPL / repl.c | Build the `readline()` prompt string from the current session and timestamp, falling back to the plain prompt before any session begins | 5.5 | `rs->session_count` (P0), `xce_core_now`/`repl_format_ts_human` (P0) | Service |
|
||||
| Resource Value Formatter | REPL / repl_info.c, repl_params.c | Classify a resource's canonical wire unit (bytes/megabytes/unitless), render it per the operator's `units_mode`, and lay out `info worker`/`info resource`'s listings as a grouped table | 6.1-6.6 | `is_bytes_valued_resource`/`format_bytes_human` (test.c) as design precedent (P0), `rs->units_mode` (P0) | Service, State |
|
||||
| Resource Value Formatter | REPL / repl_info.c, repl_params.c (consumers; the two shared pure helpers themselves live in repl_fmt.c, post-review, task 7.2 — was repl.c, see Correction) | Classify a resource's canonical wire unit (bytes/megabytes/unitless), render it per the operator's `units_mode`, and lay out `info worker`/`info resource`'s listings as a grouped table | 6.1-6.6 | `is_bytes_valued_resource`/`format_bytes_human` (test.c) as design precedent (P0), `rs->units_mode` (P0) | Service, State |
|
||||
| Help & Breakpoint Discoverability | REPL / repl.c, repl_break.c | Group and align `help`'s listing, and expose `BP_KIND_TABLE`'s full valid-event-type set to both `help` and `break`'s error message via one shared accessor | 7.1-7.6 | `BP_KIND_TABLE` (P0) | Service |
|
||||
|
||||
### REPL Output (repl.c / repl_break.c / repl_info.c / repl_params.c / sim_loop.c)
|
||||
|
|
@ -197,7 +200,7 @@ See the Architecture Pattern & Boundary Map diagram above — it is the only non
|
|||
|
||||
**Dependencies**
|
||||
- Inbound: `xce_repl_post_session_check` (repl.c) — the round-boundary call site the fingerprint/collapse logic attaches to, calling `repl_rollup.c`'s `repl_round_rollup_process()` (P0); the Event Echo Gate (`xce_repl_on_event`) and the breakpoint checks in `xce_repl_on_begin_round`/`xce_repl_on_decision` (all repl_break.c) — call the flush entry point (P0); `xce_repl_on_replay_complete` (repl.c) — calls the flush entry point before its existing banner (P0). All three inbound call sites live in a different file from this component's own implementation (post-review, task 2.2 — see Correction above) and reach it via `repl_internal.h`'s `extern` declarations.
|
||||
- Outbound: `core->jobs` iterator (P0), `repl.c`'s `repl_count_jobs()` (P0, `extern`-declared in `repl_internal.h` post-review for this cross-file call), `xce_repl_on_decision`'s existing tally fields (P0), Jobid Range Compressor (repl.c) for rendering the pend-jobid list (P0)
|
||||
- Outbound: `core->jobs` iterator (P0), `repl.c`'s `repl_count_jobs()` (P0, `extern`-declared in `repl_internal.h` post-review for this cross-file call), `xce_repl_on_decision`'s existing tally fields (P0), Jobid Range Compressor (repl_fmt.c, post-review, task 7.2 — was repl.c, see File Structure Plan Correction) for rendering the pend-jobid list (P0)
|
||||
|
||||
**Contracts**: Service [x] / API [ ] / Event [ ] / Batch [ ] / State [x]
|
||||
|
||||
|
|
@ -227,6 +230,7 @@ void repl_round_collapse_flush(xce_sched_sim_driver_t* sim);
|
|||
|-------|--------|
|
||||
| Intent | Group a list of jobids by array base and render contiguous index runs as compressed ranges |
|
||||
| Requirements | 4.1, 4.2, 4.3, 4.4, 4.5 |
|
||||
| File | `src/scheduler/src/repl_fmt.c` (post-review, task 7.2 — was `repl.c`; see the File Structure Plan Correction above for why) |
|
||||
|
||||
**Responsibilities & Constraints**
|
||||
- Pure, read-only formatting function — never mutates its input list or any scheduler/job state.
|
||||
|
|
@ -289,7 +293,7 @@ int repl_fmt_jobid_range(char* buf, size_t bufsz,
|
|||
|
||||
**Dependencies**
|
||||
- Inbound: `repl_command_loop()` (repl.c) — calls this immediately before its existing `readline(XCE_REPL_PROMPT)` line
|
||||
- Outbound: `repl_format_ts_human()` (repl.c, existing), `xce_core_now()` (core_clock.c, existing)
|
||||
- Outbound: `repl_format_ts_human()` (`repl_fmt.c` post-review, task 7.2 Correction above — originally `repl.c`), `xce_core_now()` (core_clock.c, existing)
|
||||
|
||||
**Contracts**: Service [x] / API [ ] / Event [ ] / Batch [ ] / State [ ]
|
||||
|
||||
|
|
@ -315,6 +319,7 @@ void repl_build_prompt(xce_sched_sim_driver_t* sim, char* buf, size_t bufsz);
|
|||
|-------|--------|
|
||||
| Intent | Classify a resource's canonical wire unit, render its value per the operator's selected display mode, and lay out `info worker`'s/`info resource`'s listings as a grouped table instead of a flat line-per-resource dump |
|
||||
| Requirements | 6.1, 6.2, 6.3, 6.4, 6.5, 6.6 |
|
||||
| File | The classification/scaling helpers (`repl_is_bytes_valued_resource()`/`repl_format_bytes_human()`) live in `src/scheduler/src/repl_fmt.c` (post-review, task 7.2 — see the File Structure Plan Correction above); the table-rendering call sites (`repl_info_worker()`/`repl_info_resource()`) stay in `repl_info.c`, and `set units`' parsing stays in `repl_params.c`, both unaffected by this move |
|
||||
|
||||
**Responsibilities & Constraints**
|
||||
- Classification is a small, explicit, hardcoded name list — `repl_is_bytes_valued_resource(name)` returns true for exactly `mem`, `tmp`, `maxmem`, `maxtmp`, `maxswap` (confirmed canonical-bytes on the wire: `node_information.c`'s `node_info_get_mem()`/`node_info_get_tmp()` docstrings, `xcecd.c`'s `init_host_attrs()` bug-1554 comment). This mirrors `src/controller/testsuite/test.c`'s `is_bytes_valued_resource()` exactly (same 5 names, same rationale: "a small, explicit, client-side list rather than a wire field").
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue