Commit Graph

834 Commits

Author SHA1 Message Date
Ryan Davis 2650a05547 Bump minitest to 5.25.1 and clean up hacks for minitest 5.25.0 2024-08-16 11:28:19 -07:00
Stephen Margheim 2976d3767e Use the new SQLite3::Database#busy_handler_timeout= method for a non-GVL-blocking, fair retry interval busy handler implementation
Co-Authored-By: Jean Boussier <byroot@ruby-lang.org>
2024-08-16 13:56:24 +02:00
Gannon McGibbon 7d42bf68e2 Manually implement journey parser
Removes racc dependency, and writes our own parser for routing instead.
2024-08-15 00:53:23 -05:00
Rafael Mendonça França 002519a5fa
Support minitest 5.25+
Minitest 5.25+ has a new API for `with_info_handler` that accepts an
additional argument.

The code now support all versions of minitest 5.

See 8cd3b1c749
2024-08-14 22:39:50 +00:00
David Heinemeier Hansson 11a93a05a7
Use Thruster by default to Rails 8 (#51793)
* Allow docker entrypoint script to have other preceeding commands in CMD and still run db:prepare if we are starting the server

* Add Thruster by default

* Include new binstub

* Temporarily expose only 80 (via 3000)

* Just expose 80 for now, Kamal will need to handle 443

* Correct typo in activerecord changelog [ci skip]

Correct typo in activerecord changelog for -https://github.com/rails/rails/pull/50662

* Defer route drawing to the first request, or when url_helpers called.

Executes the first routes reload in middleware, or when the route set
url_helpers is called. Previously, this was executed unconditionally on
boot, which can slow down boot time unnecessarily for larger apps with
lots of routes.

* Support `touch_all` in batches

* Do not trigger devcontainer tests on pull requests

We need to review the code before executing this workflow, so only trigger when someone merge to this repository.

* Refactor `ActiveRecord::SignedId` to not rely on relation delegation

Ref: https://github.com/rails/rails/pull/50396
Ref: https://github.com/rails/rails/pull/51776

`ActiveRecord::Relation` automatically delegates missing methods
to the model class wrapped in a `scoping { }` block.

This is to support scoping in user defined class methods. The problem
however is that it's very error prone for the framework, because we
can mistakenly call model methods from inside `Relation` and not
realized we're applying a global scope.

In the best case scenario it's just a waste of performance, but
it can also lead to bugs like https://github.com/rails/rails/issues/51775

I'm planning to restrict this automatic delegation to methods defined
in childs of `ActiveRecord::Base` only: https://github.com/rails/rails/pull/50396
but for this to work we must first refactor any Rails code that rely on it.

* Refactor `ActiveRecord::TokenFor` to not rely on relation delegation

Ref: https://github.com/rails/rails/pull/50396
Ref: https://github.com/rails/rails/pull/51776

`ActiveRecord::Relation` automatically delegates missing methods
to the model class wrapped in a `scoping { }` block.

This is to support scoping in user defined class methods. The problem
however is that it's very error prone for the framework, because we
can mistakenly call model methods from inside `Relation` and not
realized we're applying a global scope.

In the best case scenario it's just a waste of performance, but
it can also lead to bugs like https://github.com/rails/rails/issues/51775

I'm planning to restrict this automatic delegation to methods defined
in childs of `ActiveRecord::Base` only: https://github.com/rails/rails/pull/50396
but for this to work we must first refactor any Rails code that rely on it.

* Fix: batch test assertion order

Co-authored-by: Chedli Bourguiba <chaadow@users.noreply.github.com>

* Move `ActiveRecord::Base.delete` in `Relation`

Ref: https://github.com/rails/rails/pull/50396

* Move `ActiveRecord::Base.destroy` in `Relation`

Ref: https://github.com/rails/rails/pull/50396

* Move `ActiveRecord::Base.insert` in `Relation`

Ref: https://github.com/rails/rails/pull/50396

As well as related methods.

* Use `foreign_key` option for destroy_async test models

This pull request replaces the deprecated `query_constraints:` option with `foreign_key` for destroy_async test models.
Follow up #51571

- This commit addresses these two warnings below:

```
% bin/test test/activejob/destroy_association_async_test.rb
Using sqlite3
DEPRECATION WARNING: Setting `query_constraints:` option on `Cpk::BookDestroyAsync.has_many :chapters` is deprecated. To maintain current behavior, use the `foreign_key` option instead. (called from new at /Users/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/reflection.rb:19)
/Users/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/reflection.rb:19:in `new'
  /Users/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/reflection.rb:19:in `create'
  /Users/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/associations/builder/association.rb:50:in `create_reflection'
  /Users/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/associations/builder/association.rb:32:in `build'
  /Users/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/associations.rb:1531:in `has_many'
  /Users/yahonda/src/github.com/rails/rails/activerecord/test/models/cpk/book_destroy_async.rb:7:in `<class:BookDestroyAsync>'
  /Users/yahonda/src/github.com/rails/rails/activerecord/test/models/cpk/book_destroy_async.rb:4:in `<module:Cpk>'
  /Users/yahonda/src/github.com/rails/rails/activerecord/test/models/cpk/book_destroy_async.rb:3:in `<top (required)>'
  /Users/yahonda/.rbenv/versions/3.3.1/lib/ruby/3.3.0/bundled_gems.rb:74:in `require'
  /Users/yahonda/.rbenv/versions/3.3.1/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
  /Users/yahonda/src/github.com/rails/rails/activerecord/test/activejob/destroy_association_async_test.rb:27:in `<top (required)>'
  /Users/yahonda/.rbenv/versions/3.3.1/lib/ruby/3.3.0/bundled_gems.rb:74:in `require'
  /Users/yahonda/.rbenv/versions/3.3.1/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
  /Users/yahonda/src/github.com/rails/rails/railties/lib/rails/test_unit/runner.rb:61:in `block in load_tests'
  /Users/yahonda/src/github.com/rails/rails/railties/lib/rails/test_unit/runner.rb:60:in `each'
  /Users/yahonda/src/github.com/rails/rails/railties/lib/rails/test_unit/runner.rb:60:in `load_tests'
  /Users/yahonda/src/github.com/rails/rails/railties/lib/rails/test_unit/runner.rb:52:in `run'
  /Users/yahonda/src/github.com/rails/rails/activerecord/test/support/tools.rb:37:in `<top (required)>'
  bin/test:11:in `require_relative'
  bin/test:11:in `<main>'
DEPRECATION WARNING: Setting `query_constraints:` option on `Cpk::ChapterDestroyAsync.belongs_to :book` is deprecated. To maintain current behavior, use the `foreign_key` option instead. (called from new at /Users/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/reflection.rb:19)
/Users/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/reflection.rb:19:in `new'
  /Users/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/reflection.rb:19:in `create'
  /Users/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/associations/builder/association.rb:50:in `create_reflection'
  /Users/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/associations/builder/association.rb:32:in `build'
  /Users/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/associations.rb:1910:in `belongs_to'
  /Users/yahonda/src/github.com/rails/rails/activerecord/test/models/cpk/chapter_destroy_async.rb:8:in `<class:ChapterDestroyAsync>'
  /Users/yahonda/src/github.com/rails/rails/activerecord/test/models/cpk/chapter_destroy_async.rb:4:in `<module:Cpk>'
  /Users/yahonda/src/github.com/rails/rails/activerecord/test/models/cpk/chapter_destroy_async.rb:3:in `<top (required)>'
  /Users/yahonda/.rbenv/versions/3.3.1/lib/ruby/3.3.0/bundled_gems.rb:74:in `require'
  /Users/yahonda/.rbenv/versions/3.3.1/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
  /Users/yahonda/src/github.com/rails/rails/activerecord/test/activejob/destroy_association_async_test.rb:28:in `<top (required)>'
  /Users/yahonda/.rbenv/versions/3.3.1/lib/ruby/3.3.0/bundled_gems.rb:74:in `require'
  /Users/yahonda/.rbenv/versions/3.3.1/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
  /Users/yahonda/src/github.com/rails/rails/railties/lib/rails/test_unit/runner.rb:61:in `block in load_tests'
  /Users/yahonda/src/github.com/rails/rails/railties/lib/rails/test_unit/runner.rb:60:in `each'
  /Users/yahonda/src/github.com/rails/rails/railties/lib/rails/test_unit/runner.rb:60:in `load_tests'
  /Users/yahonda/src/github.com/rails/rails/railties/lib/rails/test_unit/runner.rb:52:in `run'
  /Users/yahonda/src/github.com/rails/rails/activerecord/test/support/tools.rb:37:in `<top (required)>'
  bin/test:11:in `require_relative'
  bin/test:11:in `<main>'
Run options: --seed 24461

....................

Finished in 0.199597s, 100.2019 runs/s, 370.7471 assertions/s.
20 runs, 74 assertions, 0 failures, 0 errors, 0 skips
%
```

* Suppress RuboCop output when there are no offenses in code generation

Follow up #51782.

> But it's overkill for the default case where people use the default style guide,
> and it introduces both delay and console output as a cost.

When there are no offenses with the coding style generated by code generation,
outputting RuboCop results to the console was redundant.
Since RuboCop has `--format=quiet` option that suppresses console output
when there are no offenses, this PR adds that option:
https://docs.rubocop.org/rubocop/1.63/formatters.html#quiet-formatter

While this PR doesn't resolve any added execution speed by RuboCop,
the frequency of using the generator is not high within the development flow.
Therefore, depending on the execution speed, it might be possible to uncomment #51782,
but this PR respects the defaults in #51782 and doesn't address that.

* Enable Lint/Debugger

This will prevent issues like be0cb4e8f9, which would have resulted in:

```
guides/rails_guides/generator.rb:16:1: W: Lint/Debugger: Remove debugger entry point require "debug".
require "debug"
^^^^^^^^^^^^^^^
```

Disabled the cop in actionpack tests for screenshot_helper and page_dump_helper:

```
actionpack/test/controller/integration_test.rb:1369:9: W: Lint/Debugger: Remove debugger entry point save_and_open_page.
        save_and_open_page
        ^^^^^^^^^^^^^^^^^^
actionpack/test/controller/integration_test.rb:1381:11: W: Lint/Debugger: Remove debugger entry point save_and_open_page.
          save_and_open_page
          ^^^^^^^^^^^^^^^^^^
actionpack/test/controller/integration_test.rb:1391:39: W: Lint/Debugger: Remove debugger entry point save_and_open_page.
      assert_raise(InvalidResponse) { save_and_open_page }
                                      ^^^^^^^^^^^^^^^^^^
```

```
actionpack/lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb:111:13: W: Lint/Debugger: Remove debugger entry point page.save_page(absolute_html_path).
            page.save_page(absolute_html_path)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
actionpack/lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb:115:13: W: Lint/Debugger: Remove debugger entry point page.save_screenshot(absolute_image
_path).
            page.save_screenshot(absolute_image_path)
```

The DebuggerRequires option was first available in rubocop v1.63.0, in rubocop/rubocop#12766.

* Support `duration` in `ActiveSupport::XmlMini`

* Development of Rails 8.0 starts now

🎉

* Reapply "Rails 8 will target Ruby 3.3+ only for new apps"

This reverts commit 64ab211892.

* Clean CHANGELOG for 8.0

* Fix rubocop

See https://github.com/rubocop/rubocop/issues/12898 for the issue.

* Add name to DevContainer compose file

Currently when you generate a project the compose.yaml generated
file does not include the top-level name property. Not having this
top-level name property makes all containers / volumes started by
devcontainer to be prepended with the folder name, which is
`devcontainer` in the case of the .devcontainer/compose.yml` file.

This is ok if you run only one project with devcontainer but starts
to get problem if you run multiple projects. If you have one project
that runs on postgresql 15 and a new one that runs on postgresql 16 it
will fail to boot the postgresql container because both devcontainers is
using the same volume: `devcontainer_postgres-data`.

This commit fixes this by setting the top-lavel name property with
the project name, which will make the containers and volumes to be
prepended with the project name and not with `devcontainer`.

* Remove support for oracle, sqlserver and JRuby specific database adapters from the new and db:system:change commands. The supported options are sqlite3, mysql, postgresql and trilogy.

* Refactoring Database generators

Extract all the DB information (gems, dockerfile packages, devcontainer etc.) into an object. This let's us remove the growing number of case statements in this code.

* This will be released in 7.2

* Merge pull request #51766 from Shopify/revert-actionable-errors-retry

Revert "Merge pull request #50941 from andrewn617/actionable-cli"

* Point user to devcontainer for containerized dev environment

* Add Highlights section in the Rails 7.1 release notes

* Fix `ActiveRecord::Relation#touch_all` with custom attribute aliased as attribute for update

* Remove jruby and oracle related gems from Gemfile

We are only know goign to support mysql2, trilogy, postgresql and sqlite3
adapters in Rails.

* Add Kamal by default to Rails 8 (#51798)

* Add Kamal by default

* Excess CR

* Add Thruster for testing

* Update comment to reflect shrunken responsibilities

* Use latest Thruster

---------

Co-authored-by: Sampat Badhe <sampatbadhe@gmail.com>
Co-authored-by: Gannon McGibbon <gannon.mcgibbon@gmail.com>
Co-authored-by: fatkodima <fatkodima123@gmail.com>
Co-authored-by: Rafael Mendonça França <rafael@rubyonrails.org>
Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
Co-authored-by: Akhil G Krishnan <akhilgkrishnan4u@gmail.com>
Co-authored-by: Chedli Bourguiba <chaadow@users.noreply.github.com>
Co-authored-by: Yasuo Honda <yasuo.honda@gmail.com>
Co-authored-by: Koichi ITO <koic.ito@gmail.com>
Co-authored-by: zzak <zzakscott@gmail.com>
Co-authored-by: heka1024 <heka1024@gmail.com>
Co-authored-by: Cadu Ribeiro <mail@cadu.dev>
Co-authored-by: Andrew Novoselac <andrew.novoselac@shopify.com>
2024-08-06 17:39:01 +02:00
r7kamura 33baa0704f Declare Active Support dependency on securerandom >= 0.3
It's a very small gem, might as well declare it rather than
check which version we have an do different things.

Co-Authored-By: Jean Boussier <jean.boussier@gmail.com>
2024-08-01 08:41:12 +02:00
Rafael Mendonça França 4c9cfc4d75
Upgrade sprockets-rails to remove deprecations 2024-07-31 20:28:03 +00:00
Jean Boussier 8af4d3594d Update ruby-vips to fix a method redefinition warning
Ref: https://github.com/libvips/ruby-vips/pull/388
2024-07-22 09:18:45 +02:00
Hartley McGuire 564e427c05
Remove obsolete Logger severity predicates
The Logger severity predicates have existed since the [introduction of
Logger][1]. However, these methods only looked at the `level` instance
variable, so they did not work with the [thread safe implementation][2]
of temporary log levels in Rails.

Since then, the Logger severity predicates were [updated][3] to use the
`level` method instead of the instance variable, making Rails' severity
predicate overrides obsolete.

This commit removes Rails' custom severity predicates in favor of
Logger's implementation, since the new implementation was released in
Logger 1.4.2 and came bundled with Ruby 2.7.0.

[1]: ruby/logger@525b58d97e
[2]: rails/rails@629efb6057
[3]: ruby/logger@7365c995bf
2024-06-26 21:19:12 +00:00
Yasuo Honda 1b905edd2e Support selenium-webdriver 4.22.0 that enables CDP in Firefox by default
This pull request supports selenium-webdriver 4.22.0 that enables CDP in Firefox by default.
because Firefox 129 deprecates Chrome DevTools Protocol (CDP).
selenium-webdriver 4.22.0 enables CDP explicitly by adding "remote.active-protocols"=>3 .

- Steps to reproduce and this commit addresses these failures.
```ruby
$ bundle update selenium-webdriver --conservative
$ git diff main ../Gemfile.lock
diff --git a/Gemfile.lock b/Gemfile.lock
index 4e1c049ac0..e05f4b3b3c 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -512,8 +512,9 @@ GEM
       google-protobuf (~> 3.25)
     sass-embedded (1.69.6-x86_64-linux-gnu)
       google-protobuf (~> 3.25)
-    selenium-webdriver (4.20.1)
+    selenium-webdriver (4.22.0)
       base64 (~> 0.2)
+      logger (~> 1.4)
       rexml (~> 3.2, >= 3.2.5)
       rubyzip (>= 1.2.2, < 3.0)
       websocket (~> 1.0)
$ cd actionpack
$ bin/test test/dispatch/system_testing/driver_test.rb test/dispatch/system_testing/driver_test.rb
Running 18 tests in a single process (parallelization threshold is 50)
Run options: --seed 58668

.....F

Failure:
DriverTest#test_define_extra_capabilities_using_firefox [test/dispatch/system_testing/driver_test.rb:127]:
--- expected
+++ actual
@@ -1 +1 @@
-{"moz:firefoxOptions"=>{"args"=>["--host=127.0.0.1"], "prefs"=>{"browser.startup.homepage"=>"http://www.seleniumhq.com/"}}, "browserName"=>"firefox"}
+{"moz:firefoxOptions"=>{"args"=>["--host=127.0.0.1"], "prefs"=>{"remote.active-protocols"=>3, "browser.startup.homepage"=>"http://www.seleniumhq.com/"}}, "browserName"=>"firefox"}

bin/test test/dispatch/system_testing/driver_test.rb:113

.F

Failure:
DriverTest#test_define_extra_capabilities_using_headless_firefox [test/dispatch/system_testing/driver_test.rb:144]:
--- expected
+++ actual
@@ -1 +1 @@
-{"moz:firefoxOptions"=>{"args"=>["-headless", "--host=127.0.0.1"], "prefs"=>{"browser.startup.homepage"=>"http://www.seleniumhq.com/"}}, "browserName"=>"firefox"}
+{"moz:firefoxOptions"=>{"args"=>["-headless", "--host=127.0.0.1"], "prefs"=>{"remote.active-protocols"=>3, "browser.startup.homepage"=>"http://www.seleniumhq.com/"}}, "browserName"=>"firefox"}

bin/test test/dispatch/system_testing/driver_test.rb:130

..........

Finished in 0.007717s, 2332.3654 runs/s, 4794.3066 assertions/s.
18 runs, 37 assertions, 2 failures, 0 errors, 0 skips
```

- Planned Deprecation of CDP in Firefox
https://groups.google.com/a/mozilla.org/g/dev-platform/c/Z6Qu3ZT1MJ0?pli=1

- Add preference to enable CDP in Firefox by default
https://github.com/SeleniumHQ/selenium/pull/14091

- [rb] Add logger gem as a runtime dependency #14082
https://github.com/SeleniumHQ/selenium/pull/14082
2024-06-21 09:57:50 +09:00
Rafael Mendonça França 3342f13d12
Move the rewind code closer to the reason why we need to rewind
We only need to rewind because we call `read_body_stream`. Since
that method is only called in one place, move the rewing to inside it.
2024-06-14 18:56:36 +00:00
Yasuo Honda e3a28aa3dc Bump stringio to 3.1.1
This commit addresses this CI failure:
https://buildkite.com/rails/rails/builds/108372#0190131e-ee1a-420b-8355-9eb08eb5c29a

* Without this commit
```ruby
$ ruby -v
ruby 3.2.4 (2024-04-23 revision af471c0e01) [x86_64-linux]
$ cd guides/bug_report_templates
$ ruby action_controller.rb
... snip ...
Installing rails 7.1.3.4
/home/yahonda/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/bundler-2.5.4/lib/bundler/runtime.rb:304:in `check_for_activated_spec!': You have already activated stringio 3.1.0, but your Gemfile requires stringio 3.1.1. Prepending `bundle exec` to your command may solve this. (Gem::LoadError)
    from /home/yahonda/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/bundler-2.5.4/lib/bundler/runtime.rb:25:in `block in setup'
    from /home/yahonda/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/bundler-2.5.4/lib/bundler/spec_set.rb:191:in `each'
    from /home/yahonda/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/bundler-2.5.4/lib/bundler/spec_set.rb:191:in `each'
    from /home/yahonda/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/bundler-2.5.4/lib/bundler/runtime.rb:24:in `map'
    from /home/yahonda/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/bundler-2.5.4/lib/bundler/runtime.rb:24:in `setup'
    from /home/yahonda/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/bundler-2.5.4/lib/bundler/inline.rb:66:in `block (2 levels) in gemfile'
    from /home/yahonda/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/bundler-2.5.4/lib/bundler/settings.rb:158:in `temporary'
    from /home/yahonda/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/bundler-2.5.4/lib/bundler/inline.rb:51:in `block in gemfile'
    from /home/yahonda/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/bundler-2.5.4/lib/bundler.rb:403:in `block in with_unbundled_env'
    from /home/yahonda/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/bundler-2.5.4/lib/bundler.rb:658:in `with_env'
    from /home/yahonda/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/bundler-2.5.4/lib/bundler.rb:403:in `with_unbundled_env'
    from /home/yahonda/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/bundler-2.5.4/lib/bundler/inline.rb:42:in `gemfile'
    from action_controller.rb:5:in `<main>'
$
```
2024-06-14 08:24:47 +09:00
Jean Boussier a56f5e5aae Update sprockets-rails to 3.5.1
Ref: https://github.com/rails/sprockets-rails/issues/524
2024-06-07 11:29:32 +02:00
Yasuo Honda a76e272794 Pin `sprockets-rails` version to 3.4.2 or lower
This commit pins `sprockets-rails` version to 3.4.2
until https://github.com/rails/sprockets-rails/issues/524 is fixed.

Refer to https://github.com/rails/rails/issues/52038
2024-06-07 09:37:50 +09:00
Earlopain d9adf17fbe
Add an explicit dependency on the `logger` gem
This is getting the same treatment as `base64`, `mutex_m`, etc.
In Ruby 3.4 it will start to warn: d7e558e3c4

Remoce require from two files that don't seem to need it
2024-06-05 13:53:33 +02:00
Jean Boussier f719787c58 Restore automatic detection of processor count in default puma config
It has to be reverted because the previous implementation wasn't
cgroup aware so it would often start way too many processes on various
shared hosting platforms.

Thanks to https://github.com/ruby-concurrency/concurrent-ruby/pull/1038
concurrent-ruby 1.3 now offer a cgroups aware method to detect how
many processors we can actually use.
2024-05-29 16:46:51 +02:00
David Heinemeier Hansson 1b3fc3c82e
Change asset pipeline default to Propshaft in Rails 8 (#51799)
* Change asset pipeline default to Propshaft

* Use :all for stylesheets when propshaft is active

* Switch to using propshaft as the default (still need to find a way to tests against sprockets too)

* Fix tests that rely on sprockets being used

* Fix Propshaft tests (#51913)

* Update railties/test/generators/shared_generator_tests.rb

Co-authored-by: Lázaro Nixon <lazaronixon@hotmail.com>

---------

Co-authored-by: Lázaro Nixon <lazaronixon@hotmail.com>
2024-05-25 20:48:35 -07:00
zzak 467e8fe124
Use released version of RDoc v6.7.0
Follow up to #51876

Co-authored-by: Hartley McGuire <skipkayhil@gmail.com>
2024-05-24 06:46:19 +09:00
Earlopain 720c7d14dd
Revert RuboCop workaround
Was done in 3e08223ece to work around a RuboCop bug.
The newest version has this fixed.
2024-05-23 14:56:53 +02:00
Rafael Mendonça França 486bb99480
Use rails fork for rdoc gem
This allow us to actually get a working gem from github.
2024-05-22 20:06:10 +00:00
Rafael Mendonça França b504498c97
Upgrade rdoc to get https://github.com/ruby/rdoc/pull/1096 2024-05-22 18:57:08 +00:00
zzak f12bbb61d1
Revert "Pin minitest version to 5.21" 2024-05-15 18:05:43 -04:00
Rafael Mendonça França af33bef906
Install kamal as a development gem
We need this gem to be able to run the generators test.

Closes #51816.
2024-05-14 18:48:55 +00:00
Andrew Novoselac 4c243279ac Fix outdated Gemfile.lock
rails/rails@8eae753 removed jruby and oracle gems from the Gemfile but did not update Gemfile.lock
2024-05-14 12:36:55 -04:00
Rafael Mendonça França 37fd0e7fe4
Development of Rails 8.0 starts now
🎉
2024-05-13 16:45:20 +00:00
zzak 833c1c9a4d
Enable Lint/Debugger
This will prevent issues like be0cb4e8f9, which would have resulted in:

```
guides/rails_guides/generator.rb:16:1: W: Lint/Debugger: Remove debugger entry point require "debug".
require "debug"
^^^^^^^^^^^^^^^
```

Disabled the cop in actionpack tests for screenshot_helper and page_dump_helper:

```
actionpack/test/controller/integration_test.rb:1369:9: W: Lint/Debugger: Remove debugger entry point save_and_open_page.
        save_and_open_page
        ^^^^^^^^^^^^^^^^^^
actionpack/test/controller/integration_test.rb:1381:11: W: Lint/Debugger: Remove debugger entry point save_and_open_page.
          save_and_open_page
          ^^^^^^^^^^^^^^^^^^
actionpack/test/controller/integration_test.rb:1391:39: W: Lint/Debugger: Remove debugger entry point save_and_open_page.
      assert_raise(InvalidResponse) { save_and_open_page }
                                      ^^^^^^^^^^^^^^^^^^
```

```
actionpack/lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb:111:13: W: Lint/Debugger: Remove debugger entry point page.save_page(absolute_html_path).
            page.save_page(absolute_html_path)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
actionpack/lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb:115:13: W: Lint/Debugger: Remove debugger entry point page.save_screenshot(absolute_image
_path).
            page.save_screenshot(absolute_image_path)
```

The DebuggerRequires option was first available in rubocop v1.63.0, in rubocop/rubocop#12766.
2024-05-13 13:41:18 +09:00
Stan Lo 4c1f7d8328
Register Rails console commands/helpers with its latest extension APIs
This will greatly increase the visibility of Rails console commands and helpers,
and stop rely on IRB's internal components.

Extension API reference: https://github.com/ruby/irb/blob/master/EXTEND_IRB.md

And because we need to create new classes to use the new APIs, I also
moved all the IRB-specific code to a new file, `irb_console.rb`.

Use IRB.conf[:BACKTRACE_FILTER] for backtrace filtering in console

This change uses the new `IRB.conf[:BACKTRACE_FILTER]` to inject the backtrace
filtering logic into IRB. This avoids the need to patch IRB's internal
WorkSpace class.

Update changelog
2024-05-01 22:14:53 +00:00
Rafael Mendonça França b3a214d636
Upgrade prism 2024-05-01 18:45:48 +00:00
Earlopain 6233309298
Resolve deprecation warning in latest `selenium-webdriver`
```
2024-04-26 09:36:45 INFO Selenium [:logger_info] Details on how to use and modify Selenium logger:
  https://selenium.dev/documentation/webdriver/troubleshooting/logging

2024-04-26 09:36:45 WARN Selenium [DEPRECATION] DriverFinder.path(options, service_class) is deprecated. Use DriverFinder.new(options, service).driver_path instead.
```
2024-04-26 12:28:42 +02:00
Yasuo Honda 055377da43 Skip `selenium-webdriver` version 4.20.0
This commit will not install the selenium-webdriver` version 4.20.0
because `Selenium::WebDriver::DriverFinder.path` was dropped in `selenium-webdriver` 4.20.0 that was not intentional.
It will be restored once the newer version of `selenium-webdriver` that includes https://github.com/SeleniumHQ/selenium/pull/13877 .

Fix #51658
2024-04-26 09:12:52 +09:00
Joé Dupuis 7f9ce6f62b
Add `save_and_open_page` helper to IntegrationTest
`save_and_open_page` is a capybara helper that lets developers
inspect the status of the page at any given point in their
test. This is helpful when trying to keep a short feedback loop while
working on a test.

This change adds a similar helper with matching signature to
integration tests.
2024-04-18 20:44:40 +00:00
Mike Dalessio fd1c635d2f Allow sqlite3 to float to version 2 2024-04-18 11:34:24 +02:00
Carlos Antonio da Silva 0601929486
Merge pull request #51440 from CodingItWrong/libmysql2-fix-install-error
Bump mysql2 to fix build error with mysql-client 8.3
2024-04-17 13:56:48 -03:00
fatkodima 041de49399 Remove usage of `OpenStruct` 2024-04-09 21:35:08 +03:00
Rafael Mendonça França 967fc62a94
Merge pull request #51468 from Earlopain/remove-ostruct-requires
Add `ostruct` to the gemfile
2024-04-02 16:08:51 -03:00
Earlopain d902f4487e
Add `ostruct` to the gemfile
Ruby 3.5 will warn, 3.6 will raise.

This is a test-only dependency, framework code itself doesn't use it (enforced by RuboCop)
2024-04-02 13:09:00 +02:00
Josh Justice 6978cda75c Bump mysql2 to fix build error with mysql-client 8.3
https://github.com/brianmario/mysql2/issues/1346
https://github.com/brianmario/mysql2/releases/tag/0.5.6
2024-03-28 15:02:40 -04:00
Josh Justice 1641f119bd Bump libxml-ruby to fix build failure
https://github.com/xml4r/libxml-ruby/issues/213
c7933a7f84
2024-03-28 15:00:17 -04:00
Jeremy Daer 4f0f3448cd Marcel 1.0.4
Update tests to clarify content type detection heuristic after exposing
a regression in Marcel 1.0.3 that wasn't caught by its test suite:

1. magic bytes
2. declared content type, unless it's binary
3. filename extension
4. binary: application/octet-stream
2024-03-01 09:29:24 -08:00
Jean Boussier 3e7ba58439 Delete `EncryptionPerformanceTest`
On my machine, running the whole Active Record test suite takes
`88` seconds, and `40` of these are spent in encryption tests.

Some of them also happen to flake because of random blips.

I appreciate the care that has been put into ensuring the overhead
of encrption was reasonable, but I don't think these tests justify
their cost.
2024-02-06 18:05:31 +01:00
Yasuo Honda 0c9329161c Pin minitest version to 5.21
Managed to reproduce CI failure at https://buildkite.com/rails/rails-nightly/builds/133#018d7bb8-8a32-4978-8e36-d7cb9b067813/1196-1204 . It would also reproduce against the released versions of Ruby because this is triggered by minitest v5.22.0 change. ebb468c81c

To avoid all of railties CI failures, pin minitest version to 5.21 tentatively.

* Steps to reproduce
```ruby
git clone https://github.com/rails/rails
cd rails
rm Gemfile.lock
bundle install
cd railties
bin/test test/application/test_runner_test.rb -n test_system_tests_are_not_run_with_the_default_test_command
```

* Expected behavior
It should pass.

* Actual behavior
```ruby
$ bin/test test/application/test_runner_test.rb -n test_system_tests_are_not_run_with_the_default_test_command
Run options: -n test_system_tests_are_not_run_with_the_default_test_command --seed 14574

F

Failure:
ApplicationTests::TestRunnerTest#test_system_tests_are_not_run_with_the_default_test_command [test/application/test_runner_test.rb:1191]:
Expected /0\ runs,\ 0\ assertions,\ 0\ failures,\ 0\ errors,\ 0\ skips/ to match "Nothing ran for filter: \nRunning 0 tests in a single process (parallelization threshold is 50)\nRun options: --seed 45713\n\n# Running:\n\n".

bin/test test/application/test_runner_test.rb:1179

Finished in 9.982314s, 0.1002 runs/s, 0.2004 assertions/s.
1 runs, 2 assertions, 1 failures, 0 errors, 0 skips
$
```
2024-02-06 10:52:58 +09:00
Yasuo Honda baae73c074 Use `httpclient` to run "Daily build with Ruby head"
This pull request addresses "Daily build with Ruby head" failure https://buildkite.com/rails/rails-nightly/builds/101#018d5285-b4de-4072-b7d3-61c19f21347a

Action Mailbox needs `webmock` which depends on `httpclient`.
`httpclient` master branch that added `mutex_m` as a dependency via https://github.com/nahi/httpclient/pull/455 to support Ruby 3.4.0dev.

```ruby
cd actionmailbox
bundle exec rake test
```

```ruby
... snip ...
/home/yahonda/.rbenv/versions/ruby-dev/lib/ruby/gems/3.4.0+0/gems/webmock-3.19.1/lib/webmock/http_lib_adapters/httpclient_adapter.rb:234:in `alias_method': undefined method `do_get_block' for class `WebMockHTTPClient' (NameError)

    alias_method :do_get_block_without_webmock, :do_get_block
    ^^^^^^^^^^^^
        from /home/yahonda/.rbenv/versions/ruby-dev/lib/ruby/gems/3.4.0+0/gems/webmock-3.19.1/lib/webmock/http_lib_adapters/httpclient_adapter.rb:234:in `<class:WebMockHTTPClient>'
        from /home/yahonda/.rbenv/versions/ruby-dev/lib/ruby/gems/3.4.0+0/gems/webmock-3.19.1/lib/webmock/http_lib_adapters/httpclient_adapter.rb:233:in `<top (required)>'
        from /home/yahonda/.rbenv/versions/ruby-dev/lib/ruby/gems/3.4.0+0/gems/webmock-3.19.1/lib/webmock.rb:52:in `require_relative'
        from /home/yahonda/.rbenv/versions/ruby-dev/lib/ruby/gems/3.4.0+0/gems/webmock-3.19.1/lib/webmock.rb:52:in `<top (required)>'
        from <internal:/home/yahonda/.rbenv/versions/ruby-dev/lib/ruby/3.4.0+0/rubygems/core_ext/kernel_require.rb>:37:in `require'
        from <internal:/home/yahonda/.rbenv/versions/ruby-dev/lib/ruby/3.4.0+0/rubygems/core_ext/kernel_require.rb>:37:in `require'
        from /home/yahonda/.rbenv/versions/ruby-dev/lib/ruby/3.4.0+0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
        from /home/yahonda/.rbenv/versions/ruby-dev/lib/ruby/gems/3.4.0+0/gems/zeitwerk-2.6.12/lib/zeitwerk/kernel.rb:38:in `require'
        from /home/yahonda/.rbenv/versions/ruby-dev/lib/ruby/3.4.0+0/bundler/runtime.rb:60:in `block (2 levels) in require'
        from <internal:array>:52:in `each'
        from /home/yahonda/.rbenv/versions/ruby-dev/lib/ruby/3.4.0+0/bundler/runtime.rb:55:in `block in require'
        from <internal:array>:52:in `each'
        from /home/yahonda/.rbenv/versions/ruby-dev/lib/ruby/3.4.0+0/bundler/runtime.rb:44:in `require'
        from /home/yahonda/.rbenv/versions/ruby-dev/lib/ruby/3.4.0+0/bundler.rb:187:in `require'
        from /home/yahonda/src/github.com/rails/rails/actionmailbox/test/dummy/config/application.rb:7:in `<top (required)>'
        from /home/yahonda/src/github.com/rails/rails/actionmailbox/test/dummy/config/environment.rb:2:in `require_relative'
        from /home/yahonda/src/github.com/rails/rails/actionmailbox/test/dummy/config/environment.rb:2:in `<top (required)>'
        from /home/yahonda/src/github.com/rails/rails/actionmailbox/test/test_helper.rb:8:in `require_relative'
        from /home/yahonda/src/github.com/rails/rails/actionmailbox/test/test_helper.rb:8:in `<top (required)>'
        from /home/yahonda/.rbenv/versions/ruby-dev/lib/ruby/3.4.0+0/bundled_gems.rb:74:in `require'
        from /home/yahonda/.rbenv/versions/ruby-dev/lib/ruby/3.4.0+0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
        from /home/yahonda/src/github.com/rails/rails/actionmailbox/test/controllers/ingresses/mailgun/inbound_emails_controller_test.rb:3:in `<top (required)>'
        from /home/yahonda/.rbenv/versions/ruby-dev/lib/ruby/3.4.0+0/bundled_gems.rb:74:in `require'
        from /home/yahonda/.rbenv/versions/ruby-dev/lib/ruby/3.4.0+0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
        from /home/yahonda/.rbenv/versions/ruby-dev/lib/ruby/gems/3.4.0+0/gems/rake-13.1.0/lib/rake/rake_test_loader.rb:21:in `block in <main>'
        from /home/yahonda/.rbenv/versions/ruby-dev/lib/ruby/gems/3.4.0+0/gems/rake-13.1.0/lib/rake/rake_test_loader.rb:6:in `select'
        from /home/yahonda/.rbenv/versions/ruby-dev/lib/ruby/gems/3.4.0+0/gems/rake-13.1.0/lib/rake/rake_test_loader.rb:6:in `<main>'
rake aborted!
Command failed with status (1): [ruby -w -I"lib:test" /home/yahonda/.rbenv/versions/ruby-dev/lib/ruby/gems/3.4.0+0/gems/rake-13.1.0/lib/rake/rake_test_loader.rb "test/controllers/ingresses/mailgun/inbound_emails_controller_test.rb" "test/controllers/ingresses/mandrill/inbound_emails_controller_test.rb" "test/controllers/ingresses/postmark/inbound_emails_controller_test.rb" "test/controllers/ingresses/relay/inbound_emails_controller_test.rb" "test/controllers/ingresses/sendgrid/inbound_emails_controller_test.rb" "test/controllers/rails/action_mailbox/inbound_emails_controller_test.rb" "test/generators/mailbox_generator_test.rb" "test/jobs/incineration_job_test.rb" "test/migrations_test.rb" "test/models/table_name_test.rb" "test/unit/inbound_email/incineration_test.rb" "test/unit/inbound_email/message_id_test.rb" "test/unit/inbound_email_test.rb" "test/unit/mail_ext/address_equality_test.rb" "test/unit/mail_ext/address_wrapping_test.rb" "test/unit/mail_ext/addresses_test.rb" "test/unit/mailbox/bouncing_test.rb" "test/unit/mailbox/callbacks_test.rb" "test/unit/mailbox/notifications_test.rb" "test/unit/mailbox/routing_test.rb" "test/unit/mailbox/state_test.rb" "test/unit/relayer_test.rb" "test/unit/router_test.rb" "test/unit/test_helper_test.rb" ]
<internal:array>:52:in `each'
<internal:array>:52:in `each'
/home/yahonda/.rbenv/versions/ruby-dev/bin/bundle:25:in `load'
/home/yahonda/.rbenv/versions/ruby-dev/bin/bundle:25:in `<main>'
Tasks: TOP => test
(See full trace by running task with --trace)
$
```
2024-01-29 21:37:10 +09:00
Hartley McGuire 0041af4c94
Ensure all RubyTracker RenderParsers are tested
Previously, only the PrismRenderParser or RipperRenderParser would be
tested depending on if the Prism gem is available. This meant that
PrismRenderParser was being tested on Ruby 3.3 and RipperRenderParser
was tested on Ruby < 3.3. Additionally, if someone were to add prism to
the rails/rails Gemfile because they wrote a tool that uses it then the
RipperRenderParser would end up completely untested.

This commit is a small refactor to enable testing both RenderParsers in
all Ruby versions so that the prism gem can be added to the Gemfile.
2024-01-24 19:16:59 -05:00
Daniel Colson 6616770ec9
Translate Trilogy syscall errors as conn failed
At GitHub we get a fair number of Trilogy `ETIMEDOUT` errors (for known
reasons that we might be able to improve somewhat, but I doubt we'll
make them go away entirely). These are very much retryable network
errors, so it'd be handy if these `ETIMEDOUT` errors were translated to
`ConnectionFailed` instead of `StatementInvalid`, making them
`retryable_connection_error`s.

ed2bc92b82/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb (L1077)

We're already translating `ECONNRESET` (via matching on the error
message) and `EPIPE` to `ConnectionFailed`. Rather than adding another
case, this commit treats all of the Trilogy `SystemCallError` subclasses
as `ConnectionFailed`.

This requires bumping trilogy 2.7 so we can get
https://github.com/trilogy-libraries/trilogy/pull/143
2024-01-23 16:20:02 -05:00
Petrik 0797273427 Upgrade to latest SDoc for performance
The latest version of SDoc fixes a performance regression.
This version is at least twice as fast.
https://github.com/rails/sdoc/pull/363
2024-01-22 19:43:03 +01:00
Jean Boussier d839ddb71a Refactor `ActionController::RateLimiting` to use `AS::Cache`
Given that the limiter implementation provided by Kredis is a simple
increment with a limit, all `ActiveSupport::Cache` already provide that
same capability, with a wide range of backing stores, and not just Redis.

This even allow to use SolidCache has a backend if you so desire.

If we feel particularly fancy, we could also accept a more generic
limiter interface to better allow users to swap the implementation
for better algorithms such as leaky-bucket etc.
2024-01-17 15:40:49 +01:00
Dorian Marié 420b19a255 Upgrade minitest from 5.20.0 to 5.21.1 to fix mutex_m deprecation 2024-01-12 16:49:20 +01:00
Jean Boussier dcd13fc8ee Relock Gemfile on Ruby 3.3.0
Google hasn't shipped precompile binaries
for Ruby 3.3.0 yet, so it confuses bundler...
2024-01-09 23:58:10 +01:00
Rafael Mendonça França b1479e412d
Remove redundant version constraint on mail gem 2024-01-09 19:41:52 +00:00
Earlopain 45f64f5a0a
Remove workaround for `mail` gem dependencies
d9d8dcc6ba
https://github.com/rails/rails/pull/44083

Remove backwards compat workaround for versions earlier than 2.8.0
2024-01-09 13:25:36 +01:00