[OJ-54730] Catch HTTPError when fetching BB Cloud PR merge commit#454
Merged
Conversation
Mirrors the existing pattern in jf_github/adapters/bitbucket_cloud.py so a garbage-collected merge commit returns merge_commit=None instead of skipping the entire PR.
There was a problem hiding this comment.
Pull request overview
This PR updates Bitbucket Cloud PR normalization so missing or inaccessible merge commit objects do not cause the entire PR ingestion to fail.
Changes:
- Wraps merge commit retrieval in
try/except requests.exceptions.HTTPError. - Logs the merge commit hash and HTTP status when retrieval fails, leaving
merge_commit=None.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+528
to
+529
| logger.info( | ||
| f'For merge commit {merge_commit_hash} received a {e.response.status_code} while retrieving PR commits' |
Contributor
Author
There was a problem hiding this comment.
Added a regression test in commit 08c794a: test_get_prs_merge_commit_404_does_not_skip_pr stubs client.get_commit to raise HTTPError(404) and asserts the PR is still returned with merge_commit=None.
Verifies that when client.get_commit raises HTTPError(404), the PR is still returned with merge_commit=None instead of being skipped.
- Add return type hint to test method. - Replace hex-like merge hash literal with a non-hex placeholder so the detect-secrets pragma comment is no longer needed.
|
ashleyredzko
approved these changes
May 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
client.get_commit(...)call for a PR'smerge_commitinjf_agent/git/bitbucket_cloud_adapter.pywith atry/except requests.exceptions.HTTPError, so a garbage-collected merge commit no longer raises and causes the entire PR to be dropped with[3011] Error normalizing PR ....merge_commit=None. The PR is still ingested with all other fields intact.