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

Add full Ruby 3.4 compatibility (non-breaking) #537

Merged

Conversation

tagliala
Copy link
Contributor

@tagliala tagliala commented Dec 27, 2024

Blocked by

Caller location with label is being decorated with
Shakapacker::Helper# in Ruby 3.4

This commit changes label to base_label

Close #535

Ref:

Summary by CodeRabbit

Release Notes

  • CI/CD Updates

    • Added support for Ruby 3.4 in GitHub Actions workflows
    • Updated testing matrix to include Ruby 3.4
    • Added specific exclusion rules for Ruby 3.4 with certain Rails gemfiles
  • Code Improvements

    • Minor refinement to error message generation in helper method

Copy link

coderabbitai bot commented Dec 27, 2024

Warning

Rate limit exceeded

@tagliala has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 37 minutes and 28 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 12ba7c3 and ee710e1.

📒 Files selected for processing (3)
  • .github/workflows/generator.yml (2 hunks)
  • .github/workflows/ruby.yml (3 hunks)
  • lib/shakapacker/helper.rb (1 hunks)

Walkthrough

The pull request introduces updates to GitHub Actions workflows and a Ruby helper method to support Ruby 3.4. The changes primarily involve expanding the testing matrix to include Ruby 3.4 in both the generator and Ruby workflows, with specific exclusion rules for certain Rails gemfiles. Additionally, a modification was made to the error message generation in the Shakapacker helper to address a potential issue with method caller identification in Ruby 3.4.

Changes

File Change Summary
.github/workflows/generator.yml Added Ruby 3.4 to matrix strategy and new exclusion rules for Rails 6.0.x, 6.1.x, and 7.0.x gemfiles
.github/workflows/ruby.yml Updated Ruby version from 3.3 to 3.4 in lint job, added 3.4 to test matrix, added exclusions for specific gemfiles
lib/shakapacker/helper.rb Changed error message generation from caller_locations(1..1).first.label to caller_locations(1..1).first.base_label

Assessment against linked issues

Objective Addressed Explanation
Resolve specs failing against Ruby 3.4 [#535]

Possibly related PRs

Suggested reviewers

  • justin808

Poem

🐰 A Ruby update hops into view,
Workflows dance with versions new,
Version 3.4 joins the test parade,
With compatibility carefully made,
CodeRabbit's magic, precise and true! 🚀


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@tagliala tagliala changed the title Add full Ruby 3.4 compatibility Add full Ruby 3.4 compatibility (non-breaking) Dec 27, 2024
@tagliala tagliala changed the title Add full Ruby 3.4 compatibility (non-breaking) Add full Ruby 3.4 compatibility (non-breaking, requires #536) Dec 27, 2024
Comment on lines 34 to 42
# TODO: remove when Ruby < 3.1 support will be dropped
# Ref: https://github.com/shakacode/shakapacker/issues/534
bundler_update_command =
if RUBY_VERSION.start_with?("3.1")
"gem update bundler"
else
"gem install bundler --version '< 2.6'"
end

Copy link
Collaborator

Choose a reason for hiding this comment

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

@tagliala Can you shine some more light on this? Why we use override for anything that's not Ruby 3.1?

Copy link
Contributor Author

@tagliala tagliala Jan 6, 2025

Choose a reason for hiding this comment

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

I've provided info here: #534

The failure is visible here: https://github.com/shakacode/shakapacker/actions/runs/12455226553/job/34767380887#step:4:140

Bundler 2.6 requires Ruby 3.1+, but for some reasons when you run gem update bundler on 3.0 it prefers to fail rather than installing 2.5 series

I think this is slightly related to ruby/setup-ruby@540484a

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks @tagliala I was wondering more why we only want it for 3.1 and not 3.2, 3.3 etc

Regardless, see https://github.com/shakacode/shakapacker/pull/539/files I think that's more sensible way to go about it as I don't see particularly good reason to update bundler manually.

Could you roll those changes here, together with any other workflow updates spanning this PR (like new Node version) and #536 and I'll happily merge

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, #539 is much better, thanks. If you can merge I'll rebase

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sounds good, stuck waiting for review on that one to merge but hopefully coming soon!

Copy link
Collaborator

Choose a reason for hiding this comment

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

@tagliala good to rebase!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Rebased, comment resolved

@@ -24,7 +24,7 @@ jobs:
node-version: '16'
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.1.2'
ruby-version: '3.1.6'
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would update this to 3.4 or at very least 3.3. Can't see decent reason to test with old Ruby version. Same applies to node 16 above. Let's use Node 22

Copy link
Collaborator

Choose a reason for hiding this comment

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

Since we're using 3.4 in ruby.yml let's stick to that!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, I've reverted the change here because the dummy app uses Rails 6.1, so it should use 3.1.x

Since this commit does not belong to this feature, can be tracked separately

@tagliala tagliala force-pushed the feature/535-full-ruby34-compatibility branch from 0bf68fa to 12ba7c3 Compare January 7, 2025 20:30
@tagliala tagliala changed the title Add full Ruby 3.4 compatibility (non-breaking, requires #536) Add full Ruby 3.4 compatibility Jan 7, 2025
@tagliala tagliala requested a review from tomdracz January 7, 2025 20:38
@tagliala tagliala marked this pull request as ready for review January 7, 2025 20:39
@tagliala tagliala changed the title Add full Ruby 3.4 compatibility Add full Ruby 3.4 compatibility (non-breaking) Jan 7, 2025
@tagliala tagliala force-pushed the feature/535-full-ruby34-compatibility branch from 12ba7c3 to 70f043b Compare January 7, 2025 20:47
@tagliala tagliala marked this pull request as draft January 7, 2025 20:49
@tagliala tagliala force-pushed the feature/535-full-ruby34-compatibility branch from 70f043b to fd7023f Compare January 7, 2025 20:50
Caller location with `label` is being decorated with
`Shakapacker::Helper#` in Ruby 3.4

This commit changes `label` to `base_label`

Close shakacode#535

Ref:
- https://ruby-doc.org/core-2.7.0/Thread/Backtrace/Location.html#method-i-base_label
@tagliala tagliala force-pushed the feature/535-full-ruby34-compatibility branch from fd7023f to ee710e1 Compare January 7, 2025 20:52
@tagliala tagliala marked this pull request as ready for review January 7, 2025 21:01
@tagliala tagliala mentioned this pull request Jan 7, 2025
4 tasks
@tomdracz tomdracz merged commit 183b7ae into shakacode:main Jan 8, 2025
49 checks passed
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.

Specs fail against Ruby 3.4 [PR attached]
2 participants