Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent Hub from having nil scope and client #2402

Merged
merged 2 commits into from
Sep 27, 2024
Merged

Conversation

st0012
Copy link
Collaborator

@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.

Copy link

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

Copy link
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
8 of 46 checks passed
@sl0thentr0py sl0thentr0py deleted the improve-pop_scope branch September 27, 2024 19:00
Copy link

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