fix(bundle_analysis): Eagerly load base report to handle MissingBaseReportError - #2160
fix(bundle_analysis): Eagerly load base report to handle MissingBaseReportError#2160sentry[bot] wants to merge 1 commit into
Conversation
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! 🚀 New features to boost your workflow:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2160 +/- ##
=======================================
Coverage 91.63% 91.63%
=======================================
Files 1337 1337
Lines 53262 53263 +1
Branches 1647 1647
=======================================
+ Hits 48805 48806 +1
Misses 4136 4136
Partials 321 321
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
This PR addresses issue API-BG6, where
MissingBaseReportErrorwas being raised as an internal server error instead of being properly handled and returned as aMissingBaseReportGraphQL union type.The root cause was that
BundleAnalysisComparison.__init__eagerly loadedself.head_reportbut notself.base_report. Sincebase_reportis acached_property, theMissingBaseReportError(triggered when the base report was not found in GCS) was only raised later whenresolve_commit_bundle_analysis_compare_with_parentaccessedbase_report.db_pathfor cleanup. At this point, thetry/exceptblock inload_bundle_analysis_comparison(which is designed to catch this error and return the correct GraphQL type) was no longer active.The fix involves adding
self.base_report = self.comparison.base_reportto theBundleAnalysisComparison.__init__method. This ensures thatMissingBaseReportErroris triggered during the construction ofBundleAnalysisComparison, allowingload_bundle_analysis_comparisonto catch it and return the appropriateMissingBaseReportGraphQL type, as intended.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 API-BG6
This PR was automatically generated by Sentry. You can adjust this setting at any time.