Skip to content

test(platform-node): wait for the shard close report, not the client - #1610

Merged
prisis merged 1 commit into
alphafrom
fix/platform-node-close-event-wait
Nov 17, 2026
Merged

prisis merged 1 commit into
alphafrom
fix/platform-node-close-event-wait

Conversation

@prisis

@prisis prisis commented Nov 17, 2026

Copy link
Copy Markdown
Member

Summary

tells the shard about a close the shard itself initiated waited for the client socket to reach CLOSED and then asserted that the shard had received the close event. The server's ws close handler reports to the shard independently of the client's view, so on a slow runner the assertion ran first. It failed on Test (node-22.22) for several unrelated PRs (#1518, #1609).

The test now waits for the shard's close report itself, which is the milestone it asserts on.

Verification

  • Delaying the server's notifyClosed by 100 ms makes the old test fail and the new one pass.
  • The full websocket-upgrade.test.ts suite passes: 13 of 13.
  • eslint and oxfmt are clean.

🤖 Generated with Claude Code

The client can see CLOSED before the server's close handler reports to the shard, so on a slow
runner the assertion ran first and the test failed on Node 22 in CI. It now waits on the report.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@netlify

netlify Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for lunorash ready!

Name Link
🔨 Latest commit 79abb24
🔍 Latest deploy log https://app.netlify.com/projects/lunorash/deploys/6afb9eb9494615689819d16c
😎 Deploy Preview https://deploy-preview-1610--lunorash.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai

coderabbitai Bot commented Nov 17, 2026

Copy link
Copy Markdown

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters: 1

  • packages/platform-node/__tests__/websocket-upgrade.test.ts is excluded by !**/__tests__/**, !**/*.test.ts and included by packages/**

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@github-actions github-actions Bot added size:S Size of the change, tests and generated files excluded. vouch:trusted PR author is a collaborator, a bot or on the VOUCHED list. package: platform-node labels Nov 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thank you for following the naming conventions! 🙏

@qodo-code-review

qodo-code-review Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

PR Summary by Qodo

Wait for the shard close report in the Node WebSocket test

🧪 Tests 🐞 Bug fix 🕐 Less than 10 minutes

Grey Divider

AI Description

• Fix a timing race in the shard-initiated WebSocket close test.
• Wait for the shard's close report before asserting it was received.
Diagram

graph TD
    A["Shard closes socket"] --> B["Client CLOSED"] --> D["Poll both states"] --> E["Assert one report"]
    A --> C["Shard close report"] --> D
Loading
High-Level Assessment

Waiting on the event being asserted is the appropriate fix. It uses the existing polling helper without changing production behavior or assuming the client and server close events occur in order.

Files changed (1) +6 / -4

Tests (1) +6 / -4
websocket-upgrade.test.tsWait for the shard's close report before asserting it +6/-4

Wait for the shard's close report before asserting it

• The shard-initiated close test now polls for both the client's CLOSED state and a recorded shard close event. It evaluates close events after the wait, preventing a slow server close handler from making the assertion run too early.

packages/platform-node/tests/websocket-upgrade.test.ts

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can enable the Remediation agent and Qodo fixes findings in a dedicated fix PR

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

1 similar comment
@qodo-free-for-open-source-projects

Copy link
Copy Markdown
Contributor

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can enable the Remediation agent and Qodo fixes findings in a dedicated fix PR

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@codspeed

codspeed Bot commented Nov 17, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 2 untouched benchmarks
⏩ 398 skipped benchmarks1


Comparing fix/platform-node-close-event-wait (79abb24) with alpha (7875744)2

Open in CodSpeed

Footnotes

  1. 398 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

  2. No successful run was found on alpha (4473841) during the generation of this report, so 7875744 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.31%. Comparing base (ccdcfd2) to head (79abb24).
⚠️ Report is 2 commits behind head on alpha.

Additional details and impacted files
@@             Coverage Diff             @@
##            alpha    #1610       +/-   ##
===========================================
+ Coverage   84.48%   92.31%    +7.82%     
===========================================
  Files        2130       22     -2108     
  Lines      131392     2237   -129155     
  Branches    33406      447    -32959     
===========================================
- Hits       111006     2065   -108941     
+ Misses      19623      168    -19455     
+ Partials      763        4      -759     

see 2108 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@prisis
prisis merged commit 4d95c0a into alpha Nov 17, 2026
93 checks passed
@prisis
prisis deleted the fix/platform-node-close-event-wait branch November 17, 2026 00:40

This branch was previously deployed

1 inactive deployment
benchmarks — 79abb24e Deployed Nov 17, 2026 by prisis via Benchmarks #7824
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: platform-node size:S Size of the change, tests and generated files excluded. 🟡 Small blast radius vouch:trusted PR author is a collaborator, a bot or on the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants