Shopify/graphql-batch
64.7
Adequate · 19 September 2026
641
lines of production code
Ruby
primary language
1
measurement 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 watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Baseline
- First survey — no prior run to compare against. CAI 65.
Lenses
- Code Health 100
- Architecture 69
- Maturity 57
- Readiness 64
- Security 88
Changes since last survey
- 281 commits — 237 feature/other, 44 fixes
By area
- lib/graphql — 85 commits
- (repo) — 80 commits
- (root) — 55 commits
- .github/workflows — 36 commits
- test/support — 8 commits
- examples/active_storage_loader.rb — 4 commits
- examples/http_loader.rb — 3 commits
- test/batch_test.rb — 2 commits
- test/loader_test.rb — 2 commits
- examples/active_storage_loader_sti.rb — 1 commit
- examples/association_loader.rb — 1 commit
- examples/record_loader.rb — 1 commit
- test/custom_executor_test.rb — 1 commit
- test/execution_strategy_test.rb — 1 commit
- test/graphql_test.rb — 1 commit
Notable commits
- fix: Add allowed_push_host to gemspec to fix release script
- fix: Add regression test for execution errors in non-nullable fields re: rmosolgo/graphql-ruby#296 and #18
- fix: Fix ActiveStorageLoader example
- fix: Fix AssociationLoader Rails 7 Deprecation Warning
- fix: Fix CI matrix
- fix: Fix Lint/MissingSuper rubocop offense in the examples
- fix: Fix NoExecutorError (#74)
- fix: Fix README.md markup (#8)
- fix: Fix RecordLoader example and make it easier to handle missing results.
- fix: Fix a link to CI
- fix: Fix batching loading in mutation subselection (#32)
- fix: Fix compatibility with non-class based mutation root object (#103)
- fix: Fix errant Graphql constant (#12)
- fix: Fix handling ExecutionError in promise callback of non-null field (#23)
- fix: Fix kwargs hash sharing in Loader.for on Ruby 4.0
- fix: Fix link to repo
- fix: Fix mutation execution test to avoid returning stale data after mutation
- fix: Fix reject_pending_promises handling
- fix: Fix resolving loader when Loader.for is used without load (#31)
- fix: Fix ruby 2.7 keyword arguments warning (#127)
- …and 261 more
Written by watchdog.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 19 September 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.09.15 — the same rubric and the same method as every other entry in this index.
- Measured by watchdog.canine.dev using codehealth-analyzer preprod-b51f968c9b10.