From 96fca83ca04280fa45b683bde56ab63e9b872281 Mon Sep 17 00:00:00 2001 From: Sichan Yoo Date: Fri, 8 May 2026 10:26:31 -0700 Subject: [PATCH 1/5] Add YJIT and ZJIT tracking in user agent. --- .../lib/aws-sdk-core/plugins/user_agent.rb | 9 ++- .../spec/aws/plugins/user_agent_spec.rb | 60 +++++++++++++++++++ 2 files changed, 68 insertions(+), 1 deletion(-) diff --git a/gems/aws-sdk-core/lib/aws-sdk-core/plugins/user_agent.rb b/gems/aws-sdk-core/lib/aws-sdk-core/plugins/user_agent.rb index c5792f666ce..c3f7c3fbb9e 100644 --- a/gems/aws-sdk-core/lib/aws-sdk-core/plugins/user_agent.rb +++ b/gems/aws-sdk-core/lib/aws-sdk-core/plugins/user_agent.rb @@ -171,7 +171,14 @@ def os_metadata # Used to be RUBY_ENGINE/RUBY_VERSION def language_metadata - "lang/#{RUBY_ENGINE}##{RUBY_ENGINE_VERSION} md/#{RUBY_VERSION}" + metadata = "lang/#{RUBY_ENGINE}##{RUBY_ENGINE_VERSION} md/#{RUBY_VERSION}" + [:YJIT, :ZJIT].each do |jit| + next unless RubyVM.const_defined?(jit) + + mode = RubyVM.const_get(jit) + metadata += " md/#{jit.to_s.downcase}" if mode.respond_to?(:enabled?) && mode.enabled? + end + metadata end def env_metadata diff --git a/gems/aws-sdk-core/spec/aws/plugins/user_agent_spec.rb b/gems/aws-sdk-core/spec/aws/plugins/user_agent_spec.rb index 18063f600fb..0a05683ec70 100644 --- a/gems/aws-sdk-core/spec/aws/plugins/user_agent_spec.rb +++ b/gems/aws-sdk-core/spec/aws/plugins/user_agent_spec.rb @@ -89,6 +89,66 @@ def assert_header(expected, actual) end end + def stub_jit(name, enabled:) + if enabled + jit_module = double(enabled?: true) + stub_const("RubyVM::#{name}", jit_module) + else + hide_const("RubyVM::#{name}") + end + end + + # Added tests manually instead of modifying cross-SDK test JSON since JIT info is specific to Ruby. + context 'JIT metadata' do + before do + allow(RbConfig::CONFIG).to receive(:[]).with('host_os').and_return('linux') + allow(RbConfig::CONFIG).to receive(:[]).with('host_cpu').and_return('x86_64') + allow(Gem::Platform).to receive(:local).and_return(double(version: '1.0')) + end + + def user_agent_for(client) + resp = client.example_operation + resp.context.http_request.headers['User-Agent'] + end + + it 'includes md/yjit when YJIT is enabled' do + stub_jit(:YJIT, enabled: true) + stub_jit(:ZJIT, enabled: false) + + expect(user_agent_for(client)).to include('md/yjit') + expect(user_agent_for(client)).not_to include('md/zjit') + end + + it 'includes md/zjit when ZJIT is enabled' do + stub_jit(:YJIT, enabled: false) + stub_jit(:ZJIT, enabled: true) + + expect(user_agent_for(client)).to include('md/zjit') + expect(user_agent_for(client)).not_to include('md/yjit') + end + + it 'includes neither when both are disabled' do + stub_jit(:YJIT, enabled: false) + stub_jit(:ZJIT, enabled: false) + + ua = user_agent_for(client) + expect(ua).not_to include('md/yjit') + expect(ua).not_to include('md/zjit') + end + + it 'includes neither on non-CRuby engines' do + stub_const('RUBY_ENGINE', 'jruby') + stub_const('RUBY_ENGINE_VERSION', '9.4.0.0') + stub_jit(:YJIT, enabled: false) + stub_jit(:ZJIT, enabled: false) + + ua = user_agent_for(client) + expect(ua).to include('lang/jruby#9.4.0.0') + expect(ua).not_to include('md/yjit') + expect(ua).not_to include('md/zjit') + end + end + context 'test runner' do tests = JSON.load_file( File.join(File.dirname(__FILE__), 'user_agent_tests.json') From d29e5221d5f66f4f8ec782f6c6768318c4280033 Mon Sep 17 00:00:00 2001 From: Sichan Yoo Date: Fri, 8 May 2026 14:10:27 -0700 Subject: [PATCH 2/5] Add unreleased change to changelog --- gems/aws-sdk-core/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/gems/aws-sdk-core/CHANGELOG.md b/gems/aws-sdk-core/CHANGELOG.md index 161ec602f37..a1259ea6a31 100644 --- a/gems/aws-sdk-core/CHANGELOG.md +++ b/gems/aws-sdk-core/CHANGELOG.md @@ -1,5 +1,6 @@ Unreleased Changes ------------------ +* Feature - Add YJIT & ZJIT tracking to user agent. 3.246.0 (2026-04-23) ------------------ From 2c7bd4f009cab39278ba99c20a37fac9c0b272d2 Mon Sep 17 00:00:00 2001 From: Sichan Yoo Date: Mon, 11 May 2026 11:35:06 -0700 Subject: [PATCH 3/5] Add RubyVM existence check --- gems/aws-sdk-core/lib/aws-sdk-core/plugins/user_agent.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gems/aws-sdk-core/lib/aws-sdk-core/plugins/user_agent.rb b/gems/aws-sdk-core/lib/aws-sdk-core/plugins/user_agent.rb index c3f7c3fbb9e..7bd7546338f 100644 --- a/gems/aws-sdk-core/lib/aws-sdk-core/plugins/user_agent.rb +++ b/gems/aws-sdk-core/lib/aws-sdk-core/plugins/user_agent.rb @@ -172,7 +172,9 @@ def os_metadata # Used to be RUBY_ENGINE/RUBY_VERSION def language_metadata metadata = "lang/#{RUBY_ENGINE}##{RUBY_ENGINE_VERSION} md/#{RUBY_VERSION}" - [:YJIT, :ZJIT].each do |jit| + return metadata unless RUBY_ENGINE == 'ruby' + + %i[YJIT ZJIT].each do |jit| next unless RubyVM.const_defined?(jit) mode = RubyVM.const_get(jit) From 1b46f679be96dc56a605fb89da57c34226f38b5f Mon Sep 17 00:00:00 2001 From: Sichan Yoo Date: Mon, 11 May 2026 12:37:42 -0700 Subject: [PATCH 4/5] Limit JIT unit tests to cruby only --- gems/aws-sdk-core/spec/aws/plugins/user_agent_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gems/aws-sdk-core/spec/aws/plugins/user_agent_spec.rb b/gems/aws-sdk-core/spec/aws/plugins/user_agent_spec.rb index 0a05683ec70..ab7fc1fc6ec 100644 --- a/gems/aws-sdk-core/spec/aws/plugins/user_agent_spec.rb +++ b/gems/aws-sdk-core/spec/aws/plugins/user_agent_spec.rb @@ -111,7 +111,7 @@ def user_agent_for(client) resp.context.http_request.headers['User-Agent'] end - it 'includes md/yjit when YJIT is enabled' do + it 'includes md/yjit when YJIT is enabled', skip: (RUBY_ENGINE != 'ruby') do stub_jit(:YJIT, enabled: true) stub_jit(:ZJIT, enabled: false) @@ -119,7 +119,7 @@ def user_agent_for(client) expect(user_agent_for(client)).not_to include('md/zjit') end - it 'includes md/zjit when ZJIT is enabled' do + it 'includes md/zjit when ZJIT is enabled', skip: (RUBY_ENGINE != 'ruby') do stub_jit(:YJIT, enabled: false) stub_jit(:ZJIT, enabled: true) From cc0df0735ed160c29584b9c53a96f4af142182b2 Mon Sep 17 00:00:00 2001 From: Sichan Yoo Date: Mon, 11 May 2026 14:33:42 -0700 Subject: [PATCH 5/5] Bump minimum core versions to 3.247.0, to version that will include the JIT tracking behavior. --- build_tools/services.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build_tools/services.rb b/build_tools/services.rb index 8bf91b2eb42..a78ed7ce825 100644 --- a/build_tools/services.rb +++ b/build_tools/services.rb @@ -9,10 +9,10 @@ class ServiceEnumerator MANIFEST_PATH = File.expand_path('../../services.json', __FILE__) # Minimum `aws-sdk-core` version for new gem builds - MINIMUM_CORE_VERSION = "3.244.0" + MINIMUM_CORE_VERSION = "3.247.0" # Minimum `aws-sdk-core` version for new S3 gem builds - MINIMUM_CORE_VERSION_S3 = "3.244.0" + MINIMUM_CORE_VERSION_S3 = "3.247.0" EVENTSTREAM_PLUGIN = "Aws::Plugins::EventStreamConfiguration"