fix(py-sdk): lowercase gRPC metadata headers for Python compatibility#359
fix(py-sdk): lowercase gRPC metadata headers for Python compatibility#359coding-shalabh wants to merge 1 commit into
Conversation
…lity Python grpcio rejects metadata keys containing uppercase characters (HTTP/2 spec requires lowercase). The Go SDK works because Go's grpc library auto-lowercases keys, but Python's grpcio does not. Changed HEADER_CALLER_ID and HEADER_CALLER_TOKEN to lowercase to match the Go server middleware expectations in middleware.go. Fixes Meesho#165
PR Validation FailedPR description validation failed Issues found:
Please fill out the form to fix this: Open Form |
|
Links: Reason: 📘 Please check the Turbo Turtle FAQs for more details. 👉 If the reason is not self-explanatory or not covered in the FAQ, please reach out to @devops-oncall in the #devops-tech channel. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughUpdated gRPC authentication header constants from uppercase to lowercase format in the Python gRPC feature client. The changes modify two public header constants to use lowercase ASCII characters, aligning with HTTP/2 metadata requirements enforced by Python gRPC. Changes
Assessment against linked issues
Suggested labels
🚥 Pre-merge checks | ✅ 1✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment Tip CodeRabbit can scan for known vulnerabilities in your dependencies using OSV Scanner.OSV Scanner will automatically detect and report security vulnerabilities in your project's dependencies. No additional configuration is required. |
erk1nya
left a comment
There was a problem hiding this comment.
Disregard previous approval - was automated test
|
Hi @erk1nya — sorry I missed the prior pings. I noticed the earlier "approval" was an automated test and you retracted it. Cleaning house here:
The actual change is a 2-line lowercase fix in |
🔁 Pull Request Template – BharatMLStack
Context:
Python gRPC clients fail with
metadata was invalidwhen calling the online-feature-store service because thepy-sdkdefines metadata header keys in uppercase. HTTP/2 (RFC 7540 §8.1.2) requires header field names to be lowercase. The Go SDK works becausegrpc-goauto-lowercases metadata keys, but Python'sgrpcioenforces the spec strictly and rejects them.Fixes #165.
Describe your changes:
Lowercased
HEADER_CALLER_IDandHEADER_CALLER_TOKENinpy-sdk/grpc_feature_client/grpc_feature_client/client.py:These now match the server-side constants in
online-feature-store/internal/server/grpc/middleware.go, which the Go SDK was already sending in lowercase form (via grpc-go's auto-normalization).Testing:
Manual:
py-sdklocally with the patch.online-feature-storeinstance.GetFeaturescall now succeeds; without the fix it returnsmetadata was invalid.Existing automated tests: the constants are only consumed by the gRPC client header builder, which is exercised by every integration call. No new unit test added — verifying a 2-line constant change is best done at the wire/metadata level which the existing call paths cover.
Monitoring:
No new instrumentation required. Failures previously surfaced as
metadata was invaliderrors in gRPC client logs; after the fix those errors should no longer occur for Python callers. Existing gRPC server-side metrics for request count / error rate already cover regression detection.Rollback plan
Single-file, two-line constant change. To revert:
git revert <commit-sha>on the merge commit, or change the two constants back to uppercase. No data migrations, no schema changes, no config rollout. Rollback is instant on the next SDK release.Checklist before requesting a review
📂 Modules Affected
horizon(Real-time systems / networking)online-feature-store(Feature serving infra)trufflebox-ui(Admin panel / UI)infra(Docker, CI/CD, GCP/AWS setup)docs(Documentation updates)py-sdk(Python gRPC client)✅ Type of Change
___________📊 Benchmark / Metrics (if applicable)
N/A — constant value change only, no perf impact.