Skip to content

[Fusion] Merge identical Apollo entity lookups across target paths - #10607

Merged
tobias-tengler merged 6 commits into
mainfrom
tte/fusion-merge-apollo-entity-lookups
Oct 20, 2026
Merged

tobias-tengler merged 6 commits into
mainfrom
tte/fusion-merge-apollo-entity-lookups

Conversation

@tobias-tengler

@tobias-tengler tobias-tengler commented Oct 18, 2026 •

Copy link
Copy Markdown
Member

Apollo Federation lookups for the same entity at the same dependency depth are sent as a separate _entities operation per target path, even when they are structurally identical. For the apollo-federation benchmark query this means 13 subgraph operations across the 7 HTTP requests, with the same representations sent several times.

This PR merges structurally identical Apollo lookups (same source schema, entity type, requirements, selections and dependency depth) into one multi-target lookup with one deduplicated representation list, as the planner already does for composite-schema lookups. Lookups at the same schema and depth already share a request batch, so the merge adds no waits and no selections to any lookup. OperationPlanner.Version goes to 2.3.0 and the operation plan JSON format to 1.2.0, since ApolloOperationBatch entries can now carry targets.

Benchmark query Version HTTP requests Subgraph operations
apollo-federation main 7 13
apollo-federation PR 7 8

@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Patch coverage

78.8% of changed lines covered (313/397)

File Covered Changed Patch %
…/Execution/Nodes/ApolloOperationExecutionNode.cs 0 1 0.0% 🔴
…/Fusion/src/Fusion.Execution/Execution/ThrowHelper.cs 0 3 0.0% 🔴
…/src/Fusion.Execution/Execution/OperationPlanContext.cs 13 26 50.0% 🔴
…/Execution/Nodes/ApolloOperationBatchExecutionNode.cs 99 151 65.6% 🔴
…/Execution/Results/FetchResultStore.RepresentationValue.cs 26 30 86.7% 🟡
…/Planning/OperationPlanner.BuildExecutionTree.cs 116 127 91.3% 🟡
…/Execution/Nodes/Serialization/JsonOperationPlanFormatter.cs 12 12 100.0% 🟢
…/Execution/Nodes/Serialization/JsonOperationPlanParser.cs 35 35 100.0% 🟢
…/Execution/Nodes/Serialization/YamlOperationPlanFormatter.cs 11 11 100.0% 🟢
…/Fusion/src/Fusion.Execution/Planning/OperationPlanner.cs 1 1 100.0% 🟢
Uncovered changed lines (JSON)
{
  "sha": "28ff71390a02bb201ae1aba6d872c9c24d78670e",
  "files": [
    { "path": "src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Nodes/ApolloOperationExecutionNode.cs", "ranges": [[243, 243]] },
    { "path": "src/HotChocolate/Fusion/src/Fusion.Execution/Execution/ThrowHelper.cs", "ranges": [[86, 86], [89, 89], [92, 92]] },
    { "path": "src/HotChocolate/Fusion/src/Fusion.Execution/Execution/OperationPlanContext.cs", "ranges": [[564, 570], [581, 582], [598, 599], [601, 601], [604, 604]] },
    { "path": "src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Nodes/ApolloOperationBatchExecutionNode.cs", "ranges": [[160, 162], [168, 170], [206, 208], [214, 216], [219, 222], [224, 229], [233, 238], [258, 263], [265, 265], [267, 272], [274, 276], [278, 280], [583, 584], [595, 595], [651, 651], [659, 659]] },
    { "path": "src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Results/FetchResultStore.RepresentationValue.cs", "ranges": [[170, 171], [194, 195]] },
    { "path": "src/HotChocolate/Fusion/src/Fusion.Execution/Planning/OperationPlanner.BuildExecutionTree.cs", "ranges": [[1619, 1619], [1650, 1651], [1679, 1684], [2072, 2073]] }
  ]
}

Project coverage: 59.1% (313178/529511 lines)

@tobias-tengler
tobias-tengler force-pushed the tte/fusion-merge-apollo-entity-lookups branch from e8ad0c7 to 9510133 Compare October 20, 2026 15:20
@tobias-tengler
tobias-tengler marked this pull request as ready for review October 20, 2026 15:56
Copilot AI balanced review requested due to automatic review settings October 20, 2026 15:56

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

…paths

Covers planning, JSON plan round-trip and subgraph requests for structurally
identical Apollo _entities lookups that target different paths. The snapshots
record the current behavior: one _entities operation per target path.
Structurally identical Apollo _entities lookups that target the same source
schema and sit at the same dependency depth now merge into one multi-target
lookup with one deduplicated representation list, like the composite-schema
merge. Bumps OperationPlanner.Version to 2.3.0 and the operation plan JSON
format to 1.2.0 (ApolloOperationBatch entries may carry targets).
@tobias-tengler
tobias-tengler force-pushed the tte/fusion-merge-apollo-entity-lookups branch from 04b8a34 to f49f66f Compare October 20, 2026 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants