myxce/.kiro/specs/worker-rejoin-resync
Rongsong Shen ecfb4c942f
feat(worker-rejoin-resync): reconcile unqueried job assignment (task 2.2)
Add record_job_reconcile_assign_fact(cluster_t*, job_t*, worker_t*,
xce_job_state_entry_t*) to job.c: eagerly sets job->job.state to match
the worker's reported outcome (mirroring dispatch_a_job_'s inline
mutation, minus allocation fields -- there are none to set, job->job.allocs
stays NULL per Requirement 4.8's documented scope). Calls the existing
persist_submit_job_dispatch_fact(..., alloc=NULL) directly, then leaves
the post-unlock persist_notify_job_updated_already_persisted() call to
the caller, same convention as task 2.1.

Fixes bug-1746 along the way: capnp_encode_joballoc() (persist.c, part
of bug-1678's original fix, predates this feature) unconditionally
dereferenced a NULL alloc -- never triggered before since
dispatch_a_job_ (the only prior caller) always passes non-NULL. Fixed
with a minimal guard producing a true zero-length buffer, matching
apply_committed_entry's alloc_len > 0 decode gate exactly. This
directly contradicted design.md's "tested, backward-compatible on both
seams" claim (true only for decode, never actually exercised for
encode) -- corrected in 4 places.

2 tests: applies-running-no-allocs-and-notifies, and a real restart-
replay round trip (write to real disk, fresh persist_recover(), confirm
jobid/host/state/NULL-allocs survive) -- proving this task's own
"durably survives a restart replay" completion criterion literally, not
just the in-memory mutation.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y4M5MJM2zK6nU43da267Ku
2026-09-01 11:40:47 +00:00
..
brief.md docs(kiro): reconcile spec metadata, promote 3 new specs, fix template path 2026-08-16 11:02:06 +00:00
design.md feat(worker-rejoin-resync): reconcile unqueried job assignment (task 2.2) 2026-09-01 11:40:47 +00:00
requirements.md docs(worker-rejoin-resync): add requirements, design, and research docs 2026-09-01 07:08:41 +00:00
research.md docs(worker-rejoin-resync): add requirements, design, and research docs 2026-09-01 07:08:41 +00:00
spec.json docs(worker-rejoin-resync): fix design review findings; add tasks.md 2026-09-01 08:03:10 +00:00
tasks.md feat(worker-rejoin-resync): reconcile unqueried job assignment (task 2.2) 2026-09-01 11:40:47 +00:00