Drop to_hash in SentryParameterFilter to support sentry-ruby v6#22
Drop to_hash in SentryParameterFilter to support sentry-ruby v6#22os0x wants to merge 4 commits intocookpad:masterfrom
Conversation
Access Sentry::Event and Sentry::RequestInterface objects directly instead of converting via to_hash, which is deprecated in v5 and removed in v6. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@os0x Sorry to jump in from the side, but I ran into the same issue. It might be helpful to update the sample code in the README as well. Apologies for only leaving a comment instead of sending a patch myself. thanks a lot! |
There was a problem hiding this comment.
Pull request overview
Updates Blouson’s SentryParameterFilter to operate directly on Sentry::Event / Sentry::RequestInterface objects instead of event.to_hash, aligning with sentry-ruby v6 where to_hash is removed.
Changes:
- Refactored
SentryParameterFilterinternals to useevent.request.*andevent.extrarather than hash access. - Updated specs to construct and assert against real
Sentry::ErrorEvent+Sentry::RequestInterfaceobjects.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| lib/blouson/sentry_parameter_filter.rb | Switches filtering logic from hash-based event access to Sentry object accessors. |
| spec/blouson/sentry_parameter_filter_spec.rb | Reworks test setup/assertions to use Sentry event/request objects and validate the new behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…tibility Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…spec Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
nekketsuuu
left a comment
There was a problem hiding this comment.
Mostly LGTM. Would you please add a lower bound of sentry-ruby gem in gemspec?
| return unless req && req.data.present? | ||
|
|
||
| data = req.data | ||
| if data.is_a?(String) |
There was a problem hiding this comment.
Memo: I think it's okay to leave this condition as is, but it seems that Sentry::RequestInterface expects data is a Hash: https://github.com/getsentry/sentry-ruby/blob/a1c52820777d5ddb151ba66fd55cced0732730fd/sentry-ruby/lib/sentry/interfaces/request.rb#L24-L26
|
|
||
| ``` | ||
|
|
||
| > **Note:** Since sentry-ruby v6, `event.to_hash` is no longer available. Pass `event` directly to `filter.process` instead of `filter.process(event.to_hash)`. |
There was a problem hiding this comment.
nit: I think this should be written in CHANGELOG instead of README
Summary
SentryParameterFilter#processfrom hash access (event[:request][:data], etc.) to direct object access onSentry::Event/Sentry::RequestInterface(event.request.data, etc.)to_hashin sentry-ruby v5 and its removal in v6filter.process(event.to_hash)tofilter.process(event)(breaking change — major version bump planned)Test plan
spec/blouson/sentry_parameter_filter_spec.rbto useSentry::ErrorEvent+Sentry::RequestInterfaceobjects instead of plain hashes🤖 Generated with Claude Code