test(sticktable): regression test for EntryUpdate.Marshal data encoding#30
Merged
fionera merged 1 commit intoJul 10, 2026
Conversation
EntryUpdate.Marshal previously encoded the data section by calling MapData.Unmarshal instead of Marshal, producing a zeroed data section on the wire and mutating the source EntryUpdate as a side effect. The existing round-trip test could not catch this because it compares against the same struct that Marshal mutates, so both sides ended up zeroed and matched. This adds a test that uses an independent expected value and asserts the source is not mutated, so it fails if the data is not actually encoded.
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
Adds a regression test for
EntryUpdate.Marshal's data encoding.Why
EntryUpdate.Marshalused to encode the data section by callingMapData.Unmarshalinstead ofMarshal:That had two effects: the data section was written as zeros on the wire, and the source
EntryUpdate's data was mutated to those zeros as a side effect. The code itself was fixed in #28 (write support) — this PR closes the test gap so it can't silently come back.The existing
TestMarshalUnmarshalMessagescannot catch this class of bug: it marshalsentryUpdate, unmarshals intod, then compares*entryUpdateagainstd. Because the buggyMarshalmutatesentryUpdateto zeros too, both sides match and the test passes even when the data is not encoded (verified by re-introducing the bug on the current tree — the existing test stays green, this new test fails withMarshal mutated source data to 0).What this test does
EntryUpdatewith a non-zerogpt0value.Marshal.No production code changes.