-
Notifications
You must be signed in to change notification settings - Fork 1
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
refactor(proto): redefine HTTP headers structure #4
Conversation
Because who doesn't love a little complexity?
Warning Rate limit exceeded@madflojo has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 22 minutes and 45 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. WalkthroughThe pull request introduces significant changes to the Changes
Possibly related PRs
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 using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Copilot
AI
left a comment
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.
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 suggestion.
Co-authored-by: Copilot <[email protected]>
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.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (3)
sdk/http.proto (3)
40-40
: Document header value handling in responsesThe change to support multiple header values is particularly important for responses, as common headers like
Set-Cookie
often have multiple values. Consider adding examples in the proto comments showing how to handle multi-valued headers.// Headers are the HTTP headers returned from the HTTP request. + // Example headers that commonly have multiple values: + // - Set-Cookie: Multiple cookies set in one response + // - Vary: Multiple cache variation headers + // - Access-Control-Allow-Headers: Multiple CORS headers map<string, Header> headers = 3;
47-55
: Review field numbering in Header messageThe
value
field uses number 2, suggesting field 1 might have been removed or is reserved. Consider either:
- Using field number 1 if no fields are reserved
- Adding a comment explaining why field 1 is skipped
- Adding explicit reserved fields if they're intended for future use
message Header { + // Reserved for future use + reserved 1; // Value is the HTTP header value to include in requests and responses. // This field is a repeated field to allow for multiple values // which is allowed in HTTP headers. repeated string value = 2; }Additionally, consider adding validation constraints in implementations to ensure header values follow RFC 7230 specifications.
Line range hint
1-55
: Consider versioning strategy for breaking changesThe changes correctly implement HTTP header specifications but introduce breaking changes. Consider:
- Adding a version field to the package name (e.g.,
tarmac.http.v2
)- Providing migration guides in documentation
- Implementing client-side utilities to help convert between old and new formats
- Adding examples of common header patterns (e.g., authorization, content-type, accept)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
sdk/http.proto
(2 hunks)
🔇 Additional comments (1)
sdk/http.proto (1)
15-15
: Breaking change: Verify client compatibility
The change from map<string, string>
to map<string, Header>
is a breaking change that will require updates to all clients using this proto definition. While this change correctly implements HTTP header specifications by supporting multiple values, it requires careful migration planning.
✅ Verification successful
Breaking change is well-documented and isolated
The change from map<string, string>
to map<string, Header>
is a breaking but necessary change that:
- Is properly documented with the new
Header
message type - Correctly implements HTTP header specifications by supporting multiple values
- Is isolated to the HTTP protocol definitions only, with no direct dependencies in other proto files
- Has clear documentation in the proto file explaining the purpose of the change
The breaking change is acceptable as it's part of the core protocol definition and improves RFC compliance. The Header message type is well-defined with clear documentation about its purpose for supporting multiple values in HTTP headers.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Look for potential client implementations that need updating
# Search for HTTPClient usage in Go files
echo "Searching for Go implementations..."
rg -t go "HTTPClient.*headers"
# Search for potential gRPC client implementations in other languages
echo "Searching for other client implementations..."
fd -e java -e py -e js -e ts | xargs rg "HTTPClient.*headers"
Length of output: 427
Script:
#!/bin/bash
# Let's first understand the structure of the codebase and look for any client implementations
# Find all proto files to understand the service structure
echo "Proto files in the repository:"
fd -e proto
# Look for any references to the http.proto file
echo -e "\nReferences to http.proto:"
rg -l "http\.proto"
# Search for any HTTP-related implementations
echo -e "\nHTTP-related implementations:"
rg -l -t go -t java -t python -t typescript -t javascript "http.*client"
# Look for build or generation configuration files that might indicate client usage
echo -e "\nBuild/generation config files:"
fd -e yaml -e yml -e json | grep -i "proto\|grpc\|build"
Length of output: 582
Script:
#!/bin/bash
# Let's check the README.md since it references http.proto and examine the actual proto files
# Check README.md content for context about client usage
echo "Checking README.md for client usage context:"
rg -A 5 -B 5 "http\.proto" README.md
# Check if the Header message type is already defined in http.proto
echo -e "\nChecking Header message definition:"
cat sdk/http.proto
# Check other proto files for dependencies on HTTPClient
echo -e "\nChecking other proto files for HTTPClient dependencies:"
rg "HTTPClient" sdk/*.proto
Length of output: 3070
Because even headers like to multiply sometimes.
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.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (2)
sdk/http.proto (2)
15-15
: LGTM! Consider adding header validation.The change to support multiple values per header aligns with HTTP specifications. However, consider adding validation rules (either in implementation or documentation) for headers that typically expect single values (e.g., Content-Length, Host).
47-55
: Enhance documentation with examples.The Header message structure and comments are clear. Consider adding example usage in the comments to illustrate common scenarios:
// Header is a structure used to define HTTP headers for HTTP requests. // As HTTP headers can have multiple values, this structure is used to define // the header values. +// +// Example usage: +// Accept: ["text/html", "application/json"] +// Set-Cookie: ["session=abc123", "theme=dark"] message Header { // Value is the HTTP header value to include in requests and responses. // This field is a repeated field to allow for multiple values // which is allowed in HTTP headers. repeated string value = 1; }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
sdk/http.proto
(2 hunks)
🔇 Additional comments (2)
sdk/http.proto (2)
40-40
: LGTM! Symmetric change for response headers.
The change maintains consistency with the request structure and correctly handles multiple values in response headers (e.g., Set-Cookie, Vary).
15-15
: Verify impact of breaking changes.
The header structure changes are breaking changes that affect both requests and responses. Let's verify the impact across the codebase.
Also applies to: 40-40
This modifies the HTTP proto definition to allow headers with the same key but multiple values, which is evidently allowed in HTTP.
Summary by CodeRabbit
New Features
Header
message type for better handling of HTTP headers.Bug Fixes