You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR addresses WORKER-JAB, an IndexError: list index out of range occurring in libs/shared/shared/torngit/bitbucket.py:get_ancestors_tree.
Root Cause:
Bitbucket's /repositories/{slug}/commits?include=<commitid> API endpoint returns an HTTP 200 OK response with an empty "values": [] list when a requested commit ID is not resolvable (e.g., if it's on a deleted branch). The get_ancestors_tree method then attempts to access res["values"][0]["hash"] without checking if the values list is empty, leading to an IndexError.
Unlike GitHub and GitLab adapters, which typically receive a 404 for unresolvable objects and raise TorngitObjectNotFoundError, the Bitbucket adapter was not handling this specific 200-with-empty-list scenario. This caused the IndexError to propagate unhandled, crashing the Upload task.
Fix:
Added a check in get_ancestors_tree to verify if res["values"] is empty. If it is, a TorngitObjectNotFoundError is now explicitly raised. This aligns the Bitbucket adapter's behavior with other providers and ensures that callers (like possibly_update_commit_from_provider_info and sync_pull) can gracefully handle unresolvable commits, as they already catch TorngitObjectNotFoundError or its parent TorngitClientError.
Legal Boilerplate
Look, I get it. The entity doing business as "Codecov" is owned by Harness, Inc. In 2026 Harness acquired Codecov and as a result Harness is going to need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Harness can use, modify, copy, and redistribute my contributions, under Harness's choice of terms.
This PR fixes WORKER-JAB — an IndexError in the Bitbucket get_ancestors_tree adapter when the /commits?include=<commitid> endpoint returns HTTP 200 with an empty "values": [] list for an unresolvable commit. It adds a guard that raises TorngitObjectNotFoundError before dereferencing res["values"][0], aligning Bitbucket with the GitHub/GitLab adapters.
The change is minimal and correct: TorngitObjectNotFoundError is already imported, the raise matches the file's established pattern, and callers (possibly_update_commit_from_provider_info, sync_pull) already catch TorngitObjectNotFoundError / TorngitClientError, so the new exception is handled gracefully.
Comparing seer/fix/bitbucket-empty-commits (3303cda) with main (17e0f08)1
Footnotes
No successful run was found on main (1c2ed4e) during the generation of this report, so 17e0f08 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩
Seer wants to keep iterating on this pull request to get CI passing, but the Sentry GitHub App installation is missing permissions it needs to read the failing checks and push a fix.
❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.62%. Comparing base (17e0f08) to head (3303cda). ⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.
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
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.
This PR addresses WORKER-JAB, an
IndexError: list index out of rangeoccurring inlibs/shared/shared/torngit/bitbucket.py:get_ancestors_tree.Root Cause:
Bitbucket's
/repositories/{slug}/commits?include=<commitid>API endpoint returns an HTTP 200 OK response with an empty"values": []list when a requested commit ID is not resolvable (e.g., if it's on a deleted branch). Theget_ancestors_treemethod then attempts to accessres["values"][0]["hash"]without checking if thevalueslist is empty, leading to anIndexError.Unlike GitHub and GitLab adapters, which typically receive a 404 for unresolvable objects and raise
TorngitObjectNotFoundError, the Bitbucket adapter was not handling this specific 200-with-empty-list scenario. This caused theIndexErrorto propagate unhandled, crashing theUploadtask.Fix:
Added a check in
get_ancestors_treeto verify ifres["values"]is empty. If it is, aTorngitObjectNotFoundErroris now explicitly raised. This aligns the Bitbucket adapter's behavior with other providers and ensures that callers (likepossibly_update_commit_from_provider_infoandsync_pull) can gracefully handle unresolvable commits, as they already catchTorngitObjectNotFoundErroror its parentTorngitClientError.Legal Boilerplate
Look, I get it. The entity doing business as "Codecov" is owned by Harness, Inc. In 2026 Harness acquired Codecov and as a result Harness is going to need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Harness can use, modify, copy, and redistribute my contributions, under Harness's choice of terms.
Fixes WORKER-JAB
This PR was automatically generated by Sentry. You can adjust this setting at any time.