-
Notifications
You must be signed in to change notification settings - Fork 0
Add error path and edge case tests for envelope package #7
Copy link
Copy link
Open
Labels
area/envelopeJSON envelope helpers and MIME-contract behavior.JSON envelope helpers and MIME-contract behavior.good first issueSmall, well-scoped tasks for new contributors.Small, well-scoped tasks for new contributors.help wantedLooking for community contributions.Looking for community contributions.kind/testsTesting, CI, or verification-only changes.Testing, CI, or verification-only changes.priority/mediumNormal priority item.Normal priority item.
Metadata
Metadata
Assignees
Labels
area/envelopeJSON envelope helpers and MIME-contract behavior.JSON envelope helpers and MIME-contract behavior.good first issueSmall, well-scoped tasks for new contributors.Small, well-scoped tasks for new contributors.help wantedLooking for community contributions.Looking for community contributions.kind/testsTesting, CI, or verification-only changes.Testing, CI, or verification-only changes.priority/mediumNormal priority item.Normal priority item.
Problem statement
The envelope package has 78.8% statement coverage with 4 tests, but all error paths and several important edge cases are untested.
Uncovered error paths (0 hits in coverage)
Marshal(nil)— line 77-79Unmarshal("")(empty payload) — line 92-94Unmarshal(invalidJSON)— line 96-98FromBinaryFrame(nil)— line 124-126FromBinaryFramewith invalid JSON payload — line 131-133ToBinaryFramewhen Marshal fails — line 108-110Untested edge cases
&Envelope{}) with no fields setPayload(nilvsjson.RawMessage(nil)vsjson.RawMessage("null"))Kinddefaulting: no default when no payload/inputs/transportsKinddefaulting: triggered byInputsalone, orTransportsaloneVersionis preserved, not overwrittenint64→uint64with negative values inToBinaryFrameuint64→int64overflow inFromBinaryFrameUntested types
HookPayload— zero test coverageTransportDescriptor— only tested as part of round-trip, no isolated testsProposed change
Add the following test functions to
envelope_test.go:Affected area
Compatibility / migration
Test-only changes. No behavior changes.
Additional context
Current coverage: 78.8%. These tests would bring it above 95% and cover all error return paths. Identified during QA review.