Repository navigation
[Fusion] Reuse already fetched entities in Apollo entity lookups - #10653
Merged
Merged
Conversation
Contributor
Patch coverage94.8% of changed lines covered (402/424)
Uncovered changed lines (JSON){
"sha": "de2f87185c0759bd7d750b0d4241009e6b25be10",
"files": [
{ "path": "src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Results/FetchResultStore.RepresentationValue.cs", "ranges": [[214, 215], [223, 224], [472, 472], [536, 536], [1789, 1789], [1797, 1797], [1817, 1817], [1823, 1823], [1843, 1843], [1873, 1873], [1928, 1928], [2053, 2053]] },
{ "path": "src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Results/EntityReuseCandidateMap.cs", "ranges": [[378, 379], [468, 469]] },
{ "path": "src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Results/FetchResultStore.cs", "ranges": [[2656, 2656], [3023, 3023], [3087, 3087]] },
{ "path": "src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Nodes/ApolloOperationBatchExecutionNode.cs", "ranges": [[692, 692]] }
]
}Project coverage: 59.2% (314495/530812 lines) |
Apollo lookups now match targets against producers while the representations are written, instead of building throwaway variable value sets and writing the representations a second time. Add tests for both composite and Apollo lookups that cover batches where one or every operation is reused, two mutations that change the same entity, and subscription events that hold the same entity. Request counts and representations are checked with asserts, only responses use inline snapshots.
tobias-tengler
force-pushed
the
tte/apollo-entity-reuse
branch
from
October 21, 2026 09:23
a33d78c to
7e03efd
Compare
tobias-tengler
marked this pull request as ready for review
October 21, 2026 09:24
# Conflicts: # src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Results/FetchResultStore.RepresentationValue.cs
michaelstaib
approved these changes
Oct 22, 2026
michaelstaib
approved these changes
Oct 22, 2026
This was referenced Oct 25, 2026
Merged
This was referenced Nov 16, 2026
fix(deps): Bump Basic.Reference.Assemblies.Net100 and 32 others
AdCodicem/AdCodicem.ValueObjects#262
Closed
This was referenced Nov 23, 2026
fix(deps): Bump Basic.Reference.Assemblies.Net100 and 43 others
AdCodicem/AdCodicem.ValueObjects#274
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Request-scoped entity reuse (#10606) never applies to plans with Apollo
_entitieslookups. An Apollo lookup always sends its representations to the subgraph, even when an earlier fetch of the same request already returned those entities with all the selected fields, so the gateway refetches them.This PR extends entity reuse to
ApolloOperationExecutionNodeandApolloOperationBatchExecutionNode. The candidate map analyzes the rewritten_entitiesoperation, and the Apollo nodes fill entities the result already holds and send only the remaining representations. A lookup whose entities were all reused completes as a success, so its dependents still run. Plans, dependencies and the plan JSON are unchanged.