Skip to content

Conversation

@maxweng-sentry
Copy link
Contributor

@maxweng-sentry maxweng-sentry commented Oct 24, 2025

Address this issue:
https://linear.app/getsentry/project/report-merging-improvements-89f3063419db/overview

Primary Fix: Use the is_disjoint Optimization in Shadow Mode

The Report.merge() method has a built-in optimization that wasn't being used:

  • is_disjoint=True: Defers expensive line-by-line merging, just appends coverage records
  • finish_merge(): Performs actual merging in one pass at the end

Changes:
In libs/shared/shared/utils/merge.py

  • Added a deduplicate_sessions function that will run within finish_merge that will correctly merge LineSessions

In apps/worker/services/processing/merging.py

  • Added Shadow Mode run of the function that will throw an exception if the optimized code is different from production code.

@sentry
Copy link

sentry bot commented Oct 24, 2025

Codecov Report

❌ Patch coverage is 91.86047% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.83%. Comparing base (f3d65a6) to head (6962fa5).
⚠️ Report is 13 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
apps/worker/services/processing/merging.py 91.78% 6 Missing ⚠️
libs/shared/shared/reports/resources.py 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #538      +/-   ##
==========================================
+ Coverage   93.82%   93.83%   +0.01%     
==========================================
  Files        1280     1282       +2     
  Lines       46120    46336     +216     
  Branches     1511     1527      +16     
==========================================
+ Hits        43272    43480     +208     
- Misses       2540     2547       +7     
- Partials      308      309       +1     
Flag Coverage Δ
apiunit 96.53% <ø> (+0.01%) ⬆️
sharedintegration 38.71% <30.76%> (-0.21%) ⬇️
sharedunit 88.77% <92.30%> (+0.07%) ⬆️
workerintegration 58.89% <84.93%> (+0.13%) ⬆️
workerunit 91.02% <64.38%> (-0.12%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@codecov-notifications
Copy link

codecov-notifications bot commented Oct 24, 2025

Codecov Report

❌ Patch coverage is 91.86047% with 7 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
apps/worker/services/processing/merging.py 91.78% 6 Missing ⚠️
libs/shared/shared/reports/resources.py 50.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@codspeed-hq
Copy link

codspeed-hq bot commented Oct 27, 2025

CodSpeed Performance Report

Merging #538 will not alter performance

Comparing max/optimize-merge (6962fa5) with main (7bb8f94)1

Summary

✅ 9 untouched

Footnotes

  1. No successful run was found on main (c55b19e) during the generation of this report, so 7bb8f94 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@maxweng-sentry maxweng-sentry changed the title Use Is_disjoint optimization Use Is_disjoint optimization in Shadow Mode Oct 30, 2025
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.

2 participants