WIP: Prefactor: current_phase_id is system-populated, never NULL #306

Closed
toasterson wants to merge 0 commits from claude/wi-019f3704-prefactor-current-phase-id-is-system-pop into main
Owner

Anima work item 019f3704-46b0-72d0-abfd-31320106af0b.

What to build

Every work item row carries a valid current_phase_id from birth, kept in sync on every phase transition — the per-WI exit-bar and reviewer machinery (migration 039, list_reviewable, check_exit_bar) key on it and are blind to NULL. Creation, promotion, demotion (CI-red, review-reject), and every update_work_item phase change resolve the phase row from the WI's workflow (default workflow when unset) and write the id alongside the text phase. Backfill migration for existing rows. check_exit_bar (crates/anima-server/src/services/workitem.rs) stops treating current_phase_id: None as "no bar" — a phase-less WI is an error path, not an ungated one.

Pushed context

Discovered 2026-07-05: ALL prod WIs had NULL current_phase_id; hand-backfilled to Feature Development/"Review & Audit" (phase 25e5c7e2) to arm the first review. Phase rows live in workflow_phases (3 builtin workflows × 3 phases, workflows-own-phases migration 032). Write paths: WorkItemRepo::create/update/advance_to_diff_ready (crates/anima-db/src/repo/workitem.rs), the CI-red demote (crates/anima-server/src/solstice.rs), the reject demote (crates/anima-server/src/mcp/handlers.rs submit_review_verdict). Keep the text phase column authoritative for ordering; the id column mirrors it per §5 until the collapse slice replaces both.

Acceptance criteria

  • New WIs get current_phase_id at creation; all phase-writing paths keep it in sync
  • Backfill migration: no open WI has NULL current_phase_id
  • check_exit_bar errors (not passes) on a NULL current_phase_id for open WIs in gated flows
  • Test: demote via reject/CI-red preserves a consistent (current_phase, current_phase_id) pair

Blocked by

  • None — can start immediately.
Anima work item `019f3704-46b0-72d0-abfd-31320106af0b`. ## What to build Every work item row carries a valid `current_phase_id` from birth, kept in sync on every phase transition — the per-WI exit-bar and reviewer machinery (migration 039, `list_reviewable`, `check_exit_bar`) key on it and are blind to NULL. Creation, promotion, demotion (CI-red, review-reject), and every `update_work_item` phase change resolve the phase row from the WI's workflow (default workflow when unset) and write the id alongside the text phase. Backfill migration for existing rows. `check_exit_bar` (crates/anima-server/src/services/workitem.rs) stops treating `current_phase_id: None` as "no bar" — a phase-less WI is an error path, not an ungated one. ## Pushed context Discovered 2026-07-05: ALL prod WIs had NULL current_phase_id; hand-backfilled to Feature Development/"Review & Audit" (phase 25e5c7e2) to arm the first review. Phase rows live in workflow_phases (3 builtin workflows × 3 phases, workflows-own-phases migration 032). Write paths: WorkItemRepo::create/update/advance_to_diff_ready (crates/anima-db/src/repo/workitem.rs), the CI-red demote (crates/anima-server/src/solstice.rs), the reject demote (crates/anima-server/src/mcp/handlers.rs submit_review_verdict). Keep the text phase column authoritative for ordering; the id column mirrors it per §5 until the collapse slice replaces both. ## Acceptance criteria - [ ] New WIs get current_phase_id at creation; all phase-writing paths keep it in sync - [ ] Backfill migration: no open WI has NULL current_phase_id - [ ] check_exit_bar errors (not passes) on a NULL current_phase_id for open WIs in gated flows - [ ] Test: demote via reject/CI-red preserves a consistent (current_phase, current_phase_id) pair ## Blocked by - None — can start immediately.
toasterson force-pushed claude/wi-019f3704-prefactor-current-phase-id-is-system-pop from 44b6a249ce to 0124113eaa 2026-07-07 00:34:47 +00:00 Compare
Author
Owner

Merged to main manually (human-gated review) as merge commit 24401f3, with fixup 1bbad52: phase-id resolution now falls back to the default Feature Development workflow (160/163 open WIs carry no workflow_id — without the fallback, advance_to_diff_ready NULLed the id right back out on the first implementing→diff-ready flip), draft maps to the initial phase, and the MCP create/update handlers sync current_phase_id too. Closing.

Merged to main manually (human-gated review) as merge commit `24401f3`, with fixup `1bbad52`: phase-id resolution now falls back to the default Feature Development workflow (160/163 open WIs carry no workflow_id — without the fallback, `advance_to_diff_ready` NULLed the id right back out on the first implementing→diff-ready flip), `draft` maps to the initial phase, and the MCP create/update handlers sync `current_phase_id` too. Closing.
toasterson closed this pull request 2026-07-07 13:15:57 +00:00

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
toasterson/Anima!306
No description provided.