fix(beacon): guard WSS empty frame + fix addr-field data race (PILOT-70, PILOT-71)#31
Merged
Merged
Conversation
…70, PILOT-71) Both server-side fixes (len(data)==0 guard in handlePacket, Snapshot() for all node.addr reads) were already applied to main. This commit adds the missing WSS-path regression test (PILOT-70): TestServer_EmptyFrameDoesNotPanic feeds a real zero-length binary frame through a fully-authenticated WSS connection and verifies the server survives and continues serving frames, exercising the full daemon → peerReadLoop → OnFrame → handlePacket chain. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
Summary
len(data) == 0guard inhandlePacket(beacon/server.go:527) was already onmain. The missing piece was a WSS-path regression test — addedTestServer_EmptyFrameDoesNotPanicinwss/zz_server_test.go. It dials a real authenticated WSS connection, sends a zero-length binary frame, and asserts the server survives and continues delivering frames, exercising the fulldaemon → peerReadLoop → OnFrame → handlePacketchain.node.addrreads inserver.goalready useSnapshot()(lines 656, 657, 673, 683, 922, 1013). A concurrent-write race test (TestNodeMap_Snapshot_RaceFreeUnderUpsert) is already inzz_server_branches_test.go. No additional code changes required.Test plan
GOWORK=off go test -race ./... ./wss/...passes clean (verified locally — all 3 packages green, 0 race detections)TestServer_EmptyFrameDoesNotPanicexercises the WSS →handlePacketpath with a 0-byte frameTestHandlePacketEmptyDoesNotPanic(existing) covers the directhandlePacket(nil, _)/handlePacket([]byte{}, _)casesTestNodeMap_Snapshot_RaceFreeUnderUpsert(existing) hammers concurrent Upsert+Snapshot under-race🤖 Generated with Claude Code