-
Notifications
You must be signed in to change notification settings - Fork 2
enhance(executor): normalize flatten errors for the final response #454
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enhances the executor to normalize flatten errors for the final response by tracking error paths during traversal and handling errors with correct path information. The changes enable proper error attribution when processing flattened entities across multiple subgraphs.
Key changes:
- Enhanced the
traverse_and_callback_mut
function to track error paths during traversal - Modified error handling to normalize error paths for flattened entities
- Added comprehensive test coverage for error path collection and normalization
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
lib/executor/src/utils/traverse.rs | Enhanced traversal function to track error paths and added test coverage |
lib/executor/src/response/graphql_error.rs | Added PartialEq trait to GraphQLErrorPathSegment for testing |
lib/executor/src/execution/plan.rs | Modified execution logic to collect and normalize error paths for flatten operations |
lib/executor/src/context.rs | Enhanced error handling to process normalized error paths for entities |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <[email protected]>
@gemini-code-assist write a summary of the changes here |
Summary of ChangesThis pull request significantly refines the error handling within the executor, focusing on how errors from flattened subgraph responses are presented to the client. By introducing a robust system for normalizing error paths, it ensures that errors are accurately associated with their corresponding data points in the final merged GraphQL response, improving the clarity and utility of error messages for consumers of the API. Highlights
Changelog
Activity
|
🐋 This PR was built and pushed to the following Docker images: Image Names: Platforms: Image Tags: Docker metadata{
"buildx.build.ref": "builder-99175c53-6758-44bd-8c3f-3de17dd887dd/builder-99175c53-6758-44bd-8c3f-3de17dd887dd0/byg7tntb2wzl8v7cyghf19615",
"containerimage.descriptor": {
"mediaType": "application/vnd.oci.image.index.v1+json",
"digest": "sha256:5433f26b150283cdea8f8b64e8609d1e47a8e7e288e23c35e1856952edd2a92f",
"size": 1609
},
"containerimage.digest": "sha256:5433f26b150283cdea8f8b64e8609d1e47a8e7e288e23c35e1856952edd2a92f",
"image.name": "ghcr.io/graphql-hive/router:pr-454,ghcr.io/graphql-hive/router:sha-98b90aa"
} |
✅
|
@gemini-code-assist review the PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request enhances error handling for FlattenNode
executions by normalizing error paths that originate from entity fetches. The changes correctly map internal _entities
paths to their corresponding paths in the final GraphQL response. My review focuses on the correctness of this new error handling logic and suggests some improvements for code clarity and robustness. I've identified a critical issue where errors could be silently dropped and a medium-severity issue for improving code style.
@gemini-code-assist review the PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request correctly remaps error paths from the internal _entities
representation to the final response paths. The changes look good overall. I've identified one bug where an error could be silently dropped and suggested a fix that also improves performance. I've also left a few comments regarding code style and duplication to improve maintainability.
Closes #228
After the execution of
FlattenNode
, the entity responses contain the path like["_entities", 0]
which doesn't reflect the correct path in the final response.This PR collects the path segments in the final response for each entity only if there is an error, then re-creates the errors that have
_entities
in their path, then replaces this path with the correct path in the final response.After this gets merged, I'll work on another PR that adds some extensions to the errors to specify which error belongs to which subgraph etc.