Skip to content

Use httpclient to run "Daily build with Ruby head"#50911

Merged
rafaelfranca merged 1 commit intorails:mainfrom
yahonda:use_httpclient_master_for_ruby34
Jan 29, 2024
Merged

Use httpclient to run "Daily build with Ruby head"#50911
rafaelfranca merged 1 commit intorails:mainfrom
yahonda:use_httpclient_master_for_ruby34

Conversation

@yahonda
Copy link
Member

@yahonda yahonda commented Jan 29, 2024

Motivation / Background

This pull request addresses "Daily build with Ruby head" failure https://buildkite.com/rails/rails-nightly/builds/101#018d5285-b4de-4072-b7d3-61c19f21347a

Detail

Action Mailbox needs webmock which depends on httpclient. httpclient master branch that added mutex_m as a dependency via nahi/httpclient#455 to support Ruby 3.4.0dev.

Steps to reproduce

cd actionmailbox
bundle exec rake test

Without this commit

... 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)
$

Additional information

httpclient gem that includes nahi/httpclient#455 has not been released to rubygems.org yet. In the meantime I want to make "Daily build with Ruby head" green. Once the newer versions of http client is released this commit can be reverted.

Checklist

Before submitting the PR make sure the following are checked:

  • This Pull Request is related to one change. Changes that are unrelated should be opened in separate PRs.
  • Commit message has a detailed description of what changed and why. If this PR fixes a related issue include it in the commit message. Ex: [Fix #issue-number]
  • Tests are added or updated if you fix a bug or add a feature.
  • CHANGELOG files are updated for the changed libraries if there is a behavior change or additional feature. Minor bug fixes and documentation changes should not be included.

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 nahi/httpclient#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)
$
```
@rafaelfranca rafaelfranca merged commit 6b96010 into rails:main Jan 29, 2024
@yahonda
Copy link
Member Author

yahonda commented Jan 30, 2024

Confirmed the original NameError has been addressed.
https://buildkite.com/rails/rails-nightly/builds/108

There are other remaining failures/errors. Will take a look at them later.

https://buildkite.com/rails/rails-nightly/builds/108#018d57ac-4e3b-4703-9dba-fd847ca0f5f2/1187-1196

Failure:
ActionDispatch::Routing::RoutesInspectorTest#test_routes_when_expanded [test/dispatch/routing/inspector_test.rb:365]:
--- expected
+++ actual
@@ -1 +1 @@
-["--[ Route 1 ]----------", "Prefix            | custom_assets", "Verb              | GET", "URI               | /custom/assets(.:format)", "Controller#Action | custom_assets#show", "Source Location   | /rails/actionpack/test/dispatch/routing/inspector_test.rb:333", "--[ Route 2 ]----------", "Prefix            | custom_furnitures", "Verb              | GET", "URI               | /custom/furnitures(.:format)", "Controller#Action | custom_furnitures#show", "Source Location   | /rails/actionpack/test/dispatch/routing/inspector_test.rb:334", "--[ Route 3 ]----------", "Prefix            | blog", "Verb              | ", "URI               | /blog", "Controller#Action | Blog::Engine", "Source Location   | /rails/actionpack/test/dispatch/routing/inspector_test.rb:335", "", "[ Routes for Blog::Engine ]", "--[ Route 1 ]----------", "Prefix            | cart", "Verb              | GET", "URI               | /cart(.:format)", "Controller#Action | cart#show", "Source Location   | /rails/actionpack/test/dispatch/routing/inspector_test.rb:329"]
+["--[ Route 1 ]----------", "Prefix            | custom_assets", "Verb              | GET", "URI               | /custom/assets(.:format)", "Controller#Action | custom_assets#show", "Source Location   | <internal:array>:52", "--[ Route 2 ]----------", "Prefix            | custom_furnitures", "Verb              | GET", "URI               | /custom/furnitures(.:format)", "Controller#Action | custom_furnitures#show", "Source Location   | <internal:array>:52", "--[ Route 3 ]----------", "Prefix            | blog", "Verb              | ", "URI               | /blog", "Controller#Action | Blog::Engine", "Source Location   | <internal:array>:52", "", "[ Routes for Blog::Engine ]", "--[ Route 1 ]----------", "Prefix            | cart", "Verb              | GET", "URI               | /cart(.:format)", "Controller#Action | cart#show", "Source Location   | <internal:array>:52"]

https://buildkite.com/rails/rails-nightly/builds/108#018d57ac-4e6d-4d11-8741-4a2f6ca84fc8/1165-1205

Failure:
ActiveStorage::Analyzer::VideoAnalyzerTest#test_analyzing_a_rotated_HDR_video [test/analyzer/video_analyzer_test.rb:38]:
Expected: -90
  Actual: 90

https://buildkite.com/rails/rails-nightly/builds/108#018d57ac-4f2a-45f1-86b9-9015a7b0a463/1165-2002

Error:
ToQueryTest#test_hash_not_sorted_lexicographically_for_nested_structure:
NameError: uninitialized constant ToQueryTest::URI
    test/core_ext/object/to_query_test.rb:90:in `test_hash_not_sorted_lexicographically_for_nested_structure'

@yahonda yahonda deleted the use_httpclient_master_for_ruby34 branch April 19, 2024 01:39
Earlopain added a commit to Earlopain/rails that referenced this pull request Oct 18, 2024
Followup to rails#50911

Not quite sure what happened here, the commit is still the latest.
I simply ran `bundle lock --update=httpclient`.

When running the railties tests:
```rb
.........../home/earlopain/.rbenv/versions/3.3.5/lib/ruby/gems/3.3.0/bundler/gems/httpclient-d57cc6d5ffee/lib/httpclient/auth.rb:11: warning: mutex_m was loaded from the standard library, but will no longer be part of the default gems starting from Ruby 3.4.0.
You can add mutex_m to your Gemfile or gemspec to silence this warning.
/home/earlopain/.rbenv/versions/3.3.5/lib/ruby/gems/3.3.0/bundler/gems/httpclient-d57cc6d5ffee/lib/httpclient/auth.rb:11: warning: mutex_m was loaded from the standard library, but will no longer be part of the default gems starting from Ruby 3.4.0.
You can add mutex_m to your Gemfile or gemspec to silence this warning.
/home/earlopain/.rbenv/versions/3.3.5/lib/ruby/gems/3.3.0/bundler/gems/httpclient-d57cc6d5ffee/lib/httpclient/auth.rb:11: warning: mutex_m was loaded from the standard library, but will no longer be part of the default gems starting from Ruby 3.4.0.
You can add mutex_m to your Gemfile or gemspec to silence this warning.
/home/earlopain/.rbenv/versions/3.3.5/lib/ruby/gems/3.3.0/bundler/gems/httpclient-d57cc6d5ffee/lib/httpclient/auth.rb:11: warning: mutex_m was loaded from the standard library, but will no longer be part of the default gems starting from Ruby 3.4.0.
You can add mutex_m to your Gemfile or gemspec to silence this warning.
/home/earlopain/.rbenv/versions/3.3.5/lib/ruby/gems/3.3.0/bundler/gems/httpclient-d57cc6d5ffee/lib/httpclient/auth.rb:11: warning: mutex_m was loaded from the standard library, but will no longer be part of the default gems starting from Ruby 3.4.0.
You can add mutex_m to your Gemfile or gemspec to silence this warning.
/home/earlopain/.rbenv/versions/3.3.5/lib/ruby/gems/3.3.0/bundler/gems/httpclient-d57cc6d5ffee/lib/httpclient/auth.rb:11: warning: mutex_m was loaded from the standard library, but will no longer be part of the default gems starting from Ruby 3.4.0.
You can add mutex_m to your Gemfile or gemspec to silence this warning.
/home/earlopain/.rbenv/versions/3.3.5/lib/ruby/gems/3.3.0/bundler/gems/httpclient-d57cc6d5ffee/lib/httpclient/auth.rb:11: warning: mutex_m was loaded from the standard library, but will no longer be part of the default gems starting from Ruby 3.4.0.
You can add mutex_m to your Gemfile or gemspec to silence this warning.
/home/earlopain/.rbenv/versions/3.3.5/lib/ruby/gems/3.3.0/bundler/gems/httpclient-d57cc6d5ffee/lib/httpclient/auth.rb:11: warning: mutex_m was loaded from the standard library, but will no longer be part of the default gems starting from Ruby 3.4.0.
You can add mutex_m to your Gemfile or gemspec to silence this warning.
./home/earlopain/.rbenv/versions/3.3.5/lib/ruby/gems/3.3.0/bundler/gems/httpclient-d57cc6d5ffee/lib/httpclient/auth.rb:11: warning: mutex_m was loaded from the standard library, but will no longer be part of the default gems starting from Ruby 3.4.0.
You can add mutex_m to your Gemfile or gemspec to silence this warning.
...
```

You get the idea. Not sure why strict warnings don't pick this up.
yahonda added a commit to yahonda/rails that referenced this pull request Feb 22, 2025
httpclient 2.9.0 has been released that supports Ruby 3.4 changes:

- making `mutex_m` as bundled gem
nahi/httpclient#455
nahi/httpclient#472

- Chilled strings
nahi/httpclient#471

Kind of reverting rails#50911
@yahonda yahonda mentioned this pull request Feb 22, 2025
4 tasks
JuanVqz pushed a commit to JuanVqz/rails that referenced this pull request Feb 24, 2025
httpclient 2.9.0 has been released that supports Ruby 3.4 changes:

- making `mutex_m` as bundled gem
nahi/httpclient#455
nahi/httpclient#472

- Chilled strings
nahi/httpclient#471

Kind of reverting rails#50911
dkani pushed a commit to dkani/rails that referenced this pull request Mar 3, 2025
httpclient 2.9.0 has been released that supports Ruby 3.4 changes:

- making `mutex_m` as bundled gem
nahi/httpclient#455
nahi/httpclient#472

- Chilled strings
nahi/httpclient#471

Kind of reverting rails#50911
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.

2 participants