Skip to content

Prevent Hub from having nil scope and client#2402

Merged
sl0thentr0py merged 2 commits intomasterfrom
improve-pop_scope
Sep 27, 2024
Merged

Prevent Hub from having nil scope and client#2402
sl0thentr0py merged 2 commits intomasterfrom
improve-pop_scope

Conversation

@st0012
Copy link
Copy Markdown
Contributor

@st0012 st0012 commented Sep 15, 2024

Hub#pop_scope currently can cause a Hub to have a nil scope and client, which would highly likely lead of errors. For example, Hub#configuration would simply cause NoMethodError.

This commit prevents that from ever happening by making sure that Hub#pop_scope would at least leave a brand new scope and the old client on the stack.

@codecov
Copy link
Copy Markdown

codecov bot commented Sep 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.68%. Comparing base (c3bcfa0) to head (33c73f0).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2402      +/-   ##
==========================================
- Coverage   98.69%   98.68%   -0.01%     
==========================================
  Files         210      210              
  Lines       13922    13925       +3     
==========================================
+ Hits        13740    13742       +2     
- Misses        182      183       +1     
Components Coverage Δ
sentry-ruby 99.06% <100.00%> (+<0.01%) ⬆️
sentry-rails 97.34% <ø> (ø)
sentry-sidekiq 97.07% <ø> (ø)
sentry-resque 96.79% <ø> (-0.33%) ⬇️
sentry-delayed_job 98.92% <ø> (ø)
sentry-opentelemetry 100.00% <ø> (ø)
Files with missing lines Coverage Δ
sentry-ruby/lib/sentry/hub.rb 98.82% <100.00%> (-0.58%) ⬇️
sentry-ruby/spec/sentry/hub_spec.rb 96.90% <100.00%> (ø)

... and 2 files with indirect coverage changes

@st0012 st0012 requested a review from sl0thentr0py September 27, 2024 18:55
Copy link
Copy Markdown
Member

@sl0thentr0py sl0thentr0py left a comment

Choose a reason for hiding this comment

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

thx!

`Hub#pop_scope` currently can cause a Hub to have a nil scope and client,
which would highly likely lead of errors. For example, `Hub#configuration`
would simply cause `NoMethodError`.

This commit prevents that from ever happening by making sure that `Hub#pop_scope`
would at least leave a brand new scope and the old client on the stack.
@sl0thentr0py sl0thentr0py merged commit af8fcdd into master Sep 27, 2024
@sl0thentr0py sl0thentr0py deleted the improve-pop_scope branch September 27, 2024 19:00
@github-actions
Copy link
Copy Markdown

Fails
🚫 Please consider adding a changelog entry for the next release.

Instructions and example for changelog

Please add an entry to CHANGELOG.md to the "Unreleased" section. Make sure the entry includes this PR's number.

Example:

## Unreleased

- Prevent Hub from having nil scope and client ([#2402](https://github.com/getsentry/sentry-ruby/pull/2402))

If none of the above apply, you can opt out of this check by adding #skip-changelog to the PR description.

Generated by 🚫 dangerJS against 8a2ddec

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