fix(attachments): flush scope on updating attachments - #1934
Open
JoshuaMoelans wants to merge 6 commits into
Open
fix(attachments): flush scope on updating attachments#1934JoshuaMoelans wants to merge 6 commits into
JoshuaMoelans wants to merge 6 commits into
Conversation
`sentry_attachment_set_filename`, `_set_type` and `_set_content_type` mutated scope-owned attachments without locking or flushing the scope. The native backend only rewrites `<run>/__sentry-attachments` on a scope flush, so the crash daemon read a manifest that still carried the physical basename and the attachment type/content type from when the attachment was added. Split each setter into a raw internal mutator and a public wrapper that mutates under the scope lock and flushes the backend on unlock. `sentry__attachments_add_path` uses the raw mutators, keeping options attachments, hint attachments and the crashpad old-run envelope builder off the scope lock. Fixes #1933 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…nt_updates_on_scope
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #1934 +/- ##
==========================================
+ Coverage 75.74% 75.79% +0.05%
==========================================
Files 93 93
Lines 22128 22155 +27
Branches 3939 3945 +6
==========================================
+ Hits 16760 16792 +32
+ Misses 4484 4477 -7
- Partials 884 886 +2 🚀 New features to boost your workflow:
|
JoshuaMoelans
marked this pull request as ready for review
July 31, 2026 10:59
Member
Author
|
@sentry review |
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.
Fixes #1933
Updates to attachments weren't flushed to the scope (only when adding it with
sentry_attach_file). This caused updates to attachments to only apply on non-fatal events, since the native backend only knows about the state of the attachment from right before attaching it.This fixes both questions in the original issue; attachment names are synced & so are the content_types, which initially made Sentry backend interpret the file as the default
application/octet-streamwhich gets a Preview button (whereas theapplication/ztsdwould not)From the flow that UE hits on adding attachments, we see the same attach -> set_filename -> set_content_type flow that we now fix with scope syncing: