Skip to content

fix(bundle_analysis): Prevent AttributeError when pull.database_pull is None - #2002

Open
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/bundle-analysis-none-pull
Open

fix(bundle_analysis): Prevent AttributeError when pull.database_pull is None#2002
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/bundle-analysis-none-pull

Conversation

@sentry

@sentry sentry Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

This PR addresses an AttributeError: 'NoneType' object has no attribute 'get_comparedto_commit' occurring in bundle analysis notifications.

Root Cause:
When fetch_and_update_pull_request_information encounters a TorngitClientError (e.g., PR not found on the git provider) and the pull request is also not present in the database, it returns an EnrichedPull object where database_pull is None. The fetch_and_update_pull_request_information_from_commit function then passes this EnrichedPull object downstream. Later, ComparisonLoader.from_EnrichedPull attempts to access pull.database_pull.get_comparedto_commit() without a null check, leading to the AttributeError.

Solution:
Added a null check in fetch_and_update_pull_request_information_from_commit to explicitly return None if enriched_pull.database_pull is None. This ensures that functions calling fetch_and_update_pull_request_information_from_commit (like load_enriched_pull in notification contexts) receive None when a valid database pull cannot be established, allowing them to handle the scenario gracefully (e.g., by raising NotificationContextBuildError or falling back to alternative comparison methods).

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-P81

This PR was automatically generated by Sentry. You can adjust this setting at any time.

@thomasrockhu-codecov

Copy link
Copy Markdown
Contributor

🤖 Harness AI Code Review in progress… · View results →

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant