docs(scheduler-sim-diagnostics): add task 6, sim-mode limit plugin bootstrap (bug-1825)

Records the investigation and precise design before implementation: the
snapshot format already carries the original limit config (sim->core.config,
borrowed reference set by xce_sched_core_load_snapshot()), so the fix is
registration + a direct config_hook seed, mirroring sim_bootstrap_picker()'s
existing pattern exactly -- not a recording/replay format change. Also
documents the separate, deliberately out-of-scope finding that limit
*matching* during replay needs a further, larger fix (plugin_job_election()
is normal-mode-only today).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RLSNJhNoULvVcUhXEFafQC
This commit is contained in:
Rongsong Shen 2026-09-18 02:42:18 +00:00
parent 77924f787e
commit 2f1ffd1e4a
No known key found for this signature in database
GPG key ID: 5BCDAAE0123E9FE2

View file

@ -8,6 +8,15 @@
- _Requirements: 1.1, 1.2, 1.4, 2.1, 3.1_
- _Boundary: Limit Plugin Accessor_
- [ ] 6. Bootstrap the limit plugin in sim mode so `info limit` shows real data against a replay (fixes `bug-1825`)
- Extract `limit_new_plugin()` factory out of `register_limit()` (`plugins/limit.c`), mirroring `builtin_fcfs_new_plugin()`/`register_builtin_fcfs()`'s existing factory-extraction pattern exactly; `register_limit()` itself must be behaviorally unchanged (pure refactor)
- New `sim_bootstrap_limit_plugin(xce_sched_sim_driver_t* sim)` (new file `sim_limit.c`, mirroring `sim_picker.c`'s structure/header-comment convention): `limit_new_plugin()` → `plugin_register_core(&(sim->core), plugin)` → if `sim->core.config != NULL`, call `plugin->hooks.config_hook(plugin, sim->core.config)` directly (NOT the type-unsafe `plugin_config_update()`, which casts its `void*` arg to `xce_scheduler_t*` and would misread `xce_sched_sim_driver_t`'s embedded `core` field)
- Wire the call into `sim_loop.c` right alongside the existing `sim_bootstrap_picker(sim)` call site — by that point `sim->core.config` already holds the snapshot's borrowed-reference config (set during `sched_sim_driver_start()`'s snapshot load, which runs first)
- Observable: a real `xce_sched_sim_driver_t` driven through `sched_sim_driver_start()` against a replay whose snapshot carries a real `xce_limit_config_t`, after the sim driver's own bootstrap sequence runs, has `limit_get_configured_limits()` return a handle that iterates to that real limit — no test-only registration helper needed
- _Requirements: 1.1–1.7 (makes them exercisable against a real replay, not just via a test-only fixture helper)_
- _Boundary: Limit Plugin Accessor (factory extraction), new Sim Limit Bootstrap component_
- **Known deliberate non-goal, tracked separately**: this task does NOT wire limit *matching* (`limit_job_election()`) into the sim/replay decision path — that function is only ever reached via `plugin_job_election()`, which is normal-mode-only (one caller, `scheduler.c`) and itself needs a core-safe variant before it could be called from `sim_loop.c`. Live usage (Requirements 2.x/3.x) will still show "no active usage instance yet" against a real replay even after this task — only the configured-setting display (1.1-1.7) becomes real. Tracked as a separate follow-up bug, not bundled into this task.
- [x] 2. Core: Limit lookup and configured-setting display
- [x] 2.1 Implement name/all resolution with correct absence messaging
- New white-box test file `test_repl_limit_table.c` created (sibling of `test_repl_resource_table.c`, own `#include` set covering `plugins/limit.c` and `resource.c` for real — not stubbed — per `design.md`'s build-wiring risk note citing bug-1762's precedent)