IW-601: The phase gate reads and writes cards that do not belong to the head under test #609

Merged
mph merged 33 commits from IW-601 into main 2026-09-22 14:01:57 +00:00
Member

Summary

The phase gate gives each CI verdict about one commit. Four places in phase-pr and phase-merge broke that rule. This branch fixes all four, one phase each.

Defects fixed

  • Phase 1 (#602): one flag clears one wait. ReviewStateUpdater has one clearCiWait flag in place of the hand-set pair clearCiWaitStarted / clearCiWaitSha. A card can only lose both wait fields together.
  • Phase 2 (#603): a red verdict leaves the head where it was. On a red or other terminal verdict, phase-pr writes the card to disk. It commits nothing and pushes nothing, the same as the green path from IW-491. A false red can no longer produce a green head with a ci_failed card.
  • Phase 3 (#604): a reading of a head that was not pushed is not judged. Before phase-merge judges a reading, it compares the pull request head with the pushed sha. A stale reading after a recovery push makes it wait and read again. It does not use up a --max-retries attempt.
  • Phase 4 (#605): the state-only merge says what it did not judge. When a state-only merge takes a head that is not ci_gated_sha and has no green reading, the merged card gets a "Phase NN: CI not judged" badge and a message that names the unjudged head and the proved head. This is the settled trade from 2026-09-21.

Testing

  • Each phase started with a failing test that reproduced its defect. Harness tests are in core/test, and the git adapter contract is in test/contract/git_adapter_contract.bats.
  • Each phase PR passed CI on its own head. The pre-push hook (core compile with warnings as errors, scalafix, unit tests, command compilation) passed on this branch head.

Release notes

See project-management/issues/IW-601/release-notes.md (Czech).

Closes #601

🤖 Generated with Claude Code

## Summary The phase gate gives each CI verdict about one commit. Four places in `phase-pr` and `phase-merge` broke that rule. This branch fixes all four, one phase each. ## Defects fixed - **Phase 1 (#602): one flag clears one wait.** `ReviewStateUpdater` has one `clearCiWait` flag in place of the hand-set pair `clearCiWaitStarted` / `clearCiWaitSha`. A card can only lose both wait fields together. - **Phase 2 (#603): a red verdict leaves the head where it was.** On a red or other terminal verdict, `phase-pr` writes the card to disk. It commits nothing and pushes nothing, the same as the green path from IW-491. A false red can no longer produce a green head with a `ci_failed` card. - **Phase 3 (#604): a reading of a head that was not pushed is not judged.** Before `phase-merge` judges a reading, it compares the pull request head with the pushed sha. A stale reading after a recovery push makes it wait and read again. It does not use up a `--max-retries` attempt. - **Phase 4 (#605): the state-only merge says what it did not judge.** When a state-only merge takes a head that is not `ci_gated_sha` and has no green reading, the merged card gets a "Phase NN: CI not judged" badge and a message that names the unjudged head and the proved head. This is the settled trade from 2026-09-21. ## Testing - Each phase started with a failing test that reproduced its defect. Harness tests are in `core/test`, and the git adapter contract is in `test/contract/git_adapter_contract.bats`. - Each phase PR passed CI on its own head. The pre-push hook (core compile with warnings as errors, scalafix, unit tests, command compilation) passed on this branch head. ## Release notes See `project-management/issues/IW-601/release-notes.md` (Czech). Closes #601 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The phase gate reads and writes cards that do not belong to the head under test

Artifacts:
- analysis.md

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The phase gate reads and writes cards that do not belong to the head under test

Artifacts:
- tasks.md
- review-state.json (tasks_ready)

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Issue: IW-601
Phase: 1 - One wait is cleared through two hand-set flags

This commit marks the checkpoint for phase 1 context generation.
Use dx-fix IW-601 to return to this point.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
One wait is cleared through two hand-set flags

Artifacts:
- phase-01-tasks.md

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Issue: IW-601
Phase: 2 - A red verdict pushes the card and moves the head

This commit marks the checkpoint for phase 2 context generation.
Use dx-fix IW-601 to return to this point.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
A red verdict pushes the card and moves the head

Artifacts:
- phase-02-tasks.md

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Issue: IW-601
Phase: 3 - A stale reading after a recovery push uses up a retry

This commit marks the checkpoint for phase 3 context generation.
Use dx-fix IW-601 to return to this point.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
A stale reading after a recovery push uses up a retry

Artifacts:
- phase-03-tasks.md

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Issue: IW-601
Phase: 4 - The state-only merge does not say what it did not judge

This commit marks the checkpoint for phase 4 context generation.
Use dx-fix IW-601 to return to this point.

The "CI not judged" badge names its phase, so it stays true after later
phases (no command removes a badge). analysis.md carries the same form.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The state-only merge does not say what it did not judge

Artifacts:
- phase-04-tasks.md

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Follow-ups filed: 2 (#607, #608), commented: 2 (#568, #440), struck: 0
Lessons: 1 approved, 0 rejected, 0 still pending

Promoted:
- A reviewer subagent can revert the uncommitted change it reviews → kanon note dev-docs#321

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
docs(IW-601): add release notes
Some checks failed
CI / changes (pull_request) Successful in 4s
CI / contract (pull_request) Has been skipped
CI / format (pull_request) Successful in 9s
CI / test (pull_request) Has been cancelled
CI / dashboard-build (pull_request) Has been cancelled
CI / compile (pull_request) Has been cancelled
CI / lint (pull_request) Successful in 13s
c63dd4aea2
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
chore(IW-601): update review-state to all_complete
All checks were successful
CI / compile (pull_request) Successful in 1m41s
CI / dashboard-build (pull_request) Successful in 1m18s
CI / changes (pull_request) Successful in 4s
CI / contract (pull_request) Has been skipped
CI / format (pull_request) Successful in 10s
CI / lint (pull_request) Successful in 12s
CI / test (pull_request) Successful in 15m36s
594977a2d4
mph merged commit 37c08716ad into main 2026-09-22 14:01:57 +00:00
Sign in to join this conversation.
No description provided.