myxce/.kiro/specs/scheduler-dispatch-commit
Rongsong Shen 8a4266ada4
feat(scheduler-dispatch-commit): controller resolves terminal dispatch failures to EXIT (task 3.2)
The two terminal-classified failure sites in dispatch_a_job_() (invalid
allocation, queue-exec-info lookup failure) now actually resolve the job
instead of leaving it stuck at PEND forever with a dangling reference to
nowhere. Each site: lock(j, RTTI_LOCK_WRITE) -> genuinely calls
xce_classify_dispatch_fail(site) and branches on the result (not a
hardcoded assumption) -> mark_job_fail() under the lock (stage=0 routes
apply_job_fail_transition() to JOB_STAT_EXIT) -> unlock(j) -> the existing
dereference(j) (kept exactly where it was, not duplicated) -> the existing
return code, unchanged. No notify_dispatch() added -- mark_job_fail()'s
own hook chain is the sole notification for a terminal outcome per
design.md; handle_jobdispatch()'s still-unconditional notify_dispatch()
call is untouched (task 4.1's job).

New test_dispatch_fail_terminal.c proves both sites resolve to
JOB_STAT_EXIT with allocs left NULL, using a canary-reference technique
to prove no reference over-release (job_t's real refcount has no test
accessor). Independently reviewed and approved; applied the reviewer's
one non-blocking fast-follow (arm the canary before the call under test,
not after, so it's an independent proof rather than relying on other
assertions to crash first) and re-verified with a clean incremental build.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Cxa1PmqAB5PyXfJaNvj8TN
2026-08-23 16:36:39 +00:00
..
design.md feat(scheduler-dispatch-commit): add durable WAL_JOB_DISPATCH fact type (task 1.2) 2026-08-23 07:12:50 +00:00
requirements.md feat(scheduler-dispatch-commit): add controller dispatch-failure classification (task 1.1) 2026-08-23 06:36:51 +00:00
research.md feat(scheduler-dispatch-commit): add controller dispatch-failure classification (task 1.1) 2026-08-23 06:36:51 +00:00
spec.json feat(scheduler-dispatch-commit): add controller dispatch-failure classification (task 1.1) 2026-08-23 06:36:51 +00:00
tasks.md feat(scheduler-dispatch-commit): controller resolves terminal dispatch failures to EXIT (task 3.2) 2026-08-23 16:36:39 +00:00