-
Notifications
You must be signed in to change notification settings - Fork 244
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
feat: support experimental headers #1425
feat: support experimental headers #1425
Conversation
WalkthroughThe recent changes introduce support for experimental headers in HTTP responses, enabling the use of custom Changes
Assessment against linked issues
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1425 +/- ##
==========================================
+ Coverage 88.55% 88.58% +0.02%
==========================================
Files 127 127
Lines 13604 13634 +30
==========================================
+ Hits 12047 12077 +30
Misses 1557 1557 ☔ View full report in Codecov by Sentry. |
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.
Review Status
Actionable comments generated: 3
Configuration used: CodeRabbit UI
Files ignored due to path filters (3)
tests/snapshots/execution_spec__experimental-headers.md_assert_0.snap
is excluded by:!**/*.snap
tests/snapshots/execution_spec__experimental-headers.md_client.snap
is excluded by:!**/*.snap
tests/snapshots/execution_spec__experimental-headers.md_merged.snap
is excluded by:!**/*.snap
Files selected for processing (8)
- generated/.tailcallrc.graphql (1 hunks)
- generated/.tailcallrc.schema.json (1 hunks)
- src/blueprint/server.rs (4 hunks)
- src/config/headers.rs (1 hunks)
- src/config/server.rs (1 hunks)
- src/http/request_context.rs (3 hunks)
- src/http/request_handler.rs (4 hunks)
- tests/execution/experimental-headers.md (1 hunks)
Check Runs (1)
codecov/patch completed (2)
- src/http/request_handler.rs: 169-169: Added line #L169 was not covered by tests
- src/http/request_handler.rs: 172-172: Added line #L172 was not covered by tests
Additional comments: 11
tests/execution/experimental-headers.md (1)
- 1-44: The documentation provides a clear example of how to define and test experimental headers using GraphQL schema and mock requests. It's well-structured and aligns with the PR's objectives of supporting
x-*
headers.src/config/headers.rs (1)
- 21-24: The addition of the
experimental
field to theHeaders
struct is well-implemented. It allows for the inclusion of experimental headers in server responses, aligning with the PR's objectives. The use ofOption<Vec<String>>
is appropriate for optional and multiple values.src/http/request_context.rs (3)
- 22-22: The introduction of the
experimental_headers
field to theRequestContext
struct is correctly implemented. This field is essential for handling experimental headers throughout the request lifecycle.- 101-101: Initialization of the
experimental_headers
field withHeaderMap::new()
in theFrom<&AppContext>
implementation is correct, ensuring that each request context starts with an empty set of experimental headers.- 132-132: Similarly, initializing the
experimental_headers
field in the test module's defaultRequestContext
is appropriate, ensuring consistency in test environments.src/blueprint/server.rs (2)
- 33-33: Adding the
experimental_headers
field to theServer
struct is a crucial step in supporting experimental headers. This field allows specifying which headers are considered experimental at the server level.- 75-77: The
get_experimental_headers
method correctly converts theexperimental_headers
vector into aBTreeSet<String>
for efficient access and deduplication. This method facilitates the retrieval of experimental headers in a structured manner.src/config/server.rs (1)
- 175-180: The
get_experimental_headers
method is implemented correctly, providing a way to retrieve experimental headers defined in the server configuration. This method ensures that experimental headers can be accessed and utilized where needed.src/http/request_handler.rs (2)
- 71-77: The creation of allowed headers, including experimental headers, is correctly implemented. This step is crucial for filtering and including only the allowed and experimental headers in the request context.
- 93-103: The
update_experimental_headers
function correctly updates the response headers with the experimental headers from the request context. This implementation ensures that experimental headers are correctly forwarded in the server's response.generated/.tailcallrc.graphql (1)
- 580-584: The addition of the
experimental
field to theHeaders
input type is correctly implemented and documented. It aligns with the PR's objective to support experimental headers.Please ensure the application correctly processes these headers and includes them in responses as intended.
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.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (1)
- tests/execution/experimental-headers.md (1 hunks)
Additional comments: 3
tests/execution/experimental-headers.md (3)
- 3-15: The GraphQL schema definition correctly implements the functionality for handling experimental headers as outlined in the PR objectives. This is a well-structured approach to extending the server's capabilities.
- 18-32: The mock YAML configuration correctly demonstrates the inclusion of experimental headers in a request. However, the presence of
x-not-allowed
header raises questions about its purpose in this context. Is it intended to test the server's behavior with unsupported headers? Clarification would be helpful.- 34-42: The YAML configuration for the assertion correctly tests the server's handling of experimental headers in a GraphQL request. This aligns with the PR objectives and demonstrates the desired functionality effectively.
# Conflicts: # benches/impl_path_string_for_evaluation_context.rs # generated/.tailcallrc.graphql # generated/.tailcallrc.schema.json # src/config/headers.rs # src/http/request_context.rs # src/http/request_handler.rs
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.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files ignored due to path filters (1)
tests/snapshots/execution_spec__experimental-headers.md_merged.snap
is excluded by:!**/*.snap
Files selected for processing (8)
- benches/impl_path_string_for_evaluation_context.rs (1 hunks)
- generated/.tailcallrc.graphql (1 hunks)
- generated/.tailcallrc.schema.json (1 hunks)
- src/blueprint/server.rs (4 hunks)
- src/config/headers.rs (2 hunks)
- src/config/server.rs (2 hunks)
- src/http/request_context.rs (3 hunks)
- src/http/request_handler.rs (4 hunks)
Files skipped from review as they are similar to previous changes (7)
- generated/.tailcallrc.graphql
- generated/.tailcallrc.schema.json
- src/blueprint/server.rs
- src/config/headers.rs
- src/config/server.rs
- src/http/request_context.rs
- src/http/request_handler.rs
Additional comments: 1
benches/impl_path_string_for_evaluation_context.rs (1)
- 250-250: The addition of
experimental_headers
toRequestContext
aligns with the PR's objectives. Ensure that this new field is utilized effectively in processing and includingx-*
headers in API responses.Verification successful
The verification process has confirmed that the
experimental_headers
field is correctly added, initialized, and utilized across the application for handling HTTP requests and responses, aligning with the PR's objectives. The usage and configuration of this field are consistent with the intended purpose of managing experimental headers effectively.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify that `experimental_headers` is used in HTTP request and response handling. rg --type rust 'experimental_headers'Length of output: 1518
Realized after merging that we need a test to make sure
|
Co-authored-by: Tushar Mathur <tusharmath@gmail.com>
Issue Reference(s):
Fixes #1413
/claim #1413
Doc PR: tailcallhq/tailcallhq.github.io#157
Build & Testing:
cargo test
successfully../lint.sh --mode=fix
to fix all linting issues raised by./lint.sh --mode=check
.Checklist:
<type>(<optional scope>): <title>
Summary by CodeRabbit
Summary by CodeRabbit