fix(prune): classify a does-not-exist 500 on remote branch-delete as already-gone, not an error #462

Merged
hexajon merged 1 commit from issue-449-prune-fix into main 2026-08-27 04:59:06 +00:00
Owner

Summary

madtea prune --remote --delete-branches reported six "API error 500: object does not exist [id: refs/heads/]" lines (#449 defect 2). Those refs were already gone on the forge - their PRs were squash-merged with delete-on-merge, so the branch was removed server-side before prune reached it - and this forge answers a delete of an absent ref with a 500 rather than a clean 404. prune now classifies that specific 500 (500 status AND the stable "object does not exist [id: refs/heads/" body) as already-gone, folded into RemoteAlreadyGone like a 404, never a surfaced error. A genuine 500 with any other body still surfaces. Adds a defensive skip so a branch reached by both the ancestry and squash-merged passes has its remote twin deleted at most once (the two candidate sets are disjoint by construction today, so this never fires in practice - a guard, not a live path). Tests cover the does-not-exist 500 classification and the skip guard. Defect 1 (a squash-merged branch appearing under both "Deleted remote" and "Deleted squash-merged" headings) is a separate display question, deferred on the issue.

Refs #449

## Summary `madtea prune --remote --delete-branches` reported six "API error 500: object does not exist [id: refs/heads/<name>]" lines (#449 defect 2). Those refs were already gone on the forge - their PRs were squash-merged with delete-on-merge, so the branch was removed server-side before prune reached it - and this forge answers a delete of an absent ref with a 500 rather than a clean 404. prune now classifies that specific 500 (500 status AND the stable "object does not exist [id: refs/heads/" body) as already-gone, folded into RemoteAlreadyGone like a 404, never a surfaced error. A genuine 500 with any other body still surfaces. Adds a defensive skip so a branch reached by both the ancestry and squash-merged passes has its remote twin deleted at most once (the two candidate sets are disjoint by construction today, so this never fires in practice - a guard, not a live path). Tests cover the does-not-exist 500 classification and the skip guard. Defect 1 (a squash-merged branch appearing under both "Deleted remote" and "Deleted squash-merged" headings) is a separate display question, deferred on the issue. Refs #449
fix(prune): classify a does-not-exist 500 on remote branch-delete as already-gone, not an error (#449)
All checks were successful
ci / mcp-conformance (pull_request) Successful in 1m35s
drift / govulncheck (pull_request) Has been skipped
drift / surface-diff (pull_request) Successful in 34s
drift / forgejo-smoke (pull_request) Has been skipped
drift / govulncheck (push) Has been skipped
drift / surface-diff (push) Successful in -6s
drift / forgejo-smoke (push) Has been skipped
ci / mcp-conformance (push) Successful in 1s
ci / gate (push) Successful in 11m49s
ci / gate (pull_request) Successful in 22m53s
c7b23f72b7
Sign in to join this conversation.
No reviewers
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
sixfold-space/madtea!462
No description provided.