refactor: response generation and header aggregation#692
refactor: response generation and header aggregation#692
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 significantly refactors the GraphQL response generation and HTTP header handling within the router. By decoupling the creation of Highlights
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 introduces a valuable refactoring of response generation and header aggregation. By moving header aggregation to the pipeline handler and changing PlanExecutionResult to return a response_headers_aggregator, you've effectively eliminated an intermediate HeaderMap creation, which is a good performance optimization. The extraction of FailedExecutionResult generation logic into a From implementation for PipelineError also improves separation of concerns and makes the code cleaner. Overall, these are solid improvements to the codebase. I have one suggestion to further improve readability.
✅
|
|
🐋 This PR was built and pushed to the following Docker images: Image Names: Platforms: Image Tags: Docker metadata{
"buildx.build.ref": "builder-cbf52df3-9af8-4c41-ad67-b6d0e0c5acb2/builder-cbf52df3-9af8-4c41-ad67-b6d0e0c5acb20/jnvpj4ezm1ohp93td3j6mnuap",
"containerimage.descriptor": {
"mediaType": "application/vnd.oci.image.index.v1+json",
"digest": "sha256:39bf35b68a2b1f3161c721a06ec01f78daac475d9db6888d3791237d2c445f30",
"size": 1609
},
"containerimage.digest": "sha256:39bf35b68a2b1f3161c721a06ec01f78daac475d9db6888d3791237d2c445f30",
"image.name": "ghcr.io/graphql-hive/router:pr-692,ghcr.io/graphql-hive/router:sha-99410d7"
} |
Retake of #652 after #665
PipelineErrorto aimpl From<PipelineError> for FailedExecutionResult {so that the result(as an object) is generated independent from HTTPPlanExecutionResultwhich is the return type of the plan executor now returns the response bytes asbody: Vec<u8>andresponse_headers_aggregatorinstead of creating aHeaderMapand returning it. Previously, the plan executor was creatinghttp::HeaderMap, then filling it, then returning it, then the request handler was iterating over it to modify the createdntex::Response's headers. Now the aggregator directly modifies the createdResponseobject in the pipeline handlerHeaderPropagationErroris added toPipelineErrorenum.