feat(scheduler-sim-live-allocation): narrow reconciliation to the timing-gap safety net (task 4.2)

Adds a plugin_job_election(&(sim->core), job) call to
sim_reconcile_unaccounted_jobs()'s FOUND branch, before the existing
alloc-reconstruction/state-transition code, so a job whose outcome
comes from the recording still gets its global-limit usage registered
-- the same core-safe dispatcher the live path (task 4.1) already
uses, not a separate mechanism.

The existing job->accounts != NULL trigger guard needs no change: it
already excludes any job the live path has already decided, so this
call is naturally idempotent (match_job_global_limit_'s own
obj->configver guard makes a redundant call a safe no-op) -- narrowing
this function to a genuine timing-gap safety net rather than the
general-case decision source it used to be, per design's Live/Recorded
Authority Rule.

Host-scoped limit matching is deliberately not attempted here (needs a
resolved worker context this function doesn't independently
construct) -- that gap is tracked separately as task 4.3.

TDD: new tests prove a reconciled job's global limit is genuinely
registered via the real limit_get_usage_instances() accessor, and that
a job the live path already decided is never reprocessed.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RLSNJhNoULvVcUhXEFafQC
This commit is contained in:
Rongsong Shen 2026-09-19 05:57:55 +00:00
parent 08df64930b
commit 915782fc66
No known key found for this signature in database
GPG key ID: 5BCDAAE0123E9FE2
4 changed files with 329 additions and 63 deletions

View file

@ -256,6 +256,24 @@ int sched_fill_limit_requests(xce_sched_alloc_req_t* alloc_req,
return 0;
}
/* Task 4.2 (scheduler-sim-live-allocation spec): sim_reconcile_unaccounted_
* jobs() (sim_loop.c, white-box #included above) now also calls
* plugin_job_election() (plugin.c, not part of this TU -- this file does
* not include plugin.c) for a job it reconstructs from the recording, so a
* genuine reconciliation round in this file's own fixtures now reaches it
* for the first time -- link-satisfying stub only, same rationale as
* sched_fill_limit_requests() above. A no-op is also the behaviorally
* correct answer here: this file's own fixtures test round-boundary
* ordering (the plugin_begin_session()/plugin_end_session() spies below),
* never limit-matching, and no test here inspects any effect
* plugin_job_election() would have. */
int plugin_job_election(xce_sched_core_t* core, xce_sched_job_t* job)
{
(void)core;
(void)job;
return 0;
}
/* xce_sched_driver_on_decision()'s (driver.c) publish-side linker
* dependencies -- never actually invoked (this test never registers a
* decision callback). Same rationale test_sim_equivalence.c's own copy