Skip to content

fix(ruby): pin link-header-parser to >=7.0 and fix its new keyword arg - #1229

Merged
jablan merged 2 commits into
mainfrom
fix-ruby-link-header-parser-crash
Aug 3, 2026
Merged

fix(ruby): pin link-header-parser to >=7.0 and fix its new keyword arg#1229
jablan merged 2 commits into
mainfrom
fix-ruby-link-header-parser-crash

Conversation

@jablan

@jablan jablan commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • link-header-parser 7.0 renamed the base: keyword argument to base_uri: and changed group_by_relation_type to return string keys instead of symbols. Since the ruby client's gemspec had no version constraint, anyone installing/updating today gets 7.0.1, and any paginated API response crashes with ArgumentError: missing keyword: :base_uri in Phrase::Response#initialize.
  • Updates clients/ruby/lib/phrase/response.rb to call LinkHeaderParser.parse with base_uri: and normalize group_by_relation_type's keys back to symbols.
  • Constrains the link-header-parser runtime dependency to >= 7.0 in openapi-generator/templates/ruby-client/gemspec.mustache (the template that generates clients/ruby/phrase.gemspec).
  • Adds clients/ruby/spec/response_spec.rb, a regression spec covering Phrase::Response with and without pagination Link headers — there was previously no test coverage for this file at all, which is why the existing suite passed despite the crash. Added a .gitignore exception for it, following the same pattern used for the existing hand-maintained locales_api_spec.rb/uploads_api_spec.rb.

Fixes phrase/phrase-ruby#11

Test plan

  • bundle exec rspec spec/response_spec.rb — new spec passes with the fix, and reproduces the reported ArgumentError when the fix is reverted
  • bundle exec rspec — full suite (1845 examples) passes

🤖 Generated with Claude Code

link-header-parser 7.0 renamed the base: keyword to base_uri: and changed
group_by_relation_type to return string keys instead of symbols, crashing
any paginated response with an ArgumentError. Update response.rb to use
the new API and constrain the gemspec dependency accordingly.

Fixes phrase/phrase-ruby#11

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

API changelog (oasdiff)

Doc-only edits (descriptions, examples) do not appear here.

No changes detected

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the generated Ruby client to remain compatible with link-header-parser 7.x (pagination Link header parsing) and adds a regression spec to prevent future breakage.

Changes:

  • Constrain the Ruby client gemspec template to require link-header-parser >= 7.0.
  • Update Phrase::Response to use the new base_uri: keyword when parsing Link headers and to handle the new return shape.
  • Add an RSpec regression test for paginated and non-paginated responses, and unignore it in .gitignore.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.

File Description
openapi-generator/templates/ruby-client/gemspec.mustache Adds a runtime dependency constraint for link-header-parser to ensure the generated client installs a compatible major version.
clients/ruby/lib/phrase/response.rb Updates pagination link parsing for link-header-parser 7.x API changes.
clients/ruby/spec/response_spec.rb Adds regression coverage for Phrase::Response pagination behavior.
.gitignore Keeps the new Ruby response spec checked in despite the broader ignore rule for generated Ruby specs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread clients/ruby/lib/phrase/response.rb Outdated
… types

Since the gemspec now requires link-header-parser >= 7.0, which always
returns string keys from group_by_relation_type, there's no need to
convert remote-derived relation-type strings into symbols.

Addresses Copilot review feedback on #1229.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.

latest link-header-parser (+7.0.0) contains breaking changes that crash phrase.

3 participants