Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions sentry-rails/spec/dummy/test_rails_app/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ class TestApp < Rails::Application

FILE_NAME =
case Gem::Version.new(Rails.version)
when ->(v) { v < v5_2 }
"5-0"
when ->(v) { v.between?(v5_2, v6_0) }
"5-2"
when ->(v) { v.between?(v6_0, v6_1) }
Comment on lines 27 to 30
Copy link

Choose a reason for hiding this comment

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

Bug: Rails 7.0.0 incorrectly loads 6-1.rb config due to Gem::Version.between?'s inclusive upper bound, missing 7-0.rb specific configurations.
Severity: CRITICAL | Confidence: 1.00

🔍 Detailed Analysis

When running with Rails 7.0.0, the version selection logic incorrectly matches v.between?(v6_1, v7_0) because Gem::Version.between? is inclusive of both endpoints. This causes the application to load configs/6-1.rb and apps/6-1.rb instead of the correct 7-0.rb files. Consequently, Rails 7.0-specific configurations, such as Zeitwerk::Registry.loaders.clear, are not loaded, leading to incorrect application behavior or test failures.

💡 Suggested Fix

Adjust the version comparison for Rails 7.0.0. Either modify v.between?(v6_1, v7_0) to exclude the upper bound (e.g., v.between?(v6_1, Gem::Version.new("6.999.999"))) or change the subsequent condition to v >= v7_0 && v < v7_1.

🤖 Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: sentry-rails/spec/dummy/test_rails_app/app.rb#L27-L30

Potential issue: When running with Rails 7.0.0, the version selection logic incorrectly
matches `v.between?(v6_1, v7_0)` because `Gem::Version.between?` is inclusive of both
endpoints. This causes the application to load `configs/6-1.rb` and `apps/6-1.rb`
instead of the correct `7-0.rb` files. Consequently, Rails 7.0-specific configurations,
such as `Zeitwerk::Registry.loaders.clear`, are not loaded, leading to incorrect
application behavior or test failures.

Did we get this right? 👍 / 👎 to inform future reviews.

Expand Down
69 changes: 0 additions & 69 deletions sentry-rails/spec/dummy/test_rails_app/apps/5-0.rb

This file was deleted.

5 changes: 0 additions & 5 deletions sentry-rails/spec/dummy/test_rails_app/configs/5-0.rb

This file was deleted.

Loading