fix(server): treat Bitbucket permissions 404 as a removed endpoint - #8557
fix(server): treat Bitbucket permissions 404 as a removed endpoint#8557iamshadmantaqi wants to merge 2 commits into
Conversation
CHANGE-2770 already treats HTTP 410 as gone. Cloud now answers 404, and getRepositoryPermission still fails the merge on that status.
The 410 fallback from CHANGE-2770 never fires on Cloud, which returns 404 for /user/permissions/repositories. Grant on 404 the same way as 410. Real auth failures still fail. Closes pingdotgg#8328
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a small, well-scoped Bitbucket compatibility fix that broadens the existing retired-endpoint handling from HTTP 410 to HTTP 404. Regression coverage verifies the new case while preserving authentication and other failure behavior. You can add or adjust custom eligibility rules. Learn more. |
What Changed
isRepositoryPermissionRemovedErrornow treats HTTP 404 the same as HTTP 410 onGET /user/permissions/repositories. Merge no longer dies in the permission gate when Bitbucket Cloud answers 404 for the removed endpoint.401 and other real failures still fail.
Why
#6525 already treats CHANGE-2770's 410 as "endpoint gone, do not block, let the merge call decide." Cloud now returns 404 for the same URL. The catch never fires, so merge fails with
Bitbucket returned HTTP 404.Closes #8328
Blast Radius
Bitbucket permission reads only. GitHub and GitLab are untouched. A 404 on this one retired endpoint is treated as unknown permission, same as 410 already was. A bad token still fails.
Verification
Failing-then-passing regression in
apps/server/src/pullRequest/BitbucketPullRequestApi.test.ts.Bitbucket returned HTTP 404.vp linton the two changed files: 0 errors.vp run --filter t3 typecheck: no errors in the changed file.No UI chrome changed, so no screenshots.
Checklist
Note
Low Risk
Scoped to Bitbucket repository permission reads; only widens the “removed endpoint” catch to 404, matching existing 410 semantics without relaxing real auth failures.
Overview
Bitbucket Cloud now returns HTTP 404 (not only 410) for the retired
GET /user/permissions/repositoriesendpoint.isRepositoryPermissionRemovedErrortreats 404 like 410, sogetRepositoryPermissionstill resolves to granted when the endpoint is gone instead of surfacingBitbucket returned HTTP 404and blocking merge.Comments document the Cloud vs original CHANGE-2770 behavior. A regression test asserts a 404 on that URL yields
true; 401 and other failures are unchanged.Reviewed by Cursor Bugbot for commit 8662e6f. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Treat Bitbucket permissions endpoint 404 as removed in
isRepositoryPermissionRemovedErrorBitbucket Cloud now returns 404 (in addition to the original 410) for the removed repository-permissions endpoint.
isRepositoryPermissionRemovedErrorin BitbucketPullRequestApi.ts is broadened to classify both statuses as the removed-endpoint signal, sogetRepositoryPermissionstill resolvestrueinstead of failing the merge.Macroscope summarized 8662e6f.