feat(libxce-alloc-preason-equality): replay reproduces the reservation start time (task 5.3)

Add test_sim_replay_reproduces_recorded_alloc_from: a recorded DISPATCH at
an epoch-scale beginRound with a sub-second part replays at the default
simulation settings with no --sim-verify mismatch, and the live allocation's
from equals beginRound in whole seconds. Share the dispatch fixture setup
of the existing tests through two helpers.

Live: 2-round HA soak recordings (11 DISPATCH decisions) replayed with
--sim-verify and no --sim-speed report 0 mismatches.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Rongsong Shen 2026-09-29 06:48:38 +00:00
parent 9fae9ca22a
commit 4e57bde693
Signed by untrusted user: rshen
GPG key ID: 80533536B0EB651C
2 changed files with 166 additions and 119 deletions

View file

@ -68,7 +68,7 @@ Test-first throughout (red → green → refactor). Every sub-task leaves the bu
- _Requirements: 5.1, 5.2, 5.3, 5.4, 6.1, 6.4_
- _Depends: 2.1, 3.1, 4.1, 4.2_
- [ ] 5. Validation
- [x] 5. Validation
- [x] 5.1 Remove duplicated coverage from the verification unit tests
- Remove the dispatch allocation-level tests that only re-prove the allocation comparisons now owned by libxce; keep the pending-decision, decision-level and integration tests, the inverted reservation-start-time test from 4.3, and the description-text tests from 4.3.
- Done when the verification test file no longer duplicates libxce coverage and still passes.
@ -78,7 +78,7 @@ Test-first throughout (red → green → refactor). Every sub-task leaves the bu
- Confirm no source still names any of the five removed private comparators (the string, allocation, host-allocation, job-allocation and pending-reason ones); the decision-level comparison keeps its name.
- Done when every suite passes and the search finds no match.
- _Requirements: 5.4, 6.6, 6.7_
- [ ] 5.3 Replay reproduces the reservation start time (after spec scheduler-sim-discrete-clock)
- [x] 5.3 Replay reproduces the reservation start time (after spec scheduler-sim-discrete-clock)
- Add a test that a replayed allocation's reservation start time equals the recorded one at the default simulation settings.
- Record a session on a local deployment and replay it with verification at the default settings.
- Done when the test passes and the live replay reports zero mismatches; then mark bug-1881 fixed through the buglog skill with the fix commit.
@ -92,3 +92,4 @@ Test-first throughout (red → green → refactor). Every sub-task leaves the bu
- 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.
- 5.2: `xce-build.sh all` stops at the xceadmin live-HA e2e test (`test_live_config_push_against_primary_reaches_success_path`, versionTag 0); it uses controller binaries from the shared default build dirs, not this build. The spec needs only lib/scheduler/controller: built with `--incremental` per component, then `meson test --no-suite xceadmin` gave 116/116, 0 Unity :FAIL lines, 0 sanitizer reports.
- 5.3: `test_sim_replay_reproduces_recorded_alloc_from` (test_sim_live_allocation.c) uses an epoch-scale beginRound with a 0.75 s fraction; the older `begin_round = 2000` fixtures cannot tell a correct `from` from 0 or from sub-second drift (a +0.5 s clock mutant in sim_loop.c fails only the new test). Standalone `xce_scheduler --sim` exits 1 under ASAN from exit-time LeakSanitizer reports (snapshot decode), so live replays need `ASAN_OPTIONS=detect_leaks=0`, as the HA soak's replay gate already sets. Live proof: 2-round HA soak (/home/claude/tmp/xce-alloceq-53), 3 clean recordings, 11 recorded DISPATCH decisions, replayed with `--sim-verify` and no `--sim-speed`: 0 mismatches.