From db6b04af73f6752337ad7a9306f8f1f0edf8a93a Mon Sep 17 00:00:00 2001 From: Hanna Date: Fri, 6 Mar 2026 11:22:33 -0800 Subject: [PATCH 01/11] initial update to faraday 2 --- Gemfile.lock | 48 ++++++++++--------- event_source.gemspec | 5 +- .../http/faraday_connection_proxy.rb | 12 ++--- lib/event_source/protocols/http_protocol.rb | 5 +- .../example_services/ridp_service_spec.rb | 10 +--- 5 files changed, 39 insertions(+), 41 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 4a70de83..1dd14dd6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -14,8 +14,9 @@ PATH dry-struct (~> 1.4) dry-types (~> 1.5) dry-validation (~> 1.6) - faraday (~> 1.4.1) - faraday_middleware (~> 1.0) + faraday (~> 2.14.1) + faraday-retry (~> 2.0) + faraday-typhoeus (~> 1.0) logging (~> 2.3.0) mime-types nokogiri (>= 1.13.0) @@ -157,21 +158,17 @@ GEM ffi (>= 1.15.0) faker (2.18.0) i18n (>= 1.6, < 2) - faraday (1.4.3) - faraday-em_http (~> 1.0) - faraday-em_synchrony (~> 1.0) - faraday-excon (~> 1.1) - faraday-net_http (~> 1.0) - faraday-net_http_persistent (~> 1.1) - multipart-post (>= 1.2, < 3) - ruby2_keywords (>= 0.0.4) - faraday-em_http (1.0.0) - faraday-em_synchrony (1.0.0) - faraday-excon (1.1.0) - faraday-net_http (1.0.1) - faraday-net_http_persistent (1.2.0) - faraday_middleware (1.2.0) - faraday (~> 1.0) + faraday (2.14.1) + faraday-net_http (>= 2.0, < 3.5) + json + logger + faraday-net_http (3.4.2) + net-http (~> 0.5) + faraday-retry (2.4.0) + faraday (~> 2.0) + faraday-typhoeus (1.1.0) + faraday (~> 2.0) + typhoeus (~> 1.4) ffi (1.15.4) globalid (0.5.2) activesupport (>= 5.0) @@ -179,7 +176,9 @@ GEM i18n (1.8.10) concurrent-ruby (~> 1.0) ice_nine (0.11.2) + json (2.18.1) little-plugger (1.1.4) + logger (1.7.0) logging (2.3.0) little-plugger (~> 1.1) multi_json (~> 1.14) @@ -194,7 +193,7 @@ GEM mime-types-data (~> 3.2015) mime-types-data (3.2021.0901) mini_mime (1.1.2) - mini_portile2 (2.8.1) + mini_portile2 (2.8.9) minitest (5.14.4) mongo (2.14.0) bson (>= 4.8.2, < 5.0.0) @@ -202,10 +201,14 @@ GEM activemodel (>= 5.1, < 6.2) mongo (>= 2.10.5, < 3.0.0) multi_json (1.15.0) - multipart-post (2.1.1) mustermann (1.1.1) ruby2_keywords (~> 0.0.1) - nio4r (2.5.8) + net-http (0.9.1) + uri (>= 0.11.1) + nio4r (2.7.5) + nokogiri (1.19.1) + mini_portile2 (~> 2.8.2) + racc (~> 1.4) oj (3.13.9) ox (2.14.5) parallel (1.20.1) @@ -218,7 +221,7 @@ GEM byebug (~> 11.0) pry (~> 0.10) public_suffix (4.0.6) - racc (1.6.2) + racc (1.8.1) rack (2.2.3) rack-protection (2.1.0) rack @@ -284,7 +287,7 @@ GEM rubocop-ast (1.7.0) parser (>= 3.0.1.1) ruby-progressbar (1.11.0) - ruby2_keywords (0.0.4) + ruby2_keywords (0.0.5) set (1.0.2) sinatra (2.1.0) mustermann (~> 1.0) @@ -308,6 +311,7 @@ GEM tzinfo (2.0.4) concurrent-ruby (~> 1.0) unicode-display_width (2.0.0) + uri (1.1.1) webmock (3.13.0) addressable (>= 2.3.6) crack (>= 0.3.2) diff --git a/event_source.gemspec b/event_source.gemspec index 57308aec..029ea56b 100644 --- a/event_source.gemspec +++ b/event_source.gemspec @@ -47,8 +47,9 @@ Gem::Specification.new do |spec| spec.add_dependency 'dry-types', '~> 1.5' spec.add_dependency 'dry-validation', '~> 1.6' spec.add_dependency 'dry-schema', '~> 1.6' - spec.add_dependency 'faraday', '~> 1.4.1' - spec.add_dependency 'faraday_middleware', '~> 1.0' + spec.add_dependency 'faraday', '~> 2.14.1' + spec.add_dependency 'faraday-typhoeus', '~> 1.0' + spec.add_dependency 'faraday-retry', '~> 2.0' spec.add_dependency 'logging', '~> 2.3.0' spec.add_dependency 'nokogiri', '>= 1.13.0' spec.add_dependency 'mime-types' diff --git a/lib/event_source/protocols/http/faraday_connection_proxy.rb b/lib/event_source/protocols/http/faraday_connection_proxy.rb index cb5c4a23..cac0a230 100644 --- a/lib/event_source/protocols/http/faraday_connection_proxy.rb +++ b/lib/event_source/protocols/http/faraday_connection_proxy.rb @@ -86,7 +86,7 @@ def initialize(async_api_server, options = {}) def build_connection request_middleware_params = construct_request_middleware response_middleware_params = connection_params[:response_middleware_params] - # adapter = connection_params[:adapter] + adapter = connection_params[:adapter] Faraday.new( build_faraday_parameters(connection_params) @@ -105,14 +105,14 @@ def build_connection conn.response :logger, nil, { headers: true, bodies: true, log_level: :error } - # conn.adapter :http - # last middleware must be adapter - # adapter.each_pair do |component, options| - # conn.adapter component.to_s.to_sym, options || {} - # end + # Adapter must be last - required in Faraday 2.x + adapter.each_pair do |component, options| + conn.adapter component.to_sym, options || {} + end end end + def connection @subject end diff --git a/lib/event_source/protocols/http_protocol.rb b/lib/event_source/protocols/http_protocol.rb index ea349333..0354a72c 100644 --- a/lib/event_source/protocols/http_protocol.rb +++ b/lib/event_source/protocols/http_protocol.rb @@ -1,9 +1,8 @@ # frozen_string_literal: true require 'faraday' -require 'faraday_middleware' -require 'typhoeus' -require 'typhoeus/adapters/faraday' +require 'faraday/retry' +require 'faraday/typhoeus' require 'uri' require_relative 'http/error' diff --git a/spec/event_source/example_services/ridp_service_spec.rb b/spec/event_source/example_services/ridp_service_spec.rb index 0b05c441..e8503ce8 100644 --- a/spec/event_source/example_services/ridp_service_spec.rb +++ b/spec/event_source/example_services/ridp_service_spec.rb @@ -50,13 +50,7 @@ end before :each do - stub_request(:post, "https://impl.hub.cms.gov/Imp1/RIDPService").with( - headers: { - 'Accept'=>'*/*', - 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', - 'User-Agent' => 'Faraday v1.4.3' - } - ) + stub_request(:post, "https://impl.hub.cms.gov/Imp1/RIDPService") .with do |request| puts request.body.inspect xml = Nokogiri::XML(request.body) @@ -70,7 +64,7 @@ ) u_token.present? && t_stamp.present? end - .to_return(status: 200, body: "", headers: {}) + .to_return(status: 200, body: "", headers: {}) end it "responds to requests" do From 0e6abef7fbaae2c41507a92636f6e25c321de942 Mon Sep 17 00:00:00 2001 From: Hanna Date: Fri, 6 Mar 2026 12:12:52 -0800 Subject: [PATCH 02/11] clean nokogiri --- Gemfile.lock | 3 --- 1 file changed, 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 1dd14dd6..7f217e55 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -193,7 +193,6 @@ GEM mime-types-data (~> 3.2015) mime-types-data (3.2021.0901) mini_mime (1.1.2) - mini_portile2 (2.8.9) minitest (5.14.4) mongo (2.14.0) bson (>= 4.8.2, < 5.0.0) @@ -206,8 +205,6 @@ GEM net-http (0.9.1) uri (>= 0.11.1) nio4r (2.7.5) - nokogiri (1.19.1) - mini_portile2 (~> 2.8.2) racc (~> 1.4) oj (3.13.9) ox (2.14.5) From 7828c023324c8f92c0fe531b81f01b2d09520a38 Mon Sep 17 00:00:00 2001 From: Hanna Date: Tue, 10 Mar 2026 09:07:19 -0700 Subject: [PATCH 03/11] remove ruby 2 --- .github/workflows/rspec.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rspec.yml b/.github/workflows/rspec.yml index 57363046..87012a84 100644 --- a/.github/workflows/rspec.yml +++ b/.github/workflows/rspec.yml @@ -6,7 +6,7 @@ jobs: strategy: fail-fast: false matrix: - ruby_version: ['2.6.3', '2.7.5', '3.0.5', '3.1.4', '3.2.2'] + ruby_version: ['3.0.5', '3.1.4', '3.2.2'] runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 From 82a1b0842f2f8944c1039d05d4d23a73e92e7762 Mon Sep 17 00:00:00 2001 From: Hanna Date: Tue, 10 Mar 2026 09:29:53 -0700 Subject: [PATCH 04/11] remove ruby 3.0.5 --- .github/workflows/rspec.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rspec.yml b/.github/workflows/rspec.yml index 87012a84..dd0cda98 100644 --- a/.github/workflows/rspec.yml +++ b/.github/workflows/rspec.yml @@ -6,7 +6,7 @@ jobs: strategy: fail-fast: false matrix: - ruby_version: ['3.0.5', '3.1.4', '3.2.2'] + ruby_version: ['3.1.4', '3.2.2'] runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 From f1600a1a4a464441595a08ad3893057ae8299873 Mon Sep 17 00:00:00 2001 From: Hanna Date: Mon, 16 Mar 2026 10:33:55 -0700 Subject: [PATCH 05/11] add ruby 3.4.7 --- .github/workflows/rspec.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rspec.yml b/.github/workflows/rspec.yml index dd0cda98..01fde290 100644 --- a/.github/workflows/rspec.yml +++ b/.github/workflows/rspec.yml @@ -6,7 +6,7 @@ jobs: strategy: fail-fast: false matrix: - ruby_version: ['3.1.4', '3.2.2'] + ruby_version: ['3.1.4', '3.2.2', '3.4.7'] runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 From 9c704967fd443c2220b1bd4d96723058cfebb924 Mon Sep 17 00:00:00 2001 From: Hanna Date: Mon, 16 Mar 2026 10:51:38 -0700 Subject: [PATCH 06/11] update bundler --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 7f217e55..a28fe02d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -337,4 +337,4 @@ DEPENDENCIES yard BUNDLED WITH - 2.2.14 + 2.4.19 From 2d8e3016d06766cfa9fbb1b21ee6f4739a4a6209 Mon Sep 17 00:00:00 2001 From: Hanna Date: Tue, 17 Mar 2026 08:26:51 -0700 Subject: [PATCH 07/11] add gems for new ruby version --- Gemfile.lock | 17 ++++++++++++----- event_source.gemspec | 3 +++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index a28fe02d..314e90f8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,6 +3,8 @@ PATH specs: event_source (0.5.8) addressable (>= 2.8.0) + base64 + bigdecimal bunny (>= 2.14) deep_merge (~> 1.2.0) dry-configurable (~> 0.12) @@ -19,6 +21,7 @@ PATH faraday-typhoeus (~> 1.0) logging (~> 2.3.0) mime-types + mutex_m nokogiri (>= 1.13.0) oj (~> 3.11) ox (~> 2.14) @@ -90,6 +93,8 @@ GEM public_suffix (>= 2.0.2, < 5.0) amq-protocol (2.3.2) ast (2.4.2) + base64 (0.3.0) + bigdecimal (4.0.1) bson (4.12.1) builder (3.2.4) bunny (2.19.0) @@ -182,9 +187,9 @@ GEM logging (2.3.0) little-plugger (~> 1.1) multi_json (~> 1.14) - loofah (2.12.0) + loofah (2.25.0) crass (~> 1.0.2) - nokogiri (>= 1.5.9) + nokogiri (>= 1.12.0) mail (2.7.1) mini_mime (>= 0.1.1) marcel (1.0.2) @@ -202,6 +207,7 @@ GEM multi_json (1.15.0) mustermann (1.1.1) ruby2_keywords (~> 0.0.1) + mutex_m (0.3.0) net-http (0.9.1) uri (>= 0.11.1) nio4r (2.7.5) @@ -239,8 +245,9 @@ GEM bundler (>= 1.15.0) railties (= 6.1.4.1) sprockets-rails (>= 2.0.0) - rails-dom-testing (2.0.3) - activesupport (>= 4.2.0) + rails-dom-testing (2.3.0) + activesupport (>= 5.0.0) + minitest nokogiri (>= 1.6) rails-html-sanitizer (1.4.2) loofah (~> 2.3) @@ -337,4 +344,4 @@ DEPENDENCIES yard BUNDLED WITH - 2.4.19 + 2.7.2 diff --git a/event_source.gemspec b/event_source.gemspec index 029ea56b..c58168f3 100644 --- a/event_source.gemspec +++ b/event_source.gemspec @@ -56,6 +56,9 @@ Gem::Specification.new do |spec| spec.add_dependency 'oj', '~> 3.11' spec.add_dependency 'ox', '~> 2.14' spec.add_dependency 'typhoeus', '~> 1.4.0' + spec.add_dependency 'bigdecimal' if RUBY_VERSION >= '3.4' + spec.add_dependency 'base64' if RUBY_VERSION >= '3.4' + spec.add_dependency 'mutex_m' if RUBY_VERSION >= '3.4' # TODO: Change to development dependency spec.add_development_dependency 'database_cleaner' From be8bbf20d6b03ee4862bb6c067ae82567fd6e828 Mon Sep 17 00:00:00 2001 From: Hanna Date: Tue, 17 Mar 2026 11:27:42 -0700 Subject: [PATCH 08/11] update dry gems --- Gemfile.lock | 52 +++++++++++++++++++++++--------------------- event_source.gemspec | 6 ++--- lib/event_source.rb | 2 +- 3 files changed, 31 insertions(+), 29 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 314e90f8..2e4d1e9c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -102,7 +102,7 @@ GEM sorted_set (~> 1, >= 1.0.2) byebug (11.1.3) coderay (1.1.3) - concurrent-ruby (1.1.9) + concurrent-ruby (1.3.6) crack (0.4.5) rexml crass (1.0.6) @@ -114,50 +114,52 @@ GEM database_cleaner-core (2.0.1) deep_merge (1.2.1) diff-lcs (1.4.4) - dry-configurable (0.12.1) + dry-configurable (0.16.1) + dry-core (~> 0.6) + zeitwerk (~> 2.6) + dry-container (0.11.0) concurrent-ruby (~> 1.0) - dry-core (~> 0.5, >= 0.5.0) - dry-container (0.8.0) + dry-core (0.9.1) concurrent-ruby (~> 1.0) - dry-configurable (~> 0.1, >= 0.1.3) - dry-core (0.7.1) - concurrent-ruby (~> 1.0) - dry-equalizer (0.3.0) + zeitwerk (~> 2.6) dry-events (0.3.0) concurrent-ruby (~> 1.0) dry-core (~> 0.5, >= 0.5) - dry-inflector (0.2.1) - dry-initializer (3.0.4) - dry-logic (1.2.0) + dry-inflector (0.3.0) + dry-initializer (3.2.0) + dry-logic (1.3.0) concurrent-ruby (~> 1.0) - dry-core (~> 0.5, >= 0.5) + dry-core (~> 0.9, >= 0.9) + zeitwerk (~> 2.6) dry-monads (1.4.0) concurrent-ruby (~> 1.0) dry-core (~> 0.7) - dry-schema (1.6.2) + dry-schema (1.11.3) concurrent-ruby (~> 1.0) - dry-configurable (~> 0.8, >= 0.8.3) - dry-core (~> 0.5, >= 0.5) + dry-configurable (~> 0.16, >= 0.16) + dry-core (~> 0.9, >= 0.9) dry-initializer (~> 3.0) - dry-logic (~> 1.0) - dry-types (~> 1.5) + dry-logic (~> 1.3) + dry-types (~> 1.6) + zeitwerk (~> 2.6) dry-struct (1.4.0) dry-core (~> 0.5, >= 0.5) dry-types (~> 1.5) ice_nine (~> 0.11) - dry-types (1.5.1) + dry-types (1.6.1) concurrent-ruby (~> 1.0) dry-container (~> 0.3) - dry-core (~> 0.5, >= 0.5) + dry-core (~> 0.9, >= 0.9) dry-inflector (~> 0.1, >= 0.1.2) - dry-logic (~> 1.0, >= 1.0.2) - dry-validation (1.6.0) + dry-logic (~> 1.3, >= 1.3) + zeitwerk (~> 2.6) + dry-validation (1.9.0) concurrent-ruby (~> 1.0) dry-container (~> 0.7, >= 0.7.1) - dry-core (~> 0.4) - dry-equalizer (~> 0.2) + dry-core (~> 0.9, >= 0.9) dry-initializer (~> 3.0) - dry-schema (~> 1.5, >= 1.5.2) + dry-schema (~> 1.11, >= 1.11.0) + zeitwerk (~> 2.6) erubi (1.10.0) ethon (0.15.0) ffi (>= 1.15.0) @@ -324,7 +326,7 @@ GEM websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) yard (0.9.26) - zeitwerk (2.5.1) + zeitwerk (2.7.5) PLATFORMS ruby diff --git a/event_source.gemspec b/event_source.gemspec index c58168f3..7550e090 100644 --- a/event_source.gemspec +++ b/event_source.gemspec @@ -56,9 +56,9 @@ Gem::Specification.new do |spec| spec.add_dependency 'oj', '~> 3.11' spec.add_dependency 'ox', '~> 2.14' spec.add_dependency 'typhoeus', '~> 1.4.0' - spec.add_dependency 'bigdecimal' if RUBY_VERSION >= '3.4' - spec.add_dependency 'base64' if RUBY_VERSION >= '3.4' - spec.add_dependency 'mutex_m' if RUBY_VERSION >= '3.4' + spec.add_dependency 'bigdecimal' + spec.add_dependency 'base64' + spec.add_dependency 'mutex_m' # TODO: Change to development dependency spec.add_development_dependency 'database_cleaner' diff --git a/lib/event_source.rb b/lib/event_source.rb index 09fb8514..3beb524f 100644 --- a/lib/event_source.rb +++ b/lib/event_source.rb @@ -2,7 +2,7 @@ require 'forwardable' require 'date' -require 'dry/types/type' +require 'dry-types' require 'dry/monads' require 'dry/monads/do' require 'dry/monads/result' From 50c66c993a4bcb03345db8a9a874d916613b4127 Mon Sep 17 00:00:00 2001 From: Hanna Date: Tue, 17 Mar 2026 11:31:17 -0700 Subject: [PATCH 09/11] change bundler version --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 2e4d1e9c..e237b083 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -346,4 +346,4 @@ DEPENDENCIES yard BUNDLED WITH - 2.7.2 + 2.4.19 From fefe8ca3e6a1923e8f801ed02c7978ca21a9495a Mon Sep 17 00:00:00 2001 From: Hanna Date: Tue, 17 Mar 2026 12:18:50 -0700 Subject: [PATCH 10/11] resolve rspec.yml --- .github/workflows/rspec.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/rspec.yml b/.github/workflows/rspec.yml index d789d0ac..01fde290 100644 --- a/.github/workflows/rspec.yml +++ b/.github/workflows/rspec.yml @@ -6,11 +6,7 @@ jobs: strategy: fail-fast: false matrix: -<<<<<<< update_faraday_to_2 ruby_version: ['3.1.4', '3.2.2', '3.4.7'] -======= - ruby_version: ['2.7.5', '3.0.5', '3.1.4', '3.2.2'] ->>>>>>> main runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 From e061a7d254ea7872ab169cdc290389cfe4c3dd85 Mon Sep 17 00:00:00 2001 From: Hanna Date: Tue, 17 Mar 2026 19:13:54 -0700 Subject: [PATCH 11/11] fix for spec MimeEncode --- spec/event_source/operations/mime_encode_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/event_source/operations/mime_encode_spec.rb b/spec/event_source/operations/mime_encode_spec.rb index b2475d00..660e9361 100644 --- a/spec/event_source/operations/mime_encode_spec.rb +++ b/spec/event_source/operations/mime_encode_spec.rb @@ -46,7 +46,7 @@ context 'when payload cannot be converted to JSON' do before do - allow(invalid_payload).to receive(:to_json).and_raise(JSON::GeneratorError) + allow(invalid_payload).to receive(:to_json).and_raise(JSON::GeneratorError.new('test error')) end it 'returns a failure with JSON::GeneratorError' do