Skip to content

fix: name the HTTP status in upload, evaluate and Bitbucket errors - #1351

Merged
mbevc1 merged 5 commits into
20261106_fix_error_msgsfrom
20261106_status_text_in_errors
Nov 6, 2026
Merged

mbevc1 merged 5 commits into
20261106_fix_error_msgsfrom
20261106_status_text_in_errors

Conversation

@mbevc1

@mbevc1 mbevc1 commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Several errors outside the API client still report a bare status code, so a reader has to know what 403 or 202 means. They now use the same HTTPStatus helper as the API client:

Where Before After
Attachment upload refused by the bucket upload refused with HTTP 403: BadDigest: … upload refused with HTTP 403 Forbidden: BadDigest: …
kosli evaluate remote policy fetch failed to fetch policy from <url>: HTTP 404 … HTTP 404 Not Found
kosli evaluate server-side refusal the Kosli server answered 403: … the Kosli server answered HTTP 403 Forbidden: …
Bitbucket PR details / commits got HTTP status 202 got HTTP 202 Accepted
  • HTTPStatus is exported from internal/requests so the other packages can use it (first commit, a rename only).
  • The Bitbucket paths are reachable only on a 201 or 202, which the client treats as success. The fake Bitbucket server in the tests can now answer a reply with a chosen status to cover them.
  • One commit per area, each with its own test.

Stacked on #1349. The base will move to main once it merges.

Checklist

Other packages report HTTP errors by bare code and are about to render
them the same way as the API client does, so the helper needs to be
reachable from them.
An upload refused by the storage bucket read "upload refused with HTTP
403". It now reads "HTTP 403 Forbidden", like the API client's errors.
A refused policy fetch and a server-side evaluation the API turned down
were reported by bare code, e.g. "the Kosli server answered 403". They
now read "HTTP 403 Forbidden", like the API client's errors.
A pull request or commit list that came back with a success other than
200 was reported as "got HTTP status 202". It now reads "got HTTP 202
Accepted", like the API client's errors. The fake Bitbucket server in
the tests can now answer a reply with a chosen status, to reach these
paths.
@github-actions github-actions Bot added go Pull requests that update go code fix labels Nov 6, 2026
@claude

claude Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @mbevc1's task in 44s —— View job


Follow-up review of commits ba611992..0506d11e

  • Fetch previous review comments and new commit diff
  • Check status of previously raised finding
  • Review new commits for bugs/regressions in changed lines only
  • Post summary comment

Previous finding — resolved. The Bitbucket "got HTTP 202 Accepted. Please review repository permissions" wording was changed exactly as suggested, to "got %s instead of HTTP 200 OK", and applied consistently to both getPullRequestDetailsFromBitbucket and getPullRequestCommitsFromBitbucket (internal/bitbucket/bitbucket.go:247,335). The matching tests in internal/bitbucket/odd_replies_test.go were updated and tightened from ErrorContains to EqualError, confirming the exact message. I've resolved that review thread.

New commits reviewed: 0506d11e (the wording fix above) and the evaluateHelpers_test.go addition covering HasServerMessage: true. No new bugs or regressions found in the changed lines — no new inline comments.

Note: I wasn't able to execute go test in this sandboxed environment (command approval unavailable), so this was verified by inspection of the diff and surrounding code rather than a live test run.

Comment thread internal/bitbucket/bitbucket.go Resolved
…ssions

The pull request details error reached only on a 201 or 202 told the
user to review repository permissions, which a success status does not
suggest. Both Bitbucket errors on that path now say the reply was not
the 200 OK the code reads. The tests match the whole message.

Also pins the evaluate error for a server message that is present but
empty, which reports the status alone.
@mbevc1
mbevc1 merged commit 59ecb6c into 20261106_fix_error_msgs Nov 6, 2026
18 checks passed
@mbevc1
mbevc1 deleted the 20261106_status_text_in_errors branch November 6, 2026 21:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix go Pull requests that update go code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant