feat(scheduler-sim-decision-parity): wire reconciliation into the round boundary (task 3)

This is the integration point that makes the whole feature real
end-to-end. Calls sim_reconcile_unaccounted_jobs() (tasks 2.2-2.4) at
exactly the position design.md's mermaid diagram requires: after
xce_core_begin_session()'s reset, strictly before sched_account_jobs()
(so the same round's re-charge picks up every newly-reconstructed job,
Req 1.3/1.4) and before xce_core_signal_go() unblocks the live picker (so
still-pending jobs' capacity checks this round see correct resInUse, Req
2.1/2.2). decoded_session and record_ctx are the same per-round locals
sched_sim_driver_run() already declares -- no new plumbing.

sim_verify.c needs zero changes: reconciliation consumes/compacts
decoded_session->decisions before the verify drain loop runs each round,
which is what keeps the existing positional comparison correct (Req 5.2)
-- confirmed by extending test_sim_verify.c with a no-false-mismatch test
against a recording containing already-resolved jobs.

New end-to-end test proves the ordering matters for real: a reconciled
job's resInUse is charged before a live sched_check_host_satisfy() call
for a different job in the same round correctly denies it (5.0 wanted vs
2.0 remaining) and grants an exact-fit request (2.0) -- using the real
scheduler.c/resource.c accounting and capacity-check code, not stubs.

Found and fixed a test-authoring bug (get_resvals() returns nres on
success, not 0) during GREEN verification -- logged as bug-1622, a test
bug, not production.

47/48 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 10:00:06 +00:00
parent 75edb7a329
commit 1264409478
No known key found for this signature in database
GPG key ID: 5BCDAAE0123E9FE2
5 changed files with 947 additions and 11 deletions

View file

@ -792,6 +792,24 @@ sched_sim_resource_contention_test = executable(
dependencies: [scheduler_test_deps],
install: false)
# End-to-end integration proof for task 3 (Req 1.3/1.4, 2.1/2.2, 5.2): wires
# Recorded-Decision Reconciliation (tasks 2.2-2.4) into sim_loop.c's real
# round-boundary sequence, before sched_account_jobs()/xce_core_signal_go().
# Unlike every other sim_loop.c-including file in this directory, this one
# links a REAL (not no-op) sched_account_jobs() reimplementation (copied
# verbatim from scheduler.c) plus resource.c, so it can prove the actual
# resInUse/capacity-check outcome of the wired call site against the real,
# unmodified sched_sim_driver_run() -- not just that reconciliation runs in
# isolation (test_sim_reconcile_unaccounted.c) or that sched_account_jobs()
# is called at the right point (test_sim_session_ordering.c, via a spy).
# See this file's own header comment for the full scenario and rationale.
sched_sim_round_boundary_reconciliation_test = executable(
'sched_sim_round_boundary_reconciliation_test',
['test_sim_round_boundary_reconciliation.c'],
include_directories:[incdir],
dependencies: [scheduler_test_deps],
install: false)
# Contract test for the interactive simulation REPL's execution-control slice
# (scheduler-core spec, task 12.1, Req 5 AC 22): starting simulation with
# --interactive pauses before any event is processed, and a `step N` command
@ -1125,6 +1143,9 @@ test('scheduler sim reconcile unaccounted test',
test('scheduler sim resource contention test',
sched_sim_resource_contention_test, suite: 'scheduler',
env: ['ASAN_OPTIONS=detect_leaks=0'])
test('scheduler sim round boundary reconciliation test',
sched_sim_round_boundary_reconciliation_test, suite: 'scheduler',
env: ['ASAN_OPTIONS=detect_leaks=0'])
test('scheduler repl execution control test',
sched_repl_execution_control_test, suite: 'scheduler',
env: ['ASAN_OPTIONS=detect_leaks=0'])