Data model — upgrade-project-global-state-01M44538

StateSurface (existing, extended)

FieldTypeChangeNotes
primary_ownedbool (default False)newTrue only when the surface is fully generated by Spec Kitty, carries a "do not edit" marking, is tracked, and is written only by the repository root checkout's upgrade or init. Present in to_dict().

Invariants:

  • primary_owned ⇒ git_class == TRACKED and root == PROJECT. A unit test asserts this.
  • Initially exactly one surface is primary-owned: project_metadata (.kittify/metadata.yaml).
  • is_primary_owned_path(rel) matches only an exact, normalised POSIX path relative to the repository root. It never matches by basename.

Integrating worktree (derived, not stored)

is_integrating = branch is None or parse_mission_slug_from_branch(branch) is not None. The branch comes from get_current_branch(worktree).

Integration merge site → resolution side

SiteCodeSide for a primary-owned conflict
Stale-lane checklanes/stale_check.check_lane_stalenessnot counted (no merge)
Lane → mission mergelanes/consolidation._merge_branch_into (MERGE)stage 2: the mission branch
Mission → targetlanes/consolidation._run_squash_merge and _merge_branch_into (MERGE)stage 2: the target
Lane sync (auto-rebase)lanes/auto_rebase._resolve_managed_artifact_conflictsstage 3: the coordination or mission branch
Dependency-lane mergelanes/worktree_allocator._merge_dependency_lane_tipsstage 2: the dependent lane

There are no state transitions or events; the mission adds no new persisted state.