fix(scheduler): --sim-verify false-flagged every DISPATCH decision on wall-clock drift (bug-1842)

sim_verify_alloc_eq() compared xce_alloc_t.from, which make_alloc()
(xcealloc.c) stamps with the real OS wall clock (time(NULL)), not
core.c's virtualized sim clock. The recorded (expected) value is
whatever real second the original run happened to execute in; the
freshly-rebuilt (actual) value is whatever real second the replay
executes in -- two unrelated real-world timestamps, so every
otherwise-correct DISPATCH decision failed verification whenever a
replay ran even one wall-clock second away from its own recording.

Drop `from` from the comparison -- it's reservation bookkeeping, not
part of a decision's semantic identity. Verified against a real
captured .replay file: 120/120 false DISPATCH mismatches -> 0.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Rongsong Shen 2026-09-23 03:07:47 +00:00
parent e592e92178
commit 7901db57d4
No known key found for this signature in database
GPG key ID: 5BCDAAE0123E9FE2
4 changed files with 126 additions and 8 deletions

View file

@ -713,13 +713,15 @@ test_sim_verify_no_false_mismatch_after_live_dispatch_and_later_confirmation(
* sched_make_allocs() (scheduler.c) always defaults every entry's
* duration to -1 today.
* `from` (wall-clock time(NULL), set unconditionally by make_alloc()
* itself) is NOT independently reproduced here -- it is expected to
* agree with the live path's own call by virtue of both happening
* within the same sub-second test execution window, not by
* construction; this is a real, if practically negligible, source of
* flakiness inherent to comparing a genuinely-live-dispatched
* decision's wall-clock-stamped fields via --sim-verify, orthogonal
* to anything bug-1838 changed. */
* itself) is left at whatever value make_alloc() happens to stamp it
* with here -- it no longer needs to agree with the live path's own
* call. bug-1838-followup removed `from` from sim_verify_alloc_eq()'s
* comparison entirely (sim_verify.c): it is a real-wall-clock
* reservation-start stamp, not part of a decision's semantic identity,
* and comparing it made --sim-verify false-flag every genuine
* live-dispatched decision replayed more than a wall-clock second away
* from its own recording. What used to be accepted same-second-window
* flakiness here is now a non-issue by construction. */
{
xce_alloc_t* a = make_alloc((char*)"slots", NULL, 1, 1.0,
-1);