feat(scheduler-sim-live-allocation): make allocation dispatch and decision commit core-safe (task 2.2)

Retypes sched_make_allocation()/sched_make_primary_allocation()/
sched_make_compound_allocation()/sched_make_alter_allocation()/
sched_commit_decision(), plus 3 private helpers found necessary
during migration (sched_make_primary_alloc_(), sched_make_seqjob_
allocation(), sched_make_parjob_allocation()) from xce_scheduler_t*
to xce_sched_core_t* in scheduler.c.

Wires the one genuine normal-mode-only touch point -- the
unsatisfiable-resreq cache, inside sched_make_primary_alloc_() --
through the task-1.1 NULL-safe callback seam (core->unsatisfiable_
lookup_cb/populate_cb) instead of a direct field read. No other
normal-mode-only state was found in any of the 8 migrated functions,
independently confirmed by both the implementer and reviewer against
xce_scheduler_t's own field list -- no escalation needed.

Minimal &(sched->core) call-site wraps applied inside sched_allocator()/
commit_decision() (task 3.1's home, not yet migrated), matching the
pattern established in tasks 1.2/1.3/2.1.

TDD: two-part RED -- a compile-error RED from the sched_commit_decision
retype, and a behavioral RED using spy callbacks proving the cache
seam was genuinely unconsulted before this fix.

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 14:53:59 +00:00
parent d52c78e4be
commit ecdea8bf55
No known key found for this signature in database
GPG key ID: 5BCDAAE0123E9FE2
6 changed files with 213 additions and 51 deletions

View file

@ -326,7 +326,15 @@ extern void sched_end_session(xce_scheduler_t*);
extern int sched_update_existing_queue(xce_scheduler_t*, xce_queue_t*);
extern int sched_update_existing_job(xce_scheduler_t*, xce_job_t*);
extern int sched_apply_job_rusage(xce_scheduler_t*, xce_job_rusages_t*);
extern int sched_commit_decision(xce_scheduler_t*, xce_decision_t*);
/* scheduler-sim-live-allocation spec, task 2.2 (Core-Safe Allocation
* Chain): sched_commit_decision() is now core-typed (xce_sched_core_t*),
* not xce_scheduler_t* -- it, plugin_commit_decision(), sched_get_job()
* and sched_commit_job_alloc() (the latter two already relocated to
* core.h) are all core-safe now, so the whole DISPATCH-commit path is
* callable from either driver. Its sole production caller,
* commit_decision() (scheduler.c, static), wraps its own still-
* xce_scheduler_t*-typed argument as &(sched->core) at the call site. */
extern int sched_commit_decision(xce_sched_core_t*, xce_decision_t*);
extern int sched_publish_pend_reason(xce_scheduler_t*, xce_preason_set_t*);
extern int sched_publish_dispatch(xce_scheduler_t*, xce_job_dispatch_t*);
/* bug-1760: exposed (was `static sched_publish_check_rejoin`) so