Skip to content

fix(beacon): guard WSS empty frame + fix addr-field data race (PILOT-70, PILOT-71)#31

Merged
TeoSlayer merged 1 commit into
mainfrom
fix/pilot-70-71-beacon-wss-panic-addr-race
Jun 17, 2026
Merged

fix(beacon): guard WSS empty frame + fix addr-field data race (PILOT-70, PILOT-71)#31
TeoSlayer merged 1 commit into
mainfrom
fix/pilot-70-71-beacon-wss-panic-addr-race

Conversation

@TeoSlayer

Copy link
Copy Markdown
Contributor

Summary

  • PILOT-70 (WSS empty-frame panic): The len(data) == 0 guard in handlePacket (beacon/server.go:527) was already on main. The missing piece was a WSS-path regression test — added TestServer_EmptyFrameDoesNotPanic in wss/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 full daemon → peerReadLoop → OnFrame → handlePacket chain.
  • PILOT-71 (addr-field data race): All node.addr reads in server.go already use Snapshot() (lines 656, 657, 673, 683, 922, 1013). A concurrent-write race test (TestNodeMap_Snapshot_RaceFreeUnderUpsert) is already in zz_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_EmptyFrameDoesNotPanic exercises the WSS → handlePacket path with a 0-byte frame
  • TestHandlePacketEmptyDoesNotPanic (existing) covers the direct handlePacket(nil, _) / handlePacket([]byte{}, _) cases
  • TestNodeMap_Snapshot_RaceFreeUnderUpsert (existing) hammers concurrent Upsert+Snapshot under -race

🤖 Generated with Claude Code

…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

codecov Bot commented Jun 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@TeoSlayer TeoSlayer merged commit 96b5b3b into main Jun 17, 2026
4 checks passed
@TeoSlayer TeoSlayer deleted the fix/pilot-70-71-beacon-wss-panic-addr-race branch June 17, 2026 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants