feat(scheduler-sim-live-allocation): make capacity checks core-safe (task 1.3)

Re-types sched_meet_host_selection(), sched_check_shared_satisfy()
(+its _ helper), sched_check_host_satisfy() (+its _ helper), and the
private unsatisfy_() helper they share, from xce_scheduler_t* to
xce_sched_core_t*, in resource.c.

Fixes every call site this forces (a C signature migration cannot
keep the build green otherwise): sched_try_alloc_on_host_() (2 sites,
already partially touched by task 1.2), host_iter.c's
sched_host_iter_next() (2 sites), and parjob_allocator.c/
seqjob_allocator.c's my_alloc() (1 site each) -- each fix is a minimal
&(sched->core) argument wrap, no algorithm change, preserving
host_iter/parjob/seqjob's own allocation algorithm exactly as-is.

Adds test_core_safe_allocation_chain_driver_parity, proving all three
functions produce identical grant/deny results whether given
normal-mode-shaped or simulation-mode-shaped core state.

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-18 12:42:11 +00:00
parent e8866641a6
commit 55173fca27
No known key found for this signature in database
GPG key ID: 5BCDAAE0123E9FE2
13 changed files with 345 additions and 53 deletions

View file

@ -764,7 +764,7 @@ test_reconciled_job_charges_resinuse_before_live_capacity_check(void)
rc = xvec_idval_store(&wanted, residx, 5.0f); /* > 2.0 remaining */
TEST_ASSERT_TRUE(rc >= 0);
rc = sched_check_host_satisfy(&wrapper, w, &uncomitted, &wanted, &unmeet);
rc = sched_check_host_satisfy(&(wrapper.core), w, &uncomitted, &wanted, &unmeet);
TEST_ASSERT_EQUAL_INT_MESSAGE(
0, rc,
"a job wanting more than the 2.0-unit remaining headroom must be "
@ -782,7 +782,7 @@ test_reconciled_job_charges_resinuse_before_live_capacity_check(void)
rc = xvec_idval_store(&wanted, residx, 2.0f); /* == 2.0 remaining, exact fit */
TEST_ASSERT_TRUE(rc >= 0);
rc = sched_check_host_satisfy(&wrapper, w, &uncomitted, &wanted, &unmeet);
rc = sched_check_host_satisfy(&(wrapper.core), w, &uncomitted, &wanted, &unmeet);
TEST_ASSERT_EQUAL_INT_MESSAGE(
1, rc,
"a job wanting exactly the 2.0-unit remaining headroom must be "