Skip to content

Support rails 8 #1044

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

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open

Support rails 8 #1044

wants to merge 4 commits into from

Conversation

absk1317
Copy link

No description provided.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Summary of Changes

Hello @absk1317, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request updates the gem's dependencies and test suite to add support for Rails 8. This involves bumping the minimum required Ruby version and extending the ActiveRecord compatibility range, along with making necessary adjustments to the test setup for Ruby 3 compatibility.

Highlights

  • ActiveRecord Compatibility: Extended the supported ActiveRecord version range to include Rails 8, changing the upper bound from < 8.0 to < 9.0 in the Gemfile and annotate.gemspec.
  • Dependency Removal: Removed the ruby_dep gem from the Gemfile, likely because it's no longer necessary with the Ruby 3.0 requirement.
  • Ruby 3 Test Compatibility: Added a capture_stderr helper in spec/spec_helper.rb and updated tests in spec/lib/annotate/annotate_models_spec.rb to use it for asserting stderr output. Also added an alias for File.exists? to File.exist? in spec_helper.rb for Ruby 3 compatibility.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configureGemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the gem to support Rails 8 by increasing the minimum required Ruby version to 3.0.0 and extending ActiveRecord compatibility up to version 8.x (specified as < 9.0). Changes also include removing the ruby_dep gem, refactoring a test for efficiency, and adding a compatibility shim for File.exists? in the test environment to support execution on Ruby 3+.

The primary concern raised is the increase in required_ruby_version to >= 3.0.0. This is a breaking change for users on Ruby versions < 3.0, even if they are using older Rails versions that this gem still claims to support via its ActiveRecord dependency range. This aspect needs careful consideration regarding semantic versioning and communication.

A minor suggestion is to remove a potentially unused require 'logger' statement in the test helper setup.

@@ -7,7 +7,7 @@ Gem::Specification.new do |s|
s.name = 'annotate'
s.version = Annotate.version

s.required_ruby_version = '>= 2.4.0'
s.required_ruby_version = '>= 3.0.0'

Choose a reason for hiding this comment

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

high

Setting s.required_ruby_version to >= 3.0.0 is a significant change. While this may be necessary for future Rails versions like Rails 8, it will make new versions of annotate_models incompatible for projects using older Ruby versions (e.g., 2.5-2.7), even if those projects are on Rails versions (like Rails 5.x, 6.x) that are otherwise within the activerecord dependency range of ['>= 3.2', '< 9.0'].

For instance, a project on Rails 6.0 with Ruby 2.7 would no longer be able to update annotate_models to this version or newer without also upgrading their Ruby environment.

This effectively means dropping support for Ruby versions older than 3.0. Please consider the following:

  1. Is this breaking change intentional and its impact assessed?
  2. If so, this change should ideally be part of a major version bump for the gem (e.g., from 3.x.x to 4.x.x) and be clearly communicated in the changelog.
  3. The activerecord lower bound of >= 3.2 might also need reconsideration or clarification, as these very old ActiveRecord versions are not practically usable with Ruby 3.0.

@@ -24,7 +24,23 @@
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '../lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))

require 'logger'

Choose a reason for hiding this comment

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

medium

The logger library is imported here, but it doesn't appear to be used within this file or by the changes introduced in this pull request. If it's not utilized elsewhere in the test suite or supporting code, consider removing this line to keep dependencies minimal and avoid loading unnecessary code.

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.

1 participant