Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(runtime): move subgraph execution batching out #605

Merged
merged 5 commits into from
Feb 9, 2025

Conversation

ardatan
Copy link
Member

@ardatan ardatan commented Feb 6, 2025

Batching is now handled by the Gateway not Stitching so a future supergraph executor doesn't need to handle this on its own

Copy link

coderabbitai bot commented Feb 6, 2025

📝 Walkthrough

Summary by CodeRabbit

  • New Features
    • Enhanced request batching for improved subgraph execution efficiency.
  • Refactor
    • Consolidated batching logic by removing configurable batching options from some public APIs.
  • Chores
    • Updated dependencies to incorporate advanced batching support.

These changes standardize batching behavior, potentially requiring adjustments for integrations that relied on previous configuration options.

Walkthrough

This pull request updates the @graphql-mesh/fusion-runtime package by adding the @graphql-tools/batch-execute dependency and refactoring the batching logic. It removes the explicit batch parameter from several public interfaces and function signatures, such as in the federation supergraph handler and unified graph manager, shifting control of batching to internal runtime and Gateway components. Utility functions are also updated to support optional batching via the new dependency.

Changes

Files Change Summary
.changeset/@graphql-mesh_fusion-runtime-605-dependencies.md, packages/fusion-runtime/package.json Added a new dependency: @graphql-tools/batch-execute with version workspace:^ to support batching functionality.
.changeset/chatty-humans-collect.md, packages/fusion-runtime/src/federation/supergraph.ts, packages/fusion-runtime/src/unifiedGraphManager.ts, packages/fusion-runtime/src/utils.ts Refactored batching logic by removing the batch parameter from public interfaces and function signatures, updating internal control flow. Batching is now delegated to the Gateway and controlled internally (e.g., via updated executor initialization in utils and managed by UnifiedGraphManager).

Possibly related PRs

  • enhance(runtime): prepare for the future supergraph executor #590: The changes in the main PR, which involve adding a new dependency for batching functionality, are related to the modifications in the retrieved PR that also enhance batching capabilities within the handleFederationSupergraph function. Both PRs modify the same function and introduce batching logic, indicating a direct connection at the code level.
  • Upcoming Release Changes #599: The changes in the main PR, which involve adding a new dependency to @graphql-mesh/fusion-runtime, are related to the modifications in the retrieved PR that refactor the supergraph execution logic within the same package, indicating a direct connection in their codebase.

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7fbe763 and 0172d63.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (6)
  • .changeset/@graphql-mesh_fusion-runtime-605-dependencies.md (1 hunks)
  • .changeset/chatty-humans-collect.md (1 hunks)
  • packages/fusion-runtime/package.json (1 hunks)
  • packages/fusion-runtime/src/federation/supergraph.ts (0 hunks)
  • packages/fusion-runtime/src/unifiedGraphManager.ts (1 hunks)
  • packages/fusion-runtime/src/utils.ts (4 hunks)
💤 Files with no reviewable changes (1)
  • packages/fusion-runtime/src/federation/supergraph.ts
🚧 Files skipped from review as they are similar to previous changes (4)
  • .changeset/@graphql-mesh_fusion-runtime-605-dependencies.md
  • packages/fusion-runtime/package.json
  • .changeset/chatty-humans-collect.md
  • packages/fusion-runtime/src/unifiedGraphManager.ts
🧰 Additional context used
📓 Path-based instructions (2)
`packages/**`: In this directory we keep all packages releva...

packages/**: In this directory we keep all packages relevant to the gateway.

In most cases, when changes are made to the source code / dependencies in these directories, we also require to have a corresponding changeset file, created using yarn changeset with a full description on the changes with an example.
Also, when new features are added the packages, the changeset file should mention minor semver change. When a bug is fixed, patch needs to be used. The major bump is used for a PR that has breaking changes.

  • packages/fusion-runtime/src/utils.ts
`**`: For all PRs, we would like to verify that a Linear iss...

**: For all PRs, we would like to verify that a Linear issue is linked. Check if there's a mention for "GW-*" in the PR description, and the us know when it's missing.

In most cases, when a PR adds a new functionality, we would like to make sure it has documentation in the corresponding console project.
Use the global knowledge feature to search for PRs in graphql-hive/console repository that adds documentation. Suggest to create a follow up issue to add the missing documentation.

  • packages/fusion-runtime/src/utils.ts
⏰ Context from checks skipped due to timeout of 90000ms (27)
  • GitHub Check: E2E / Bun Docker on Ubuntu
  • GitHub Check: E2E / Bun on Ubuntu
  • GitHub Check: E2E / Node Binary on Windows
  • GitHub Check: Leaks / Node v23
  • GitHub Check: Leaks / Node v22
  • GitHub Check: E2E / Node Binary on Ubuntu
  • GitHub Check: E2E / Node Docker on Ubuntu
  • GitHub Check: Leaks / Node v20
  • GitHub Check: E2E / Node 23 on Ubuntu
  • GitHub Check: Leaks / Node v18
  • GitHub Check: Snapshot / snapshot
  • GitHub Check: Unit / Node v23
  • GitHub Check: E2E / Node 22 on Ubuntu
  • GitHub Check: Benchmark / bun / 1000 items
  • GitHub Check: Unit / Node v22
  • GitHub Check: E2E / Node 20 on Ubuntu
  • GitHub Check: Benchmark / bun / 100 items
  • GitHub Check: Benchmark / bun / 10 items
  • GitHub Check: Unit / Node v20
  • GitHub Check: Bundle
  • GitHub Check: E2E / Node 18 on Ubuntu
  • GitHub Check: Benchmark / node / 1000 items
  • GitHub Check: Benchmark / node / 100 items
  • GitHub Check: Build
  • GitHub Check: Unit / Node v18
  • GitHub Check: Benchmark / node / 10 items
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (4)
packages/fusion-runtime/src/utils.ts (4)

16-16: LGTM: Import for batching executor.

The import of getBatchingExecutor aligns with the PR's objective of moving batching functionality to the Gateway.


164-182: LGTM: Optional batching parameter with sensible default.

The batch parameter is optional and defaults to true, maintaining backward compatibility while allowing explicit control over batching behavior.


243-248: Verify the batching context.

The implementation uses executionRequest.context || subgraphExecutorMap as the batching context. While this works, it's worth verifying that:

  1. Using the executor map as a fallback context won't cause unintended side effects
  2. The batching context is properly isolated between different requests
✅ Verification successful

🏁 Script executed:

#!/bin/bash
# Search for other uses of getBatchingExecutor to understand the expected context
ast-grep --pattern 'getBatchingExecutor($_)'

# Search for potential race conditions or context sharing
rg -A 5 'executionRequest.context'

Length of output: 4179


Batching context verified.

The scan results indicate that using executionRequest.context || subgraphExecutorMap is consistent with other areas of the code. The primary executor context is provided via executionRequest.context, and falling back to subgraphExecutorMap appears to be an intentional and safe design choice. There are no indications of unintended side effects or shared state races between requests.


1-713: Missing changeset file for the package update.

According to the coding guidelines, we need a changeset file for package updates. Since this change adds a new dependency and modifies the public API, we need a changeset with a minor version bump.

🧰 Tools
🪛 Biome (1.9.4)

[error] 409-409: void is confusing inside a union type.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 430-430: void is confusing inside a union type.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 450-450: void is confusing inside a union type.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@theguild-bot
Copy link
Collaborator

theguild-bot commented Feb 6, 2025

🚀 Snapshot Release (alpha)

The latest changes of this PR are available as alpha on npm (based on the declared changesets):

Package Version Info
@graphql-mesh/fusion-runtime 0.11.0-alpha-0172d637bbe2320dd3a4da984960899c3ad74d97 npm ↗︎ unpkg ↗︎
@graphql-hive/gateway 1.9.5-alpha-0172d637bbe2320dd3a4da984960899c3ad74d97 npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-opentelemetry 1.3.41-alpha-0172d637bbe2320dd3a4da984960899c3ad74d97 npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-prometheus 1.3.29-alpha-0172d637bbe2320dd3a4da984960899c3ad74d97 npm ↗︎ unpkg ↗︎
@graphql-hive/gateway-runtime 1.4.13-alpha-0172d637bbe2320dd3a4da984960899c3ad74d97 npm ↗︎ unpkg ↗︎

@theguild-bot
Copy link
Collaborator

theguild-bot commented Feb 6, 2025

🚀 Snapshot Release (Binary for Linux-X64)

The latest changes of this PR are available for download (based on the declared changesets).

Download

@theguild-bot
Copy link
Collaborator

theguild-bot commented Feb 6, 2025

🚀 Snapshot Release (Bun Docker Image)

The latest changes of this PR are available as image on GitHub Container Registry (based on the declared changesets):

ghcr.io/graphql-hive/gateway:1.9.5-alpha-0172d637bbe2320dd3a4da984960899c3ad74d97-bun

@theguild-bot
Copy link
Collaborator

theguild-bot commented Feb 6, 2025

🚀 Snapshot Release (Binary for Linux-ARM64)

The latest changes of this PR are available for download (based on the declared changesets).

Download

@theguild-bot
Copy link
Collaborator

theguild-bot commented Feb 6, 2025

🚀 Snapshot Release (Binary for macOS-ARM64)

The latest changes of this PR are available for download (based on the declared changesets).

Download

@theguild-bot
Copy link
Collaborator

theguild-bot commented Feb 6, 2025

🚀 Snapshot Release (Binary for macOS-X64)

The latest changes of this PR are available for download (based on the declared changesets).

Download

@theguild-bot
Copy link
Collaborator

theguild-bot commented Feb 6, 2025

🚀 Snapshot Release (Node Docker Image)

The latest changes of this PR are available as image on GitHub Container Registry (based on the declared changesets):

ghcr.io/graphql-hive/gateway:1.9.5-alpha-0172d637bbe2320dd3a4da984960899c3ad74d97

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 54cf89d and ad877cd.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (6)
  • .changeset/@graphql-mesh_fusion-runtime-605-dependencies.md (1 hunks)
  • .changeset/chatty-humans-collect.md (1 hunks)
  • packages/fusion-runtime/package.json (1 hunks)
  • packages/fusion-runtime/src/federation/supergraph.ts (0 hunks)
  • packages/fusion-runtime/src/unifiedGraphManager.ts (1 hunks)
  • packages/fusion-runtime/src/utils.ts (4 hunks)
💤 Files with no reviewable changes (1)
  • packages/fusion-runtime/src/federation/supergraph.ts
🧰 Additional context used
📓 Path-based instructions (2)
`packages/**`: In this directory we keep all packages releva...

packages/**: In this directory we keep all packages relevant to the gateway.

In most cases, when changes are made to the source code / dependencies in these directories, we also require to have a corresponding changeset file, created using yarn changeset with a full description on the changes with an example.
Also, when new features are added the packages, the changeset file should mention minor semver change. When a bug is fixed, patch needs to be used. The major bump is used for a PR that has breaking changes.

  • packages/fusion-runtime/package.json
  • packages/fusion-runtime/src/utils.ts
  • packages/fusion-runtime/src/unifiedGraphManager.ts
`**`: For all PRs, we would like to verify that a Linear iss...

**: For all PRs, we would like to verify that a Linear issue is linked. Check if there's a mention for "GW-*" in the PR description, and the us know when it's missing.

In most cases, when a PR adds a new functionality, we would like to make sure it has documentation in the corresponding console project.
Use the global knowledge feature to search for PRs in graphql-hive/console repository that adds documentation. Suggest to create a follow up issue to add the missing documentation.

  • packages/fusion-runtime/package.json
  • packages/fusion-runtime/src/utils.ts
  • packages/fusion-runtime/src/unifiedGraphManager.ts
⏰ Context from checks skipped due to timeout of 90000ms (44)
  • GitHub Check: Examples / Convert operation-field-permissions
  • GitHub Check: Examples / Convert type-merging-batching
  • GitHub Check: Examples / Convert subscriptions-with-transforms
  • GitHub Check: Examples / Convert programmatic-batching
  • GitHub Check: Examples / Convert openapi-subscriptions
  • GitHub Check: Examples / Convert openapi-javascript-wiki
  • GitHub Check: Examples / Convert openapi-arg-rename
  • GitHub Check: Examples / Convert openapi-additional-resolvers
  • GitHub Check: Examples / Convert json-schema-subscriptions
  • GitHub Check: Examples / Convert interface-additional-resolvers
  • GitHub Check: Examples / Convert federation-subscriptions-passthrough
  • GitHub Check: Examples / Convert apq-subgraphs
  • GitHub Check: Examples / Convert file-upload
  • GitHub Check: Examples / Convert federation-mixed
  • GitHub Check: Examples / Convert federation-example
  • GitHub Check: Examples / Convert extra-fields
  • GitHub Check: Binary built on ubuntu-24.04-arm
  • GitHub Check: Binary built on windows-latest
  • GitHub Check: Binary built on macos-14
  • GitHub Check: Binary built on macos-13
  • GitHub Check: Bun Docker image
  • GitHub Check: Binary built on ubuntu-latest
  • GitHub Check: Node Docker image
  • GitHub Check: E2E / Bun Docker on Ubuntu
  • GitHub Check: E2E / Bun on Ubuntu
  • GitHub Check: E2E / Node Binary on Windows
  • GitHub Check: Unit / Bun
  • GitHub Check: E2E / Node Binary on Ubuntu
  • GitHub Check: E2E / Node Docker on Ubuntu
  • GitHub Check: Leaks / Node v23
  • GitHub Check: E2E / Node 23 on Ubuntu
  • GitHub Check: Leaks / Node v22
  • GitHub Check: E2E / Node 22 on Ubuntu
  • GitHub Check: Leaks / Node v20
  • GitHub Check: E2E / Node 20 on Ubuntu
  • GitHub Check: Leaks / Node v18
  • GitHub Check: E2E / Node 18 on Ubuntu
  • GitHub Check: Bundle
  • GitHub Check: Benchmark / bun / 1000 items
  • GitHub Check: Benchmark / bun / 100 items
  • GitHub Check: Benchmark / bun / 10 items
  • GitHub Check: Benchmark / node / 1000 items
  • GitHub Check: Benchmark / node / 100 items
  • GitHub Check: Benchmark / node / 10 items
🔇 Additional comments (7)
packages/fusion-runtime/src/unifiedGraphManager.ts (2)

59-69: Interface change aligns with PR objectives.

The removal of the batch option from UnifiedGraphHandlerOpts aligns with moving batching responsibility out of the stitching layer. This is a breaking change as noted in the changeset.


337-337: Batching configuration passed correctly.

The batch parameter is now correctly passed to onSubgraphExecute, ensuring batching is handled at the Gateway level.

packages/fusion-runtime/src/utils.ts (3)

16-16: New dependency imported correctly.

The createBatchingExecutor import from @graphql-tools/batch-execute is added to support the batching functionality.


172-172: Batching configuration with sensible default.

The batch parameter is added with a default value of true, maintaining backward compatibility while allowing explicit control.

Also applies to: 181-181


225-227: Batching implementation looks good.

The conditional batching logic using createBatchingExecutor is implemented correctly. The executor is wrapped only when batching is enabled.

.changeset/@graphql-mesh_fusion-runtime-605-dependencies.md (1)

1-8: Consider updating version bump type.

While the dependency update itself might be a patch, this is part of a breaking change (removal of batch option from UnifiedGraphHandlerOpts). Consider using minor or major version bump instead of patch.

.changeset/chatty-humans-collect.md (1)

1-8: Well-documented breaking change.

The changeset correctly:

  1. Uses minor version bump
  2. Marks the change as breaking
  3. Clearly explains the architectural change moving batching from Stitching to Gateway

packages/fusion-runtime/package.json Show resolved Hide resolved
@theguild-bot
Copy link
Collaborator

theguild-bot commented Feb 6, 2025

🚀 Snapshot Release (Binary for Windows-X64)

The latest changes of this PR are available for download (based on the declared changesets).

Download

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🔭 Outside diff range comments (1)
packages/fusion-runtime/src/utils.ts (1)

1-710:

🧩 Analysis chain

Add changeset for the batching feature.

According to the coding guidelines, we need a changeset file for this feature since it adds new functionality to the package.


🏁 Script executed:

#!/bin/bash
# Check if a changeset file exists for this PR
fd -g "*.md" -t f . .changeset/

Length of output: 2025


Missing changeset for batching feature.
Our check of the changeset directory shows only the following files are present:
• .changeset/@graphql-mesh_fusion-runtime-605-dependencies.md
• .changeset/chatty-humans-collect.md

Neither of these appears to document the batching functionality added in this update. Please add a changeset file that specifically describes the new batching feature, in compliance with the coding guidelines.

🧰 Tools
🪛 Biome (1.9.4)

[error] 406-406: void is confusing inside a union type.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 427-427: void is confusing inside a union type.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 447-447: void is confusing inside a union type.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

🧹 Nitpick comments (1)
packages/fusion-runtime/src/utils.ts (1)

225-227: Consider adding error handling for batching initialization.

While the batching implementation is correct, it might benefit from additional error handling to gracefully handle potential initialization failures.

 if (batch) {
+  try {
     executor = createBatchingExecutor(executor_);
+  } catch (error) {
+    execReqLogger?.error('Failed to initialize batching executor:', error);
+    executor = executor_;
+  }
 }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ad877cd and 5480395.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (6)
  • .changeset/@graphql-mesh_fusion-runtime-605-dependencies.md (1 hunks)
  • .changeset/chatty-humans-collect.md (1 hunks)
  • packages/fusion-runtime/package.json (1 hunks)
  • packages/fusion-runtime/src/federation/supergraph.ts (0 hunks)
  • packages/fusion-runtime/src/unifiedGraphManager.ts (1 hunks)
  • packages/fusion-runtime/src/utils.ts (4 hunks)
💤 Files with no reviewable changes (1)
  • packages/fusion-runtime/src/federation/supergraph.ts
🚧 Files skipped from review as they are similar to previous changes (4)
  • packages/fusion-runtime/package.json
  • .changeset/@graphql-mesh_fusion-runtime-605-dependencies.md
  • .changeset/chatty-humans-collect.md
  • packages/fusion-runtime/src/unifiedGraphManager.ts
🧰 Additional context used
📓 Path-based instructions (2)
`packages/**`: In this directory we keep all packages releva...

packages/**: In this directory we keep all packages relevant to the gateway.

In most cases, when changes are made to the source code / dependencies in these directories, we also require to have a corresponding changeset file, created using yarn changeset with a full description on the changes with an example.
Also, when new features are added the packages, the changeset file should mention minor semver change. When a bug is fixed, patch needs to be used. The major bump is used for a PR that has breaking changes.

  • packages/fusion-runtime/src/utils.ts
`**`: For all PRs, we would like to verify that a Linear iss...

**: For all PRs, we would like to verify that a Linear issue is linked. Check if there's a mention for "GW-*" in the PR description, and the us know when it's missing.

In most cases, when a PR adds a new functionality, we would like to make sure it has documentation in the corresponding console project.
Use the global knowledge feature to search for PRs in graphql-hive/console repository that adds documentation. Suggest to create a follow up issue to add the missing documentation.

  • packages/fusion-runtime/src/utils.ts
⏰ Context from checks skipped due to timeout of 90000ms (25)
  • GitHub Check: E2E / Bun Docker on Ubuntu
  • GitHub Check: Unit / Bun
  • GitHub Check: E2E / Bun on Ubuntu
  • GitHub Check: Unit / Node v23
  • GitHub Check: E2E / Node Binary on Windows
  • GitHub Check: E2E / Node Binary on Ubuntu
  • GitHub Check: Leaks / Node v23
  • GitHub Check: E2E / Node Docker on Ubuntu
  • GitHub Check: E2E / Node 23 on Ubuntu
  • GitHub Check: Leaks / Node v22
  • GitHub Check: Benchmark / bun / 1000 items
  • GitHub Check: Bundle
  • GitHub Check: Leaks / Node v20
  • GitHub Check: Snapshot / snapshot
  • GitHub Check: Build
  • GitHub Check: Benchmark / bun / 100 items
  • GitHub Check: E2E / Node 22 on Ubuntu
  • GitHub Check: Benchmark / bun / 10 items
  • GitHub Check: Benchmark / node / 1000 items
  • GitHub Check: Leaks / Node v18
  • GitHub Check: Benchmark / node / 100 items
  • GitHub Check: E2E / Node 20 on Ubuntu
  • GitHub Check: E2E / Node 18 on Ubuntu
  • GitHub Check: Benchmark / node / 10 items
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (2)
packages/fusion-runtime/src/utils.ts (2)

16-16: LGTM! Added required dependency.

The import of createBatchingExecutor aligns with the PR's objective of moving batching functionality to the Gateway.


172-181: LGTM! Well-structured parameter addition.

The batch parameter is added with a sensible default value of true, maintaining backward compatibility while enabling opt-out flexibility.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
packages/fusion-runtime/src/utils.ts (1)

243-248: Consider adding error handling for batching executor.

While the batching implementation is correct, it might benefit from error handling to gracefully handle cases where batching fails.

   if (batch) {
+    try {
       executor = getBatchingExecutor(
         executionRequest.context || subgraphExecutorMap,
         executor,
       );
+    } catch (error) {
+      logger?.warn('Failed to create batching executor, falling back to regular executor', { error });
+    }
   }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5480395 and 7fbe763.

📒 Files selected for processing (1)
  • packages/fusion-runtime/src/utils.ts (4 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
`packages/**`: In this directory we keep all packages releva...

packages/**: In this directory we keep all packages relevant to the gateway.

In most cases, when changes are made to the source code / dependencies in these directories, we also require to have a corresponding changeset file, created using yarn changeset with a full description on the changes with an example.
Also, when new features are added the packages, the changeset file should mention minor semver change. When a bug is fixed, patch needs to be used. The major bump is used for a PR that has breaking changes.

  • packages/fusion-runtime/src/utils.ts
`**`: For all PRs, we would like to verify that a Linear iss...

**: For all PRs, we would like to verify that a Linear issue is linked. Check if there's a mention for "GW-*" in the PR description, and the us know when it's missing.

In most cases, when a PR adds a new functionality, we would like to make sure it has documentation in the corresponding console project.
Use the global knowledge feature to search for PRs in graphql-hive/console repository that adds documentation. Suggest to create a follow up issue to add the missing documentation.

  • packages/fusion-runtime/src/utils.ts
⏰ Context from checks skipped due to timeout of 90000ms (26)
  • GitHub Check: Unit / Bun
  • GitHub Check: E2E / Bun Docker on Ubuntu
  • GitHub Check: Unit / Node v22
  • GitHub Check: E2E / Bun on Ubuntu
  • GitHub Check: Unit / Node v20
  • GitHub Check: E2E / Node Binary on Windows
  • GitHub Check: E2E / Node Binary on Ubuntu
  • GitHub Check: E2E / Node Docker on Ubuntu
  • GitHub Check: Leaks / Node v23
  • GitHub Check: Snapshot / snapshot
  • GitHub Check: E2E / Node 23 on Ubuntu
  • GitHub Check: Leaks / Node v22
  • GitHub Check: Benchmark / bun / 1000 items
  • GitHub Check: E2E / Node 22 on Ubuntu
  • GitHub Check: Leaks / Node v20
  • GitHub Check: Benchmark / bun / 100 items
  • GitHub Check: E2E / Node 20 on Ubuntu
  • GitHub Check: Benchmark / bun / 10 items
  • GitHub Check: Leaks / Node v18
  • GitHub Check: Bundle
  • GitHub Check: Benchmark / node / 1000 items
  • GitHub Check: Benchmark / node / 100 items
  • GitHub Check: E2E / Node 18 on Ubuntu
  • GitHub Check: Build
  • GitHub Check: Benchmark / node / 10 items
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (3)
packages/fusion-runtime/src/utils.ts (3)

16-16: LGTM: Added batching executor import.

The import of getBatchingExecutor from @graphql-tools/batch-execute aligns with the PR's objective of moving batching functionality to the Gateway.


172-172: LGTM: Added optional batching parameter.

The batch parameter with a default value of true maintains backward compatibility while allowing explicit control over batching behavior.

Also applies to: 181-181


1-713: Add changeset file for the batching changes.

According to the coding guidelines, we need a changeset file for changes to packages. Since this adds new functionality by moving batching to the Gateway, it should be a minor version bump.

✅ Verification successful

🏁 Script executed:

#!/bin/bash
# Check if a changeset file exists for this PR
fd -e md . .changeset/

Length of output: 120


Changeset file for batching changes is present.
The .changeset directory contains a file named .changeset/@graphql-mesh_fusion-runtime-605-dependencies.md, which appears to cover the batching changes that were introduced in this PR. This changeset should trigger the required minor version bump according to our guidelines.

🧰 Tools
🪛 Biome (1.9.4)

[error] 409-409: void is confusing inside a union type.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 430-430: void is confusing inside a union type.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 450-450: void is confusing inside a union type.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

@ardatan
Copy link
Member Author

ardatan commented Feb 7, 2025

@coderabbitai review again

Copy link

coderabbitai bot commented Feb 7, 2025

@ardatan I'll review the changes in the PR.

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@ardatan ardatan changed the title enhance(runtime): move subgraph execution batching out refactor(runtime): move subgraph execution batching out Feb 7, 2025
@ardatan ardatan merged commit e5d77f3 into main Feb 9, 2025
63 checks passed
@ardatan ardatan deleted the seperate-batching branch February 9, 2025 12:03
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.

3 participants