Fix #113: verify-approval cannot pass after the PR is merged - #137
Conversation
After merge the project is still in review. Approving verify-approval was running review's pr_exists against the current worktree branch, which is almost never the PR head.
Fails without the fix: approve re-runs review's pr_exists (false) and exits 1. Passes with it: gate approves and phase becomes verified.
Integration review — approvedOne source file, Problem. Root cause. Worth recording, because the issue title states it wrongly and the builder Fix. Two things I checked before approving, because this mutates state inside
The new Merge with |
pr_exists already matches merged PRs via --state all. The failure is --head resolving to the wrong branch after merge.
Summary
porch approve <id> verify-approvalwas unpassable after a normal merge. It re-ran review'spr_existsagainst the current worktree branch, which is almost never the PR head once the PR is merged.Fixes #113
Root Cause
The SPIR
verifyphase has no checks. After theprgate is approved and the PR merges, the project is still inreviewuntil someone runsporch done. Approvingverify-approvalran checks forstate.phase(review), whose first check ispr_exists.That check asks
git branch --show-currentin whichever worktreefindStatusPathreturns. After merge that is almost never the PR head. The forge script already accepts MERGED (cluesmith#568). Againstbuilder/spir-83it returns true. The lookup key is the wrong branch, and the post-merge gate should not run that check at all.Reproduced on project 83 (PR #104 MERGED, still in review).
porch check 83from this worktree failedpr_existsin 0.6s. From main it passed only becausefindStatusPathhit air-106, whose unrelated merged PR #132 satisfied the check.Fix
When
porch approveis asked forverify-approvaland the project is still inreviewwithpralready approved, enter verify first. The checks that then run are verify's (none). The existing auto-advance can reachverified.Refuses if
pris not approved, so the pr gate cannot be skipped.Test Plan
bugfix-113-verify-approval-merged-pr.test.tspr_existsisfalse. Without the fix, approve exits 1. With it, the gate approves and phase becomesverified.pris still pending.tsc --noEmitclean.@cluesmith/codevsuite: 6023 passed, 48 skipped. v2: 167 passed.