Shopify/graphql-batch
62.2
Adequate · 6 November 2026
641
lines of production code
Ruby
primary language
4
measurements over time
What this system is
This system is a Ruby gem that provides batching and loading capabilities for GraphQL applications, specifically designed to optimize data fetching by grouping multiple requests into single operations. It enables developers to implement custom loaders for various data sources, including ActiveRecord associations, HTTP endpoints, and database records, while ensuring efficient concurrent execution. The library integrates directly with the GraphQL schema to manage execution contexts, supporting both standard queries and mutations with proper isolation.
Features
New example loaders for Active Storage, Associations, HTTP, Records, and Postgres Windows
Added six new example files in the \examples/\ directory demonstrating custom \GraphQL::Batch::Loader\ implementations: \ActiveStorageLoader\ and \ActiveStorageLoaderSTI\ for preloading \has\_one\_attached\ and \has\_many\_attached\ attachments (with STI support in the latter), \AssociationLoader\ for generic ActiveRecord association preloading, \HTTPLoader\ for concurrent external HTTP requests using \concurrent-ruby\ and \connection\_pool\, \RecordLoader\ for loading model records by key, and \WindowKeyLoader\ for loading limited \has\_many\ relationships using Postgres window functions.
examples · high confidence
Behavioural changes
Adopts Shopify Ruby style guide and modernizes loader API
The project now enforces the Shopify Ruby style guide via RuboCop, replacing the previous linting setup. This change accompanies a significant API update: the legacy \Query\-based loading pattern is replaced by a \Loader\ class with \perform\ and \load\ methods, and the library is integrated into GraphQL schemas using the \use\ plugin method instead of manually setting an execution strategy. Additionally, the documentation has been updated to reflect these new usage patterns, including support for promise-based resolution and cache priming.
(repo-wide) · high confidence
GraphQL::Batch v0.6.1: New Executor-based architecture and mutation batching support
This release upgrades GraphQL::Batch to version 0.6.1, introducing a fundamental architectural shift from the deprecated ExecutionStrategy and Resolver classes to a new Executor-based system. The new Executor manages batching contexts via thread-local storage, enabling more robust handling of nested queries and sub-queries through explicit batch start/end lifecycle management. A key behavioral change for users is the introduction of MutationFieldExtension, which automatically clears the batching context for mutations to prevent data leakage between operations, while SetupMultiplex provides instrumentation hooks to integrate this context sharing with graphql-ruby's multiplex execution. The old Query, Resolver, and QueryResolver classes have been removed in favor of the new Loader and Executor abstractions.
lib/graphql/batch · high confidence
Migration to Promise.rb and GraphQL 1.10+ lazy resolution API
The library now relies on the external \promise.rb\ gem for its promise implementation and requires GraphQL 1.10 or later to utilize the native \lazy\_resolve\ API. This shift replaces the previous custom execution strategies and deprecated constants with a standard promise-based interface, allowing users to integrate batching via the \use\ method which configures schema instrumentation and supports custom executor classes.
lib/graphql · high confidence
Test coverage
Added comprehensive test suite for batching, executors, and GraphQL integration; Updated test support fixtures and schema to use class-based GraphQL API.
Dependencies
Update graphql dependency and add rubocop tooling
The gem now requires graphql version 1.13 or higher (up to 3.0) and adds promise.rb as a runtime dependency, while development tooling now includes rubocop and rubocop-shopify for code style enforcement.
(dependencies) · high confidence
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Score
- CAI 60 → 62 (+2.2)
- Rubric changed (rubric-2026.10.5 → rubric-2026.11.2) — scores are not directly comparable.
Lenses
- Code Health 76 → 76 (+0.0)
- Architecture 69 → 69 (+0.0)
- Maturity 49 → 54 (+5.3)
- Readiness 66 → 66 (+0.0)
- Security 90 → 83 (-6.7)
Resolved (2)
- Inconsistent parameter naming for the batch execution method. While all loaders use perform as the method name, the argument names vary significantly (record_ids, records, operations, keys, foreign_ids). This forces consumers to remember specific argument names or rely on positional arguments, reducing readability and IDE support.
- Off-boarding risk: anonymized user #1
New (1)
- Off-boarding risk: anonymized user #1
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
Shopify/graphql-batch was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 6 November 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit 9b8192042d3b7a208132ecf7fd074e9cd864901a — the exact code this score is about.
- Scored under rubric-2026.11.2 — the same rubric and the same method as every other entry in this index.
- Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.2+preprod-5c4e66d9318b.