Data Model: Coordination Doctor Branch Safety
This repair introduces no persisted data. It clarifies the runtime invariants among existing Git and mission-metadata values.
Entities
Mission coordination metadata
worktree path.
coordination_branch: the declared ref that--fixis allowed to advance.target_branch: the ref whose tip is the requested fast-forward destination.mission_slugandmission_id: inputs used to resolve the recorded coordination
Coordination worktree state
path: resolved byCoordinationWorkspace.worktree_path.actual_head_ref: symbolicHEAD, or the detached sentinel.dirty: whethergit status --porcelainreports changes.
Repair finding
severity:errorwhen a mutation precondition or postcondition is unsafe.error_code: stableCOORDINATION_BRANCH_STALE_FIX_BLOCKEDfor a refused repair.message: names the concrete reason, including branch mismatch.next_step: manual inspection/recovery guidance.
Invariants
1. A repair may mutate only when actual_head_ref == refs/heads/<coordination_branch>. 2. The coordination ref must be a strict ancestor of the target ref before mutation. 3. The coordination worktree must be clean before mutation. 4. Success may be printed only after the declared coordination ref equals the target SHA. 5. A failed invariant mutates no branch and produces a structured error finding.
State Transition
stale + correct branch + clean -> coordination ref equals target.
All other states remain unchanged and become an operator-visible blocked repair.