Skip to content

fix: give GitLab/Bitbucket pipelines the review job, and stop cleanup lying - #1432

Merged
glennmichael123 merged 1 commit into
mainfrom
fix/pipelines-and-cleanup
Aug 31, 2026
Merged

fix: give GitLab/Bitbucket pipelines the review job, and stop cleanup lying#1432
glennmichael123 merged 1 commit into
mainfrom
fix/pipelines-and-cleanup

Conversation

@glennmichael123

Copy link
Copy Markdown
Member

Two unrelated defects, both the "existed and was never reached" shape.

GitLab and Bitbucket pipelines had no review job

ciTemplateFor has taken a { review } option since those templates were written:

export function ciTemplateFor(provider: string, options: { review?: boolean } = {})

Its only call site:

const template = ciTemplateFor(provider)

So a repository on either platform set up by buddy setup got a pipeline that scheduled updates and never reviewed a merge request — while the GitHub workflow has carried the review job from the start. Passed now. The command honours ai.review at run time and works without a key, so it's as safe there as on GitHub.

Cleanup reported deletions that didn't happen

GitHub's deleteBranch:

this.logger.warn(`⚠️ Failed to delete remote branch ${branchName}: …`)
// Don't throw - branch deletion failures are not critical

cleanupStaleBranches has a per-branch catch that fills its failed bucket. It could never reach it. Every branch was reported deleted whether the push succeeded or not, and buddy update-check printed "N branches deleted, 0 failed" over a remote that still had them.

GitLab and Bitbucket already throw here. GitHub now does too, with one exception: a branch that's already gone is the outcome the caller wanted, so that failure is a success — failing cleanup over it would leave the same branch "failing" on every run.

Three of the four callers already wrapped the call. The fourth — auto-closing a superseded PR — is now guarded the same way: the PR is closed either way, and a branch that won't delete is a warning, not a failed run.

Tests

2160 → 2166.

Lint ✓ · typecheck ✓ · check:docs ✓ · 0 fail

🤖 Generated with Claude Code

https://claude.ai/code/session_01UWouahBJT3msK7V2VDYY6T

… lying

Two unrelated defects, both the "existed and was never reached" shape.

`ciTemplateFor` has taken a `{ review }` option since the GitLab and
Bitbucket templates were written, and its only call site never passed it.
A repository on either platform set up by `buddy setup` got a pipeline that
scheduled updates and never reviewed a merge request, while the GitHub
workflow has carried the review job from the start. The option is now
passed. The command honours `ai.review` at run time and works without a
key, so the job is as safe to include there as it is on GitHub.

GitHub's `deleteBranch` swallowed every failure — the comment said "branch
deletion failures are not critical" — so `cleanupStaleBranches`, whose
per-branch `catch` fills the `failed` bucket, could never reach it. Every
branch was reported deleted whether the push succeeded or not, and
`buddy update-check` printed "N branches deleted, 0 failed" over a remote
that still had them. GitLab and Bitbucket already throw here; GitHub now
does too, with one exception: a branch that is already gone is the outcome
the caller wanted, so that failure is a success. Failing cleanup over it
would leave the same branch "failing" on every run.

Three of the four callers already wrapped the call in `try`/`catch`. The
fourth — auto-closing a superseded pull request — is now guarded the same
way, because the pull request is closed either way and a branch that would
not delete is worth a warning rather than a failed run.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UWouahBJT3msK7V2VDYY6T
@glennmichael123
glennmichael123 merged commit 8ee2d8c into main Aug 31, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant