fix(release): guard the hoisted git remote get-url call #159

Merged
Claude-Run merged 2 commits from fix/VA-146-create-release-rerun-guard into main 2026-08-09 21:47:19 +02:00
Member

The re-run guard needs base_url before the branch is created (so an in-flight release can be reported with its PR list URL), which moved git remote get-url origin up from the PR-printing block. Wrap it in | complete with its exit code checked and its stderr printed, matching every other git call in the recipe.

Signed-off-by: David Randall David@NiceGuyIT.biz

#VA-146

The re-run guard needs `base_url` before the branch is created (so an in-flight release can be reported with its PR list URL), which moved `git remote get-url origin` up from the PR-printing block. Wrap it in `| complete` with its exit code checked and its stderr printed, matching every other git call in the recipe. Signed-off-by: David Randall <David@NiceGuyIT.biz> #VA-146
`just create-release` created the release branch with a single unguarded `git checkout -b`, so any leftover `release/<tag>` ref (an aborted earlier run, or a merged release branch whose local ref was never pruned) killed the recipe with a raw `fatal: a branch named ... already exists` and no hint that the safe fix is a plain `git branch --delete`.

Adds a re-run guard immediately before the branch creation, after the rebase pull so the merged check runs against a current `main`. Remote is probed first with `git ls-remote --heads` and is never deleted from the recipe: an existing remote branch means a release is already in flight, so the run stops with the PR list URL and the exact `git push origin --delete` to undo it. The local ref is then removed with plain `git branch --delete` (never the force variant), which succeeds only when the branch is fully merged, exactly the safe case; the removal is printed, not silent. A refused delete means real unpushed release work, so the run prints `git log --oneline main..<branch>` and exits before touching the version.

Also guards the post-commit paths. `git push --set-upstream` had no `| complete` at all; both it and `fj pr create` now report which branch exists, whether it reached origin, and what a re-run will do (clean up the local branch, or refuse until the remote one is gone).

Verified against scratch repos driving the guard verbatim: a clean clone passes through to `checkout -b`; a stale `release/v0.5.0` at 0 commits ahead is removed and the run continues; an unmerged one exits 1 with the commit list and leaves the working tree and current branch untouched; a remote `release/v0.5.0` exits 1 with the remote branch still intact.

Signed-off-by: David Randall <David@NiceGuyIT.biz>

#VA-146
fix(release): guard the hoisted git remote get-url call
All checks were successful
Check / fmt + clippy + tests (pull_request) Successful in 19m58s
Create release / Create release from merged PR (pull_request) Has been skipped
45ca27f2eb
The re-run guard needs `base_url` before the branch is created (so an in-flight release can be reported with its PR list URL), which moved `git remote get-url origin` up from the PR-printing block. Wrap it in `| complete` with its exit code checked and its stderr printed, matching every other git call in the recipe.

Signed-off-by: David Randall <David@NiceGuyIT.biz>

#VA-146
Claude-Run deleted branch fix/VA-146-create-release-rerun-guard 2026-08-09 21:47:19 +02:00
Sign in to join this conversation.
No reviewers
No labels
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
psa-systems/vervain-agent!159
No description provided.