--- id: "bug-1800" status: "fixed" status_updated: "2026-09-24" status_note: "" component: "scheduler" severity: "unknown" timestamp: "2026-09-11T07:55:00Z" last_seen: "2026-09-19T09:00:00Z" occurrences: 1 files: ["src/scheduler/src/repl_info.c"] tags: ["scheduler", "repl", "info-worker", "info-resource", "resource-accounting", "units-mode", "bytes-human-format", "mem", "swp", "tmp", "consumable", "display-feature", "user-requested", "tdd"] related: ["bug-1727", "bug-1601", "bug-1613"] legacy: true gitea_issue: 269 gitea_synced_status: "fixed" --- # bug-1800: User request (live replay session, worker pc13v): `info worker`'s CONSUMABLE value=/used= line for… ## Description User request (live replay session, worker pc13v): `info worker`'s CONSUMABLE value=/used= line for a bytes-valued resource (mem/swp/tmp) printed raw byte counts with no unit scaling -- e.g. `resource mem: value=20684476416.00 used=87960930222080.00` -- unlike every OTHER bytes-valued field in the same listing (maxmem/maxswap/maxtmp already render `value=33182072832.000000 (30.90 GB)`, and mem/tmp/swp themselves render human-scaled via the Load Metrics path when NOT flagged consumable). bug-1727's own header comment had explicitly scoped this out: 'no bytes-valued CONSUMABLE resource is exercised anywhere in this codebase's tests today.' ## Environment _Not recorded (migrated from buglog.json)._ ## Reproduction _Not recorded (migrated from buglog.json)._ ## Root cause repl_info_worker_one()'s and repl_info_resource_one()'s CONSUMABLE Value_u_fvalue branches both hardcoded `%.2f`/`%.2f` for value=/used=, deliberately bypassing repl_format_numeric_resource_value()'s existing units_mode-aware/repl_is_bytes_valued_resource()-gated formatting that every other numeric field in this listing already goes through -- correct for a non-bytes-valued consumable (slots, licenses) but wrong for mem/tmp/swp, which are bytes-valued CONSUMABLE resources in live practice even though no test exercised that combination before this session. ## Fix FIXED (2026-09-11). Added a new shared static helper repl_format_consumable_value_and_used() (repl_info.c, right after repl_format_numeric_resource_value()) that routes value=/used= through the existing repl_format_numeric_resource_value() formatter (units_mode-aware, plus the swp MB->bytes special case) when repl_is_bytes_valued_resource(rname) or rname=="swp" is true, and keeps the exact pre-existing "%.2f"/"%.2f" formatting otherwise (slots/licenses unaffected). Wired into both repl_info_worker_one()'s per-host CONSUMABLE case and repl_info_resource_one()'s GLOBAL/SHARED CONSUMABLE case, which share the fix via this one helper so they can't disagree. Updated the stale doc comments at repl_info.c's Resource Value Formatter section header and both call sites (previously asserted this pair was 'NOT units_mode-aware' and that no bytes-valued CONSUMABLE resource existed in tests -- no longer true). TDD: added 4 new tests to test_repl_resource_table.c (test_info_worker_units_mode_both_renders_raw_and_human_for_consumable_bytes_resource, test_info_worker_units_mode_raw_renders_bare_values_for_consumable_bytes_resource, test_info_worker_units_mode_converts_swp_megabytes_for_consumable_resource, test_info_resource_units_mode_both_renders_raw_and_human_for_consumable_bytes_resource) covering both/raw modes, the swp MB special case, and the info-resource twin. RED confirmed first (4 new failures, 76 pre-existing tests still green, `xce-build.sh scheduler asan xce.build --incremental`); GREEN confirmed after the fix (77/77 Ok, zero regressions). All existing pinned CONSUMABLE value=/used= tests (bug-1601/1613/1727, using "slots"/"licenses"/"gpu_licenses") were verified to use non-bytes-valued resource names before the fix, so they were unaffected by construction, not just by accident. ## Verification _Not recorded (migrated from buglog.json)._ ## References - Related: bug-1727, bug-1601, bug-1613 - Gitea: #269