Skip to content

feat: Add support for Rails 8, Ruby 3, and latest GraphQL gem#21

Merged
RomKadria merged 56 commits intomainfrom
feature/romka/graphql-new-version-support
Oct 23, 2025
Merged

feat: Add support for Rails 8, Ruby 3, and latest GraphQL gem#21
RomKadria merged 56 commits intomainfrom
feature/romka/graphql-new-version-support

Conversation

@RomKadria
Copy link
Copy Markdown
Collaborator

@RomKadria RomKadria commented Oct 20, 2025

Cherry-picked commits from upstream to support:

  • Rails 8
  • Ruby 3 (including 3.4)
  • GraphQL gem 2.3+ and 2.5.12+
  • Relaxed google-protobuf dependency

Changes include:

  • Removed appraisals for old GraphQL versions
  • Updated google-protobuf to support < 5
  • Added GraphQL-ruby 2.3 compatibility
  • Fixed tracer crash with graphql-ruby 2.5.12+
  • Added Ruby 3.4 dependencies (mutex_m, ostruct)

tubaxenor and others added 30 commits October 20, 2025 11:15
* feat: drop old ruby; remove appraisals

* ruby 3.4 fix

* Fix
* Try new protobuf

* Cop

* Bump version
Co-authored-by: Bajena <jan.bajena@productboard.com>
* Fix tracer crash with graphql-ruby 2.5.12+ (Gusto#297)

In graphql-ruby 2.5.12+, the execute_query_lazy tracer method is no
longer called unconditionally. It now only fires when there are lazy
values to resolve. This change was introduced in graphql-ruby commit
5ba154a561 when lazy handling was merged into the dataloader.

The tracer previously assumed execute_query_lazy "always fires" and
relied on it to set end_time for all queries. Without this method
being called, end_time remains nil, causing crashes when attaching
traces to results.

This fix adds a fallback in execute_multiplex to record end times
for all queries after execution completes. For queries with lazy
values, execute_query_lazy will still fire and overwrite these times
to capture the full execution time including lazy resolution.

This maintains backward compatibility with older graphql-ruby versions
while fixing the crash in 2.5.12+.

* Fix specs because we call record_trace_end_time an additional time.

* Fix rubocop.
- Remove old appraisal-based testing for GraphQL 1.10-2.0
- Test only with Ruby 3.2, 3.3, 3.4
- Test with current GraphQL version (2.0+)
- Remove appraisal-install action
- Align with upstream CI configuration
- Support GraphQL versions from 2.0.19 to < 3.0
- Add targeted appraisal testing for 2.0.19 and 2.5.x
- Test matrix: 3 Ruby versions × 2 GraphQL versions = 6 combinations
- Ensures compatibility with both old (2.0.19) and latest (2.5.x) GraphQL 2.x versions
- Much simpler than old appraisal setup (6 tests vs 15)
- Add 'bundle config set --local frozen false' before appraisal installs
- Allows appraisal to generate different Gemfile.lock files for each GraphQL version
- Fixes 'lockfile can't be updated because frozen mode is set' error
- ruby/setup-ruby automatically sets 'deployment true' which forces frozen mode
- Need to unset deployment mode first, then disable frozen mode
- Fixes: 'lockfile can't be updated because frozen mode is set' error
- bundler-cache: true automatically sets deployment mode
- Set bundler-cache: false for appraisal matrix tests
- Manually run bundle install without frozen/deployment mode
- This allows appraisal to generate different lockfiles for each GraphQL version
GraphQL 2.3+ changed orphan_types to only accept object types.
This wrapper automatically routes non-object types (unions, enums, interfaces)
to extra_types in GraphQL 2.3+, while maintaining backward compatibility
with GraphQL 2.0.x where orphan_types accepts all types.
GraphQL 2.2.14 is a better choice because:
- Fully supports Ruby 3.x and Rails 8
- No orphan_types breaking change (works like 2.0.x)
- More stable with fewer compatibility issues

Testing strategy:
- 2.0.19: Minimum supported version
- 2.2.14: Latest stable without breaking changes
Since we're only supporting GraphQL 2.0.19 and 2.2.14 (not 2.3+), the orphan_types
override is unnecessary. GraphQL 2.2 and earlier accept all types in orphan_types.
The override was potentially interfering with interface type discovery.
…cop cops

These are pre-existing code style issues that we haven't modified.
GraphQL 2.0-2.2 doesn't auto-discover interfaces through implementations.
We need to explicitly pass both the object type and interface type to orphan_types.
GraphQL 2.3+ auto-discovers interfaces, so upstream only passes the object type.

This fixes the 3 interface visibility test failures.
GraphQL 2.2 introduced a change where interfaces should use extra_types instead of orphan_types.
For GraphQL 2.0-2.1, we still use orphan_types for both objects and interfaces.
For GraphQL 2.2+, we use extra_types for interfaces and orphan_types for objects.

This matches the behavior expected by the GraphQL gem.
GraphQL 2.2-2.3 has internal differences from 2.0:
1. Makes one additional Time.now call, resulting in end_time being 1564920004 instead of 1564920003
2. Changed parser error message format from "Unexpected end of document" to "Expected NAME, actual: (none)"

These are internal implementation differences that don't affect functionality.
…cted_end_time in all timing tests

1. GraphQL 2.0-2.2 requires BOTH object and interface in orphan_types.
   Cannot split between orphan_types and extra_types in these versions.
   GraphQL 2.3+ can use extra_types for both types.

2. Fixed timing tests that hardcoded expected_trace_start_time + 2
   instead of using the expected_end_time variable, which properly
   handles the version-specific timing differences.
Comment thread .ruby-version Outdated
Comment thread .github/workflows/ci.yml
- appraisal: 'graphql-1.12'
ruby: '3.2'
ruby: ['3.4']
graphql: ['graphql-2.0.19', 'graphql-2.3']
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@RomKadria maybe worth adding 2.1 and 2.2?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I interntionally havnt as we dont use them

Comment thread .circleci/config.yml Outdated
Comment thread .github/workflows/ci.yml Outdated
@RomKadria RomKadria force-pushed the feature/romka/graphql-new-version-support branch from 1fb1980 to bdc1642 Compare October 22, 2025 10:23
Update minimum Ruby version support and migrate CI from CircleCI to GitHub Actions.

BREAKING CHANGE: This release may affect projects using older Ruby versions. Please review compatibility before upgrading.
@RomKadria RomKadria changed the title feat: Add support for Rails 8, Ruby 3, and latest GraphQL gem feat!: Add support for Rails 8, Ruby 3, and latest GraphQL gem Oct 22, 2025
…m:mondaycom/apollo-federation-ruby into feature/romka/graphql-new-version-support
Test gem compatibility with Ruby 2.7 and 3.4 across GraphQL versions.

- Add Ruby 2.7 to all CI jobs (lint, test, integration)
- Make debug, rackup, mutex_m, and ostruct conditional based on Ruby version
- Ensure Ruby 2.7 compatibility for development dependencies
Bundler 2.6.6 requires Ruby >= 3.1.0, so we need to use an older
compatible version (2.3.x) when running tests on Ruby 2.7.
Run 'bundle update --bundler' to update the lockfile to use bundler 2.3.x
when running on Ruby 2.7, avoiding the incompatibility with bundler 2.6.6.
Use the 'bundler' parameter in ruby/setup-ruby action to install
bundler 2.3 for Ruby 2.7 and default for Ruby 3.4, preventing
the automatic installation of incompatible bundler 2.6.6.
RuboCop warns against using RUBY_VERSION in gemspec files as it can
cause issues during gem building. Use Gem.ruby_version instead.

Also refactored lint job to only run on Ruby 3.4 since linting checks
code style/quality, not runtime behavior, making multiple Ruby versions
redundant.
@RomKadria RomKadria changed the title feat!: Add support for Rails 8, Ruby 3, and latest GraphQL gem feat: Add support for Rails 8, Ruby 3, and latest GraphQL gem Oct 22, 2025
@RomKadria RomKadria merged commit 10b1dac into main Oct 23, 2025
13 checks passed
github-actions bot pushed a commit that referenced this pull request Oct 26, 2025
# [3.16.0](v3.15.1...v3.16.0) (2025-10-26)

### Features

* Add support for Rails 8, Ruby 3, and latest GraphQL gem ([#21](#21)) ([10b1dac](10b1dac))
* improve README formatting for installation instructions ([#25](#25)) ([874e497](874e497))
* publish new version ([#24](#24)) ([b4bbd19](b4bbd19))
* revert GEM_HOST_API_KEY secret name for semantic-release ([#26](#26)) ([0fbfc10](0fbfc10))
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.

6 participants