Phase 1 Data Model: Single Mission-Surface Resolver

This mission is a behavioral consolidation; the "model" is the resolution contract, the topology states, and the typed-error vocabulary — single-sourced on the canonical resolver.

Topology states (the selection input)

StateConditionCanonical resolution
no-coordmission has no coordination_branchprimary checkout is authoritative (create→first-write window included)
coord-freshcoord branch declared, worktree materialized + populatedcoord surface authoritative
coord-behindcoord exists but primary is ahead/divergedper the canonical cascade (coord preferred unless empty)
coord-emptycoord worktree materialized but no status surface yetHARD-FAIL STATUS_READ_PATH_NOT_FOUND (FR-006) — message: collapse OR recreate/populate
coord-deletedcoordination_branch set but branch goneCoordinationBranchDeleted (#1848)

Value concepts

  • Mission handlemission_id (ULID) / mid8 (8-char) / mission_slug; resolved by the single canonical handle resolver (no silent first-match — FR-008).
  • Mission-surface directory — the resolved kitty-specs/<slug>[-mid8]/ (primary) or .worktrees/<slug>-coord/kitty-specs/<slug>/ (coord).
  • Composition grammar_compose_mission_dir (the single <slug>[-mid8] composer, T5); compose_meta_json_path and the unified primary_feature_dir_for_mission (FR-009) route through it.

The canonical resolver contract (single source)

FunctionModuleRole
resolve_status_surface_with_anchorcoordination/surface_resolver.pythe selection authority (topology → dir or typed error)
primary_feature_dir_for_missionmissions/_read_path_resolver.py (unified)topology-blind-by-design primary read (mid8-composing)
shared resolve-dir-or-typed-error delegator (T4)(extracted)the one wrapper both aggregate and mission_runtime/resolution re-point to

Typed errors (must survive caller flattening — FR-005)

ErrorRaised whenMust NOT flatten to
STATUS_READ_PATH_NOT_FOUNDcoord-empty / surface missingMISSION_NOT_FOUND
MISSION_AMBIGUOUS_SELECTORambiguous mid8 handleMISSION_NOT_FOUND
CoordinationBranchDeletedcoord branch gone(subclass of the above; preserved)

Validation rules

  • VR-1 (FR-001): no mission-surface read composes repo_root/KITTY_SPECS_DIR/<slug> itself; all route the canonical resolver or a blessed delegator.
  • VR-2 (FR-002): for the same (slug, mid8, topology), all entry points return identical dir OR identical typed error.
  • VR-3 (FR-006): coord-empty → hard-fail with the two-path message; no silent primary fallback.
  • VR-4 (FR-008): ambiguous mid8 → MISSION_AMBIGUOUS_SELECTOR, never silent first-match.
  • VR-5 (FR-009): exactly one primary_feature_dir_for_mission definition, mid8-composing.
  • VR-6 (FR-005): typed errors preserved through next/mission_runtime.

Equivalence matrix (FR-002 / NFR-003 — the deletion gate)

Rows = topology states above × handle classes {bare-slug, <slug>-<mid8>, ambiguous-mid8}. Each cell: every resolution entry point MUST agree on the dir or the typed error. A disagreement in any cell blocks deletion of the corresponding duplicate (C-004).