Skip to content

ref: prevent direct access to scope data - #2083

Open
jpnurmi wants to merge 2 commits into
masterfrom
jpnurmi/ref/scope-data
Open

ref: prevent direct access to scope data#2083
jpnurmi wants to merge 2 commits into
masterfrom
jpnurmi/ref/scope-data

Conversation

@jpnurmi

@jpnurmi jpnurmi commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator

Move scope data out of the header to prevent direct access, and provide internal API tailored for protecting the data with RW-locks in #2042. This offloads a lot of mechanical churn out of #2042, lets #2042 focus on getting the RW-locks right, and allows migrating the console SDKs.

See also:

@jpnurmi
jpnurmi added this pull request to stack #2084 September 10, 2026 11:58
@codecov

codecov Bot commented Sep 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.27586% with 39 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.60%. Comparing base (6478c0f) to head (981087c).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2083      +/-   ##
==========================================
- Coverage   74.68%   74.60%   -0.08%     
==========================================
  Files         103      103              
  Lines       27039    27245     +206     
  Branches     4915     4928      +13     
==========================================
+ Hits        20193    20327     +134     
- Misses       5501     5577      +76     
+ Partials     1345     1341       -4     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@limbonaut limbonaut left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went through the whole change set. It's well structured and mostly mechanical shift, but because of the sheer size I might have missed some tiny speck. Ran a scan too. Looks good with one place worth considering a small alteration in behavior to avoid a potential future trap.

Comment thread src/sentry_scope.c
Base automatically changed from jpnurmi/ref/attachments to master September 11, 2026 12:03
Move scope data out of the header to prevent direct access, and provide
internal API tailored for protecting the data with RW-locks in #2024.
Clone the active span or transaction value instead of retaining its inner
reference. This lets the returned value outlive finish without bypassing
wrapper cleanup.

Rename the accessor to load_span_or_transaction and cover both lifetimes
with sanitizer regression tests.
@jpnurmi
jpnurmi force-pushed the jpnurmi/ref/scope-data branch from 883f4a6 to 981087c Compare September 11, 2026 13:17
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