Skip to content

Conversation

@ericproulx
Copy link
Contributor

Fix #2566

@grape-bot
Copy link

2 Warnings
⚠️ There're library changes, but not tests. That's OK as long as you're refactoring existing code.
⚠️ Unless you're refactoring existing code or improving documentation, please update CHANGELOG.md.

Here's an example of a CHANGELOG.md entry:

* [#2567](https://github.com/ruby-grape/grape/pull/2567): Fix memory leak when using recognize_path inside grape::api - [@ericproulx](https://github.com/ericproulx).

Generated by 🚫 Danger

@ericproulx ericproulx requested a review from Copilot May 20, 2025 19:13
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR prevents overriding recognize_path in Grape::API to address a memory leak when using that method.

  • Added recognize_path to the NON_OVERRIDABLE list.
  • Ensures recognize_path cannot be redefined on API classes.
Comments suppressed due to low confidence (2)

lib/grape/api.rb:8

  • Add a test case to verify that recognize_path cannot be overridden on an API subclass, ensuring the memory leak fix is properly enforced.
 NON_OVERRIDABLE = %i[call call! configuration compile! inherited recognize_path].freeze 

lib/grape/api.rb:8

  • [nitpick] Update related documentation or comments to mention that recognize_path is protected from overrides, so users understand why it's included in NON_OVERRIDABLE.
 NON_OVERRIDABLE = %i[call call! configuration compile! inherited recognize_path].freeze 
@ericproulx ericproulx marked this pull request as ready for review May 20, 2025 19:18
@ericproulx ericproulx mentioned this pull request May 20, 2025
@dblock dblock merged commit 14d9f9d into ruby-grape:master May 20, 2025
63 checks passed
ericproulx added a commit to ericproulx/grape that referenced this pull request Jun 22, 2025
…pe#2567) Co-authored-by: Daniel (dB.) Doubrovkine <dblock@dblock.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants