feat(scheduler-sim-live-allocation): make capacity checks core-safe (task 1.3)
Re-types sched_meet_host_selection(), sched_check_shared_satisfy() (+its _ helper), sched_check_host_satisfy() (+its _ helper), and the private unsatisfy_() helper they share, from xce_scheduler_t* to xce_sched_core_t*, in resource.c. Fixes every call site this forces (a C signature migration cannot keep the build green otherwise): sched_try_alloc_on_host_() (2 sites, already partially touched by task 1.2), host_iter.c's sched_host_iter_next() (2 sites), and parjob_allocator.c/ seqjob_allocator.c's my_alloc() (1 site each) -- each fix is a minimal &(sched->core) argument wrap, no algorithm change, preserving host_iter/parjob/seqjob's own allocation algorithm exactly as-is. Adds test_core_safe_allocation_chain_driver_parity, proving all three functions produce identical grant/deny results whether given normal-mode-shaped or simulation-mode-shaped core state. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RLSNJhNoULvVcUhXEFafQC
This commit is contained in:
parent
e8866641a6
commit
55173fca27
13 changed files with 345 additions and 53 deletions
|
|
@ -17,7 +17,7 @@
|
|||
- _Requirements: 1.1, 2.1, 2.2, 5.1_
|
||||
- _Boundary: Plugin Hook Dispatchers_
|
||||
|
||||
- [ ] 1.3 (P) Make the per-host and shared capacity checks driver-agnostic
|
||||
- [x] 1.3 (P) Make the per-host and shared capacity checks driver-agnostic
|
||||
- Re-type the host-selection match, shared-capacity check, and per-host capacity check functions to operate on shared core state directly instead of a normal-mode-only driver struct
|
||||
- TDD: re-run their existing unit tests unchanged (pure signature migration) plus a new test calling each function with core state drawn from a simulation-mode-shaped container, confirming identical results to the normal-mode-shaped case
|
||||
- Observable: these three functions compile and pass identically regardless of which driver's core state they're given
|
||||
|
|
@ -114,4 +114,5 @@
|
|||
## Implementation Notes
|
||||
|
||||
- **Task 1.1**: initial submission implemented before tests were written (TDD-mandate violation, caught in review round 1) — the real RED phase must be captured by reverting production files to HEAD via a saved patch + `git checkout --`, rebuilding to see the genuine failure, then reapplying. Retroactively-written tests plus a passing GREEN build alone do not satisfy this project's TDD discipline; the reviewer independently re-derives RED by reverting your changes, so skipping this is always caught.
|
||||
- **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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue