test(scheduler-sim-live-allocation): prove replay-driven limit visibility (task 5.2, closes bug-1826)
Adds the feature's concrete original acceptance test: a genuine capnp-encoded .replay (real ReplayHeader/SnapshotEntry/Conf4Sched with one global and one host-scoped limit), driven end-to-end through the real, unmodified sched_sim_driver_run(). The dispatched job's usage registers against both limits via limit_get_configured_limits()/ limit_get_usage_instances() -- the same accessors info limit reads -- proving real, non-zero usage where today's REPL previously showed none. RED-phase evidence: reverting task 4.3's 4 files to their pre-fix commit reproduces the exact predicted failure (host-scoped usage missing, global usage intact); restoring to HEAD reproduces GREEN. Closes bug-1826 (the bug this whole feature was built to fix) -- buglog entry updated from NOT FIXED to FULLY FIXED, citing this test. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RLSNJhNoULvVcUhXEFafQC
This commit is contained in:
parent
ab88848f91
commit
a70c7a2c61
4 changed files with 5006 additions and 2198 deletions
|
|
@ -101,7 +101,7 @@
|
|||
- _Depends: 4.1_
|
||||
- _Requirements: 3.1, 3.2_
|
||||
|
||||
- [ ] 5.2 Prove the concrete acceptance test: real global and host-scoped limit usage visible against a real replay
|
||||
- [x] 5.2 Prove the concrete acceptance test: real global and host-scoped limit usage visible against a real replay
|
||||
- Drive a real simulation session through a replay whose original live session had both a global and a host-scoped limit actively enforced
|
||||
- Observable: the existing limit-inspection command displays real, non-zero usage for both limits against this replay, where today it reports no active usage instance for either
|
||||
- _Depends: 4.1, 4.2, 4.3_
|
||||
|
|
@ -130,3 +130,4 @@
|
|||
- **Task 1.3**: grep for ALL call sites of a function before migrating it, not just the ones named in the task brief — `host_iter.c`'s `sched_host_iter_next()` and `parjob_allocator.c`/`seqjob_allocator.c`'s `my_alloc()` all call the capacity-check functions directly, not only via `sched_try_alloc_on_host_()`. A private `static` helper with no other callers besides the functions being migrated should be migrated alongside them (leaving it stale forces an ugly cast, which this codebase's own design explicitly forbids in shared code).
|
||||
- **Task 1.2**: retyping a widely-called function's signature (e.g. `plugin_job_election`, `plugin_prepare_allocation`, `plugin_commit_decision`) breaks ALL of its call sites as hard compile errors in one step (this toolchain treats `-Wincompatible-pointer-types` as an error, not a warning) — there is no way to migrate a signature and keep the build green without touching every call site in the same commit, even when those call sites live in files nominally owned by a later task. The correct scope is the *minimal* fix (wrap the existing argument, e.g. `sched` → `&(sched->core)`; touch nothing else in that function), not a rewrite of the caller. Also: design.md's Implementation Notes said `plugin_prepare_allocation()` has "one normal-mode call site" — it actually has two (`resource.c`'s `sched_try_alloc_on_host_()` and `schedobj.c`'s `sched_ctx_set_primary()`). Grep for ALL call sites before assuming a design doc's count is exhaustive.
|
||||
- **Task 5.1**: the pre-existing `test_sim_contention_parity.c` fixture could not be reused because it drives reconciliation only (its own white-box stubs hard-code the old always-PEND behavior), so proving live-path contention parity required two new fixtures spawning the real `sched_job_picker()`/`sched_allocator()` pair directly against bare normal-mode and sim-mode core state. Confirmed as a genuine, requirement-consistent scope boundary (not a silent narrowing): `build_limit_vres_requests()`/`get_vres_value()` (`plugins/limit.c`) are `#if 0`'d dead code with zero live callers — no limit, in either mode, currently gates/denies admission anywhere in this codebase, only tracks/displays usage. Any future task attempting real limit-based admission denial must first un-stub these two functions; that is out of boundary for this feature.
|
||||
- **Task 5.2**: this is the feature's concrete bug-1826 acceptance test, and it deliberately goes one level higher-fidelity than every prior task's fixtures — a real capnp-encoded `.replay` (genuine `ReplayHeader`/`SnapshotEntry`/`Conf4Sched`, real generated `encode_Conf4Sched()`) driven through the real, unmodified `sched_sim_driver_run()` entry point, not a bare-`&(sim->core)` shortcut. `repl_info_limit()`/`repl_dispatch()` (the literal functions behind the `info limit` CLI command) are both `static` and unreachable from a real-`scheduler_srcs`-linked test binary, so the test reads `limit_get_configured_limits()`/`limit_get_usage_instances()` directly — confirmed (by tracing `repl_print_limit_usage()`'s own body) to be the exact same accessors `info limit` itself calls, not a weaker substitute. RED-phase evidence for a task this late in a long dependency chain doesn't need a full feature revert: a targeted revert of just task 4.3's 4 files (the specific commit that closed the host-scoped-limit fan-out gap this test's host-scoped half exercises) reproduced the predicted failure exactly (global limit's usage still populated, host-scoped usage instance missing), then a restore-to-HEAD reproduced GREEN — this is sufficient, targeted regression-detection proof without needing to unwind 8+ interdependent commits. Also closed bug-1826 itself (the bug this whole feature exists to fix) — updated its buglog entry from "NOT FIXED" to "FULLY FIXED," citing this test.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue