fix: preserve head map keys when value is empty#1070
Merged
AlexStocks merged 4 commits intoapache:masterfrom Mar 28, 2026
Merged
fix: preserve head map keys when value is empty#1070AlexStocks merged 4 commits intoapache:masterfrom
AlexStocks merged 4 commits intoapache:masterfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1070 +/- ##
==========================================
+ Coverage 56.91% 56.96% +0.05%
==========================================
Files 266 266
Lines 17488 17487 -1
==========================================
+ Hits 9953 9962 +9
+ Misses 6706 6704 -2
+ Partials 829 821 -8 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a Getty RPC header decoding bug where decodeHeapMap() overwrote the decoded header key when the header value was an empty string, breaking RpcMessage.HeadMap round-tripping.
Changes:
- Fix
decodeHeapMap()to preserve the decoded key whenvalueLength == 0and setvalueto"". - Remove a stray no-op
fmt.Sprintln("done")line in the decode loop. - Add a regression test covering
HeadMapentries with empty-string values.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| pkg/remoting/getty/readwriter.go | Corrects empty-value decoding behavior so HeadMap keys are not lost/overwritten. |
| pkg/remoting/getty/readwriter_test.go | Adds a regression test verifying encode/decode round-trip preserves empty header values. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
AlexStocks
reviewed
Mar 28, 2026
AlexStocks
approved these changes
Mar 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does:
Which issue(s) this PR fixes:
Fixes #1069
Special notes for your reviewer:
The bug is in the
valueLength == 0branch ofdecodeHeapMap(). It clearskeyinstead of keeping the decoded key and settingvalueto an empty string.And the change is intentionally small and only touches the Getty read/write path plus a regression test.
Does this PR introduce a user-facing change?:
NONE