Repository navigation
test: run the WebSocket payload-lifetime test on Node's exact GC - #35388
Conversation
[Low impact] This test-routing change appears safe to merge. SummaryMoves
Reviews (1) · Last reviewed commit: "test: run the WebSocket payload-lifetime..." · Reviewed by Greptile |
|
STATUS: ready. Head 6a2ad2a. CI-flake fix from the unit-shard triage; load rule run locally (pnpm tc, typecheck:ci, code-quality, anti-slop, oxlint, ast-grep scan and gates) plus the affected tests. Review requested from e9-reviewer. Not merged. |
|
No actionable comments were generated in the recent review.
|
ELI5
A WebSocket test checks that finished messages are freed from memory, by forcing garbage collection and seeing whether 80 large buffers are gone. Unit tests run under Bun, whose garbage collector sometimes keeps one object alive just because a stale value on the stack looks like a pointer to it. One buffer survived now and then, and the test failed. The test now runs on Node, whose collector is exact; Orca's main process runs on Node.
What Changed
Before:
ws-inbound-message-queue.test.ts› "releases 80 completed payloads while a later conversion is blocked" failed at random under Bun:expected [ { ref: WeakRef{}, … } ] to have a length of +0 but got 1(#35330, job 123097375791).After: the file is listed in
NODE_RUNTIME_INCLUDE(config/scripts/vitest-node-runtime-files.mjs), so it runs in thenode-runtimeproject. That is where this repo already sends tests that measure retention (the*retention*glob and the explicit list).Why
The test asserts something only an exact collector can promise: no remaining references means collected. JavaScriptCore, Bun's engine, scans the stack conservatively, so a leftover stack slot or register can keep one buffer reachable. That depends on timing and stack layout, which is why it fails rarely and only on loaded CI runners. V8's forced
gc()is exact, and V8 is the engine the queue runs on in Electron.Alternatives considered:
Other GC tests: similar tests under
src/shared(own-retained-string,abort-signal-reason-memory,ndjson-retained-chunk-memory) still run under Bun. They haven't failed, and moving them isn't part of this fix.Flag-off: test routing only.
User-risk: none.
Linked Issue
CI flake triage (unit shards blocking merges).
Visual Proof
N/A. Test-only.
Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
The file now runs as
|node-runtime|and passes 3 runs in a row.ci-shard-assignment.test.mjsandnode-server-change-scope.test.mjs, which read this registry, pass (115 tests).The Bun failure did not reproduce locally in 12 runs; it needs a loaded runner. The fix removes the engine that allows it rather than relying on timing.
Checks run:
pnpm tc,pnpm run typecheck:ci,pnpm run check:code-quality:changed, anti-slop oxlint, oxlint, ast-grep scan and gates.Review
Agent skill upstream boundary
Notes
The test needs
--expose-gc, which thenode-runtimeproject already passes.Status
Ready for review.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)