feat(libxce-alloc-preason-equality): sim verify uses public job_alloc_eq and logs the first difference (task 4.3)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Rongsong Shen 2026-09-28 10:58:41 +00:00
parent 69112c2d22
commit 24b057189f
Signed by untrusted user: rshen
GPG key ID: 80533536B0EB651C
4 changed files with 415 additions and 217 deletions

View file

@ -44,7 +44,7 @@ Test-first throughout (red → green → refactor). Every sub-task leaves the bu
- _Requirements: 4.1, 4.4, 4.5, 6.5, 6.6_
- _Boundary: scheduler allocation chain_
- [ ] 4. Integration: move the consumers to the public API
- [x] 4. Integration: move the consumers to the public API
- [x] 4.1 Move the three white-box equivalence tests to the public comparators
- Switch the three test files that call the simulator's private comparators to the public allocation and full-match pending-reason comparisons, printing the description in their failure messages and freeing it.
- Keep their white-box inclusion of the simulator's verification source, which they still need for the decision-level functions.
@ -60,7 +60,7 @@ Test-first throughout (red → green → refactor). Every sub-task leaves the bu
- Done when every listed fixture carries the session-start value and the scheduler suite still passes.
- _Requirements: 6.2, 6.7_
- _Depends: 3.2_
- [ ] 4.3 Migrate simulator verification to the public API and report the difference in mismatch logs
- [x] 4.3 Migrate simulator verification to the public API and report the difference in mismatch logs
- Write the tests first: add the new description argument to the verification unit test's direct decision-comparison calls; test that the description names the differing field and both values for a dispatch difference, a pending job-id difference, a pending main-reason difference, a kind difference, a missing side and an unsupported preempt; test that the mismatch log line appends a provided description; invert the "reservation start time difference still matches" test so a difference is now reported and named.
- Delete the simulator's private comparators; compare dispatch decisions with the public allocation comparison; keep a simulator-local main-reason-only pending check with the bug-1845 rationale (design.md, Components: Simulator verification).
- In the simulator's replay loop (the only code caller of the decision comparison and the mismatch log), pass the description it already computes to the mismatch log and free it, and pass a fixed "no live decision" text for recorded decisions left over; the signature changes and these callers land in this same sub-task.
@ -90,3 +90,4 @@ Test-first throughout (red → green → refactor). Every sub-task leaves the bu
- `xce-build.sh lib` runs only the `libxce test` binary; run `meson test -C src/xce.build.alloceq "libxce alloc OOM test"` (or plain `meson test`) for the allocation OOM binary, which also wraps `vasprintf`/`__vasprintf_chk` since 2.1.
- Simulation mode (`sim_loop.c`) still takes its own session-begin clock reading before `xce_core_begin_session()`; by design that is left to spec scheduler-sim-discrete-clock (3.1 fixed only the normal-mode recorder).
- 4.2 left the `from`-excluded comments at `test_sim_verify.c` ~639-681 for 4.3, which inverts the test they document.
- `sim_verify.c` builds descriptions with `vsnprintf` + `malloc`, not `vasprintf`: about 25 scheduler tests `#include "../src/sim_verify.c"` after `<stdio.h>` without `_GNU_SOURCE`. Same ownership contract as libxce.