test(scheduler-sim-decision-parity): add resource-contention replay fixture (task 1.2)

Adds a dual-use .replay fixture (3 jobs competing for insufficient worker
capacity) that later tasks need to prove capacity-aware parity under
contention: a real recorded normal-mode session (built by driving the
genuine sched_check_host_satisfy()/sched_commit_job_alloc() capacity/
accounting chain, not mocked) that is also directly replayable through the
real simulation driver. Two tests: fixture shape (job B genuinely denied
while A+C hold the full 10.0-unit capacity, verified against the decoded
recorded decision stream) and sim-driver replayability.

RED-phase proven: raising WORKER_CAPACITY to eliminate contention makes the
shape assertion fail as expected before reverting to the genuine-contention
value. 44/45 scheduler tests pass; the 1 failure is pre-existing bug-1560
(unrelated).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Rongsong Shen 2026-08-22 06:37:04 +00:00
parent 3106c82ed0
commit f11f0df3bd
No known key found for this signature in database
GPG key ID: 5BCDAAE0123E9FE2
3 changed files with 913 additions and 1 deletions

View file

@ -9,7 +9,7 @@
- _Requirements: 1.1, 1.2, 1.3, 1.4, 2.1, 2.2, 5.3_
- _Boundary: Core-Level Resource Accounting_
- [ ] 1.2 (P) Build a resource-contention replay fixture for testing
- [x] 1.2 (P) Build a resource-contention replay fixture for testing
- Create a recorded-session test fixture with multiple jobs competing for capacity insufficient to run all of them at once (existing fixtures only ever have enough capacity for every job, which cannot exercise or prove capacity-check correctness)
- Fixture must be usable both as a normal-mode recording source and as a simulation-mode replay input, so the same scenario can be run through both drivers and compared
- Observable completion: a scheduling round exists in the fixture where at least one job is denied capacity that a currently-running job is consuming
@ -86,3 +86,6 @@
- _Requirements: 1.1, 1.2, 1.3, 3.1, 3.2, 3.3_
- _Depends: 4.1, 4.2_
- _Boundary: Scheduler test suite_
## Implementation Notes
- (task 1.2) Whole-scenario white-box test files in `src/scheduler/testsuite/` (fixture construction + real driver/allocator plumbing) routinely exceed the project's 800-line guidance (`test_sim_verify.c` is 934 lines, uncorrected; the new `test_sim_resource_contention.c` is 883) — the steering's "don't use as precedent" caveat names only non-test files, so this is an accepted pattern for this class of test, not a defect to fix per task. Tasks 4.1-4.3 will likely add similarly-sized files; don't flag file size alone as blocking for them.