Commit Graph

90613 Commits

Author SHA1 Message Date
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
Xavier Noria
cf26c54829
Merge pull request #50902 from rails/docs/add_autoload_paths_to_load_path
Remove add_autoload_paths_to_load_path docs from autoloading guide
2024-01-28 19:16:27 +01:00
Xavier Noria
d823faa67b Remove add_autoload_paths_to_load_path docs from autoloading guide 2024-01-28 18:05:58 +01:00
Petrik de Heus
56fd69e9bc
Merge pull request #50697 from avanderpluijm/patch-1
docs: improve runner documentation [ci skip]
2024-01-28 15:51:41 +01:00
Petrik de Heus
c15658c95c
Merge pull request #50896 from yin0110/fix/button_to_explanation_improve
Improve ActionView::Helpers::UrlHelper button_to explanation [ci-skip]
2024-01-28 15:50:10 +01:00
Yin
fd64d16b32 [docs] improve button_to explanation 2024-01-28 22:17:07 +08:00
Rafael Mendonça França
351a8d9bc9
Merge pull request #50882 from sato11/rdoc-main-page
Prevent rdoc task from excluding the main page
2024-01-26 13:31:53 -05:00
Rafael Mendonça França
91f4fdce2a
Merge pull request #50891 from composerinteralia/trilogy-error-translate
Clean up trilogy error translation
2024-01-26 13:27:12 -05:00
Daniel Colson
adfdbf8c29
Clean up trilogy error translation
This commit makes a few changes to our trilogy error translation:

* https://github.com/trilogy-libraries/trilogy/pull/118 introduced
  `Trilogy::EOFError` which we can use instead of matching on
  `TRILOGY_CLOSED_CONNECTION`.
* https://github.com/trilogy-libraries/trilogy/pull/15 introduced
  `Trilogy::ConnectionClosed`, which inherits from `IOError` for
  backwards compatibility. As far as I can tell that's the only
  `IOError` trilogy can raise, so this commit rescues the
  trilogy-specific error instead.
* As far as I can tell Trilogy does not raise `SocketError`, so don't
  bother translating that
* Don't treat TRILOGY_UNEXPECTED_PACKET as a connection error. If we get
  this, it's probably a bug in trilogy that we should fix. I'd like to
  eventually get rid of TRILOGY_INVALID_SEQUENCE_ID too, but we're
  currently relying on it in a few tests (related to trilogy missing
  caching_sha2_password auth support, if I recall correctly)

I'm kinda hoping we'll eventually be able to simplify this to something
like:

```rb
if exception.is_a?(Trilogy::ConnectionError)
  ConnectionFailed.new(message, connection_pool: @pool)
else
  super
end
```

but we'd need more changes to trilogy before that is possible.
2024-01-26 12:59:10 -05:00
Junichi Sato
51e9074de2
Prevent rdoc task from excluding the main page
There was a bug where the main page becomes unable to be found
and this change ensures that it does not happen.

Closes https://github.com/rails/rails/issues/50871.
2024-01-26 15:05:24 +09:00
Rafael Mendonça França
68eade83c8
Merge pull request #50869 from skipkayhil/hm-test-all-ruby-trackers
Ensure all RubyTracker RenderParsers are tested
2024-01-25 19:05:42 -05:00
Rafael Mendonça França
bd66fc8805
Merge pull request #50877 from composerinteralia/move-server-shutdown-translation
Move server shutdown translation to abstract mysql adapter
2024-01-25 16:01:53 -05:00
Rafael Mendonça França
c6bd547ee8
Merge pull request #50864 from seanpdoyle/strict-loading-documentation
Mention Strict Locals in more documentation
2024-01-25 16:01:17 -05:00
Rafael Mendonça França
ce636e9f9f
Action Text documentation in now in Markdown 2024-01-25 20:47:14 +00:00
Petrik de Heus
3c3df4cea3
Merge pull request #50762 from p8/actiontext/document-associations-and-scopes
Document some ActionText methods [ci-skip]
2024-01-25 20:57:58 +01:00
Rafael Mendonça França
f4ef4a52d3
Use Ruby 3.3 in the devcontainer 2024-01-25 19:39:47 +00:00
Rafael Mendonça França
9a5c680e59
Merge pull request #50878 from djensenius/revert-help-on-unrecongized-commands
Revert help on unrecognized bare options
2024-01-25 14:36:36 -05:00
Rafael Mendonça França
7763d819b1
Merge pull request #50870 from skipkayhil/hm-add-rdoc-to-md
Add tools/rdoc-to-md script
2024-01-25 14:27:45 -05:00
Petrik de Heus
2edbf50218
Merge pull request #50851 from notapatch/pr-guides-active-record-querying-update
Update Guides: AR querying english text to match code behavior [ci-skip]
2024-01-25 20:27:15 +01:00
Lorenzo Zabot
349ce8dc2d docs: correct fixed-width font documentation 2024-01-25 20:20:10 +01:00
David Jensenius
49e9ec91cd
Revert help on unrecognized bare options 2024-01-25 13:56:37 -05:00
Daniel Colson
c616fe29be
Move server shutdown translation to abstract mysql
1053 is the server shutdown error code. We see these fairly often at
GitHub when, for example, shutting down Vitess vtage processes for
maintenance. Translating the error to `ConnectionFailed` allows us to
treat these as retryable connection error, so we can reconnect and hit a
new vtage process.

This is all true regardless of whether the adapter is trilogy or mysql2
or whatever, so this commit moves the translation out into the abstract
mysql adapter.
2024-01-25 12:31:46 -05:00
Jean Boussier
808b052572
Merge pull request #50845 from Shopify/fix-composite-primary-key-association-eager-load
Fix eager loading of composite primary key associations
2024-01-25 16:47:30 +01:00
Sean Doyle
6e1c2f7fbf Mention Strict Locals in more documentation
Motivation / Background
---

Strict Locals support was introduced in [#45727][] and announced as part
of the [7.1 Release][]. There are several mentions across the Guides,
but support is rarely mentioned in the API documentation.

Detail
----

Mention the template short identifier (the pathname, in most cases) as
part of the `ArgumentError` message.

This commit adds two test cases to ensure support for splatting
additional arguments, and for forbidding block and positional arguments.

It also makes mention of strict locals in more places, and links to the
guides.

[#45727]: https://github.com/rails/rails/pull/45727
[7.1 Release]: https://edgeguides.rubyonrails.org/7_1_release_notes.html#allow-templates-to-set-strict-locals
2024-01-25 10:14:44 -05:00
Edouard CHIN
39b0692851
Merge pull request #50817 from joshuay03/add-queue-with-priority-to-activejob-docs
[Docs] Add section on Queue Priority to `ActiveJob` docs
2024-01-25 15:32:09 +01:00
Jean Boussier
95bb5ccb99
Merge pull request #50872 from Shopify/delegate-anonymous-block
Improve Active Support delegation
2024-01-25 12:16:17 +01:00
Jean Boussier
8ec5219801 ActiveSupport::Delegation allow to specify the signature
When delegating known APIs, rather that to let Delegator try to
inspect the signature, or to fallback to `...`, we can directly
specify it.

This is both faster and make for nicer delegators that have
the right signature.
2024-01-25 11:51:01 +01:00
Jean Boussier
f760ccd171 ActiveSupport::Delegation optimize self.class delegation
Since `self.class` can't possible be `nil`, we can skip the
useless `nil` checks and generate more efficient code.
2024-01-25 11:51:00 +01:00
Jean Boussier
cc63348160 Replace some low value dynamic delegator by handcrafted ones
Dynamic delegation make sense when there is a long list of methods
etc. But for very simple cases, writing one or two methods by hand
is just clearer and more efficient.
2024-01-25 11:51:00 +01:00
Jean Boussier
bffe05f246 Module#delegate stop accepting the private as: parameter
The feature remains usable internally, but via `ActiveSupport::Delegation`,
this way we don't allow third party use.
2024-01-25 11:51:00 +01:00
Jean Boussier
6ee0041ed2 Refactor Module#delegate inside ActiveSupport::Delegation
This allow to support some extra private features without exposing
them in `Module#delegate`.
2024-01-25 11:51:00 +01:00
Jean Boussier
ddc32f5a47 Use an anonymous block parameter in Module#delegate
`...` generates an anonymous block, it's basically a shortcut
for `*, **, &`. So to look more similar to tools that introspect
method signatures, it's best to continue to use an anonymous block.
2024-01-25 09:16:21 +01: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
Hartley McGuire
1ecac5b8d3
./tools/rdoc-to-md --only=actiontext -a 2024-01-24 19:08:44 -05:00
Hartley McGuire
195d80199f
Add tools/rdoc-to-md script
Generally the idea is:
- use Prism to parse the file into AST + Comments
- transform each comment block into plain RDoc (instead of RDoc in a
  comment)
- use RDoc's ToMarkdown class to get a Markdown representation of the
  comment
- transform the Markdown representation back into a comment
- write a new file, skipping the lines that were previously RDoc
  comments and instead inserting the new Markdown comments

A little extra work has to be down for metaprogrammed documentation
because ToMarkdown turns RDoc directives into H1s. So for these cases,
the directive is first split off the top before doing the ToMarkdown
transformation and then added back afterwards.
2024-01-24 19:00:32 -05:00
Nikita Vasilevsky
605d910194
Fix eager loading of composite primary key associations
Co-Authored-By: Christine Belan <christine.belan@shopify.com>
2024-01-24 17:25:03 +00:00
Petrik de Heus
c7551d08fc
Merge pull request #50836 from p8/activerecord/fix-query-logs-rdoc
Specify RDoc method name for accessors defined on singleton_class [ci-skip]
2024-01-24 13:03:43 +01:00
Jean Boussier
2af2b222d4
Merge pull request #50855 from Shopify/update-console-prompt-color
Display dev & test env in console prompt in blue instead of green
2024-01-24 12:55:21 +01:00
Joshua Young
9691cf675f Add section on Queue Priority to ActiveJob docs 2024-01-24 21:28:23 +10:00
Stan Lo
7cbf06c1e8
Display dev/test env in console prompt in blue instead of green
The combination of red and blue is more color-blind friendly than red
and green.

Discussion: https://github.com/rails/rails/pull/50796#discussion_r1463670198
2024-01-24 11:07:40 +00:00
Stan Lo
0ea9748ba6
Fix prompt colorization test's setup 2024-01-24 11:07:40 +00:00
Aaron Patterson
80bce4aad3
Merge pull request #50859 from rails/no-row-mutation
Don't mutate row arrays that come back from the database adapter
2024-01-23 16:49:08 -08:00
Aaron Patterson
84130af8b5
Don't mutate row arrays that come back from the database adapter
In SQLite3-Ruby version 2.0, I would like to make row arrays frozen. I
tested the change, and it only breaks this test, so I'm changing the
test. I don't think we should be mutating the objects that the database
adapter returns
2024-01-23 16:33:04 -08:00
John Hawthorn
bb0e59b42d
Merge pull request #50202 from composerinteralia/trilogy-syscallerror-translate
Translate Trilogy syscall errors as conn failed
2024-01-23 15:25:09 -08: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
Anup Narkhede
776626ff98
Fix rotation detection for HDR videos (#50854)
Fixes https://github.com/rails/rails/issues/50853

The video analyzer was relying on the positional reference of the Display
Matrix side_data to fetch the rotation value. However, the side_data is
not guaranteed to be in the same position. For instance, HDR videos shot
on iOS have "DOVI configuration record" side_data in the first position,
followed by the "Display Matrix" side data containing the rotation value.

This fix removes the positional reference and explicitely searches for
the "Display Matrix" side_data to retrieve the rotation angle.
2024-01-23 11:28:11 -08:00
notapatch
addf281ddc Update Guides: AR querying english text to match code behavior
The code: Book.joins(:author, :reviews)

This code will return books that have an author and at least 1
review.

English text implies it returns the book and the author:

"return all books with their author .."

Changing the text to imply it returns books with an author.
2024-01-23 13:01:18 +00:00
Rafael Mendonça França
ee88f4133f
Merge pull request #50843 from p8/upgrade/sdoc-e9bb86
Upgrade to latest SDoc for performance
2024-01-22 17:08:01 -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
Petrik
db6eb7b72c Specify singleton method name for accessors defined on singleton_class [ci-skip]
RDoc can't extract the name of accessors defined with
`singleton_class.attr_accessor`, resulting in methods called `unknown`
in RDoc.
2024-01-22 12:34:07 +01:00