enhance(executor): simplify subgraph execution error handling#659
enhance(executor): simplify subgraph execution error handling#659
Conversation
Summary of ChangesHello @ardatan, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request refactors the error handling mechanism within the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request significantly simplifies the error handling within the subgraph executor by propagating Result types instead of manually creating GraphQLError responses at lower levels. This is an excellent improvement that makes the code more idiomatic, readable, and maintainable. The introduction of SubgraphExecutorError into PlanExecutionErrorKind and the use of with_plan_context correctly centralize error handling. The new E2E test effectively validates that the router can gracefully handle a failing subgraph and return partial data. My review includes one suggestion to refactor the new E2E test for better readability, in line with the repository's style guide.
✅
|
|
🐋 This PR was built and pushed to the following Docker images: Image Names: Platforms: Image Tags: Docker metadata{
"buildx.build.ref": "builder-ad53c298-1825-4ba3-b8a9-f4622536c471/builder-ad53c298-1825-4ba3-b8a9-f4622536c4710/u8hsvoqs7a1f3xidr33eoy90l",
"containerimage.descriptor": {
"mediaType": "application/vnd.oci.image.index.v1+json",
"digest": "sha256:2f6eb712a8353130eeeb6cdc277419dcb9910f2de26d5340aa04c5159e69f4ef",
"size": 1609
},
"containerimage.digest": "sha256:2f6eb712a8353130eeeb6cdc277419dcb9910f2de26d5340aa04c5159e69f4ef",
"image.name": "ghcr.io/graphql-hive/router:pr-659,ghcr.io/graphql-hive/router:sha-b6e549b"
} |
531fab5 to
da2b03c
Compare
545e76a to
07a31e0
Compare
07a31e0 to
cda96e0
Compare
kamilkisiela
left a comment
There was a problem hiding this comment.
All good, except the e2e test I find hard to understand and could be simpler
Extracted from #628
Now
SubgraphExecutorcan throwSubgraphExecutorErrorwhich will be coerced toPlanExecutorError.So that the execution related errors and the errors propagated from the subgraph can be distinguished.
Combining this with #651, we no longer need to generate dummy subgraph response objects with
GraphQLErrors. It was a bit complicated before because in different levels, helpers likeerror_to_graphql_bytesandinternal_server_error_responsewere handling those errors in different places, so it was hard to debug it.Right now the subgraph response will be the actual subgraph response while the rest of the execution errors thrown by us will be handled as
PlanExecutionError.Of course an error in a plan node will not stop the request entirely for such cases like a subgraph is down etc which is tested in an E2E test added with this PR.
To summarize the idea is to take the responsibility of
errortoresponseconversion from the subgraph executor to the plan executor.I also removed unused methods;
And removed unnecessary methods;