fix: set canonical User-Agent header format#476
Conversation
Use the User-Agent format from the 6.x line:
`WorkOS; {engine}/{ruby_version}; {platform}; v{VERSION}`. The
7.0.0 release inadvertently shipped a different shape that no
longer conformed to WorkOS' canonical SDK User-Agent format.
Includes the Ruby engine name (e.g. "ruby", "jruby",
"truffleruby") via RUBY_ENGINE, which the 7.x format dropped.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Greptile SummaryThis PR restores the canonical WorkOS Ruby SDK Confidence Score: 5/5Safe to merge — single-line constant fix with no behavioural side effects. Only finding is a P2 style nit (redundant No files require special attention. Important Files Changed
|
| USER_AGENT = "workos-ruby/#{WorkOS::VERSION} ruby/#{RUBY_VERSION} (#{RUBY_PLATFORM})" | ||
| USER_AGENT = [ | ||
| "WorkOS", | ||
| "#{defined?(::RUBY_ENGINE) ? ::RUBY_ENGINE : "ruby"}/#{RUBY_VERSION}", |
There was a problem hiding this comment.
RUBY_ENGINE guard is redundant in modern Ruby
RUBY_ENGINE has been a built-in constant in every Ruby implementation (MRI, JRuby, TruffleRuby) since Ruby 1.9, so defined?(::RUBY_ENGINE) will always be truthy in any supported version of this gem. The fallback "ruby" string can never be reached. The guard is harmless but adds noise.
| "#{defined?(::RUBY_ENGINE) ? ::RUBY_ENGINE : "ruby"}/#{RUBY_VERSION}", | |
| "#{::RUBY_ENGINE}/#{RUBY_VERSION}", |
Summary
Sets the outgoing
User-Agentheader toWorkOS; {engine}/{ruby_version}; {platform}; v{VERSION}— the canonical WorkOS Ruby SDK format used through the 6.x line. The 7.0.0 release inadvertently shipped a different shape (workos-ruby/{VERSION} ruby/{ruby_version} ({platform})) that no longer conformed.The new format also includes the Ruby engine name via
RUBY_ENGINE, so traffic from JRuby and TruffleRuby is now distinguishable from MRI in theUser-Agentheader.Example UAs:
WorkOS; ruby/3.3.11; arm64-darwin25; v7.1.1WorkOS; jruby/9.4.0.0; java; v7.1.1WorkOS; truffleruby/24.0.0; arm64-darwin; v7.1.1Test plan
bundle exec rake test(870 runs, 4395 assertions, 0 failures)🤖 Generated with Claude Code