myxce/.kiro/specs/worker-rejoin-resync
Rongsong Shen cfe66dde16
feat(worker-rejoin-resync): reconcile unrecognized job to pending (task 2.1)
Add record_job_reconcile_pending_fact(cluster_t*, job_t*) to job.c:
eagerly applies apply_job_update_transition(job, JOB_STAT_PEND) (real,
live mutation, not a deferred peek -- matching dispatch_a_job_'s
established pattern, not record_job_finish_fact's), releases
job->job.allocs on an applied (non-no-op) transition, then durably
appends via the generic persist_submit_job_fact(WAL_JOB_UPDATE). Caller
holds job's lock throughout and is responsible for calling
persist_notify_job_updated_already_persisted() after unlocking -- this
function deliberately does not call it itself.

Closes bug-1631 at this new call site: a RUN job with a real allocation
reconciled to PEND (Requirement 4.6, worker reports it unrecognized)
would otherwise carry a stale allocation into its next dispatch attempt,
exactly the gap bug-1631 documented as dormant until something re-admits
an already-dispatched job to the scheduler's PEND pool -- this feature
is that path. dispatch_a_job_ itself is unchanged (still correct for a
job's first-ever dispatch, the only case reachable there).

3 tests: allocs release + eager-mutation-before-unlock proof, no-op on
already-pending, and the Requirement 4.4 terminal-state-preservation
proof (rejects overwriting JOB_STAT_DONE).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y4M5MJM2zK6nU43da267Ku
2026-09-01 10:13:08 +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 docs(worker-rejoin-resync): add task 1.5, xceadmin config-build wiring 2026-09-01 09:26:15 +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 unrecognized job to pending (task 2.1) 2026-09-01 10:13:08 +00:00