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 constraint to ActiveSupport gem to use version lower than 7.1 #751

Closed
wants to merge 5 commits into from

Conversation

ahasunos
Copy link
Contributor

Description

The latest version of ActiveSupport i.e. 7.1.0 - released on October 05, 2023 results to an issue as:

/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/activesupport-7.1.0/lib/active_support/core_ext/array/conversions.rb:108:in `<class:Array>': undefined method `deprecator' for ActiveSupport:Module (NoMethodError)

  deprecate to_default_s: :to_s, deprecator: ActiveSupport.deprecator
                                                          ^^^^^^^^^^^
Did you mean?  deprecate_constant

More details on the issue can be found here: rails/rails#49495

We plan to remove the version constraint post stable release of ActiveSupport 7.1

Related Issue

Fixes #750

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New content (non-breaking change)
  • Breaking change (a content change which would break existing functionality or processes)

Checklist:

  • I have read the CONTRIBUTING document.

@ahasunos
Copy link
Contributor Author

ahasunos commented Oct 12, 2023

The omnibus build fails because Mocha ~1.1 is incompatible with minitest v5.19 and later with an error as:

.rbenv/versions/3.1.3/lib/ruby/gems/3.1.0/gems/mocha-1.16.1/lib/mocha/integration/mini_test/adapter.rb:26:in `included': uninitialized constant MiniTest (NameError)

          Mocha::ExpectationErrorFactory.exception_class = ::MiniTest::Assertion
                                                           ^^^^^^^^^^
Did you mean?  Minitest

Build link here: https://buildkite.com/chef-oss/inspec-train-main-verify/builds/876

This would require upgrade to mocha and rename the occurence of MiniTest::Mock.new to Minitest::Mock.new in our codebase.

@ahasunos
Copy link
Contributor Author

Build where it failed for windows on ruby lower than 3.1 with mocha ~1.1: https://buildkite.com/chef-oss/inspec-train-main-verify/builds/880

@ahasunos
Copy link
Contributor Author

Taking care of mocha in a separate PR: #752

@Schwad
Copy link

Schwad commented Oct 12, 2023

We plan to remove the version constraint post stable release of ActiveSupport 7.1

Just as a headsup, ActiveSupport 7.1 as released is stable. Rafael from the core team gives a bit more clarification around this here (which is why the issue was closed as not planned) :

If you are not in a Rails application (that already does that for you automatically), you should always require active_support beforing requiring anything else inside active_support. This is a requirement from the framework since the beginning.
See https://guides.rubyonrails.org/active_support_core_extensions.html#stand-alone-active-support
This is an issue in CocoaPods, or any gems that requires Active Support features before requiring the active_support entrypoint.

Hope this context helps! :)

@ahasunos
Copy link
Contributor Author

We plan to remove the version constraint post stable release of ActiveSupport 7.1

Just as a headsup, ActiveSupport 7.1 as released is stable. Rafael from the core team gives a bit more clarification around this here (which is why the issue was closed as not planned) :

If you are not in a Rails application (that already does that for you automatically), you should always require active_support beforing requiring anything else inside active_support. This is a requirement from the framework since the beginning.
See https://guides.rubyonrails.org/active_support_core_extensions.html#stand-alone-active-support
This is an issue in CocoaPods, or any gems that requires Active Support features before requiring the active_support entrypoint.

Hope this context helps! :)

Thanks @Schwad! Requiring active_support before requiring anything else inside active_support fixes the issue.

@ahasunos
Copy link
Contributor Author

Closing this PR. As it is getting addressed on inspec-k8s resource pack's end here: inspec/inspec-k8s#37

@ahasunos ahasunos closed this Oct 12, 2023
@ahasunos ahasunos deleted the ss/pin-activesupport-below-7.1 branch October 12, 2023 09:50
@ahasunos ahasunos restored the ss/pin-activesupport-below-7.1 branch November 13, 2023 07:01
@ahasunos ahasunos reopened this Nov 13, 2023
@ahasunos ahasunos closed this Nov 13, 2023
@ahasunos ahasunos deleted the ss/pin-activesupport-below-7.1 branch November 13, 2023 07:04
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.

InSpec breaks with ActiveSupport 7.1.0
3 participants