IW-578: phase-merge commits the review-state card before the merge, so the post-merge advance completes #587

Merged
mph merged 12 commits from IW-578 into main 2026-09-21 08:56:27 +00:00
Member

Summary

iw phase-merge merged the pull request on the forge, then ran git checkout <feature> while the review-state card was still uncommitted. ci-gate's heartbeat and hand-over write the card with no commit. Git refused the checkout, because the card blob on the phase branch differs from the one on the feature branch. The worktree stayed on the dead phase branch, tasks.md kept the phase open, the card carried a "worktree was not advanced" warning, and the command exited 1. This happened on both phases of IW-555.

Defect fixed

  • Phase 1 (#582): Uncommitted review-state card blocks the post-merge checkout. PhaseMerge.doMergeAndAdvance now commits the card (ReviewStateWrite.tryCommit) immediately before the merge. This is the same order PhasePr.doBatchMerge already uses. The PhaseMergedCard write stays after the advance, on the feature branch.

Testing

  • 3 harness tests in PhaseMergeHarnessTest: the heartbeat path, the state-only path after ci-gate, and "no uncommitted card write when the merge starts".
  • FakeCommandEnv: FakeGit can now refuse a checkout while a card write is uncommitted (opt-in), so a harness test can see this defect.
  • 1 BATS test in test/phase-merge.bats with real git: one committed and one uncommitted card change on the phase branch. Before the fix it failed with the IW-555 message.
  • Phase 1 CI passed on #582. The pre-push checks (compile, scalafix, unit tests) passed on this branch head.

Follow-ups filed

#583, #584, #585, #586.

Release notes

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

🤖 Generated with Claude Code

Closes #578

## Summary `iw phase-merge` merged the pull request on the forge, then ran `git checkout <feature>` while the review-state card was still uncommitted. `ci-gate`'s heartbeat and hand-over write the card with no commit. Git refused the checkout, because the card blob on the phase branch differs from the one on the feature branch. The worktree stayed on the dead phase branch, `tasks.md` kept the phase open, the card carried a "worktree was not advanced" warning, and the command exited 1. This happened on both phases of IW-555. ## Defect fixed - **Phase 1 (#582): Uncommitted review-state card blocks the post-merge checkout.** `PhaseMerge.doMergeAndAdvance` now commits the card (`ReviewStateWrite.tryCommit`) immediately before the merge. This is the same order `PhasePr.doBatchMerge` already uses. The `PhaseMergedCard` write stays after the advance, on the feature branch. ## Testing - 3 harness tests in `PhaseMergeHarnessTest`: the heartbeat path, the state-only path after `ci-gate`, and "no uncommitted card write when the merge starts". - `FakeCommandEnv`: `FakeGit` can now refuse a checkout while a card write is uncommitted (opt-in), so a harness test can see this defect. - 1 BATS test in `test/phase-merge.bats` with real git: one committed and one uncommitted card change on the phase branch. Before the fix it failed with the IW-555 message. - Phase 1 CI passed on #582. The pre-push checks (compile, scalafix, unit tests) passed on this branch head. ## Follow-ups filed #583, #584, #585, #586. ## Release notes See `project-management/issues/IW-578/release-notes.md` (Czech). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Closes #578
phase-merge loses its post-merge advance, because it checks out the feature branch before it commits the card

Artifacts:
- analysis.md

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
phase-merge loses its post-merge advance, because it checks out the feature branch before it commits the card

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

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Issue: IW-578
Phase: 1 - Uncommitted review-state card blocks the post-merge checkout

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

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Uncommitted review-state card blocks the post-merge checkout

Artifacts:
- phase-01-tasks.md

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
docs(IW-578): 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 13s
CI / lint (pull_request) Successful in 13s
CI / test (pull_request) Has been cancelled
CI / dashboard-build (pull_request) Has been cancelled
CI / compile (pull_request) Has been cancelled
c37cdf6302
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
chore(IW-578): update review-state to all_complete
All checks were successful
CI / dashboard-build (pull_request) Successful in 2m4s
CI / changes (pull_request) Successful in 3s
CI / contract (pull_request) Has been skipped
CI / format (pull_request) Successful in 11s
CI / lint (pull_request) Successful in 11s
CI / compile (pull_request) Successful in 1m20s
CI / test (pull_request) Successful in 17m6s
dda796963a
mph merged commit a84020046b into main 2026-09-21 08:56:27 +00:00
Sign in to join this conversation.
No description provided.