Repository navigation
test(link): hold large socket writes so pending-upload cases hold on Windows - #8627
Conversation
…Windows The link traffic and request-zstd tests made a write "pending" by sending a 48 MiB body to a Home that never reads it. Bun completes a plain TCP write once the OS accepts it, and Windows accepts a whole nonblocking send at once, so on the 14-shard Windows batch the write completed immediately: toHomeBytes read 50331648 instead of 0, cut uploads counted complete, and the preparation allowance was released before the Home read the body. A test helper now holds the completion of large socket writes (bytes still flow; the socket ending or closing fails the write), so these cases exercise a pending write on every platform. The zstd case waits, bounded, for the release after cancel, since the relay cancels its upstream without awaiting the teardown. The traffic contract docs now say a write completes when the OS accepts it, which on Windows is the whole body.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
✅ Deterministic PR hygiene checks passed. |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 4 minutes. View limit details
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Winsock may accept less than a full nonblocking send; CI only showed it taking whole 48 MiB bodies. Reword the traffic contract, structure doc, guide and helper comment accordingly.
|
Maintainer judgment (dev integration, MAINTAINERS.md maintainer-integration exception): merging without a second maintainer approval, as part of the DEV-RED repair for dev batch run 43343080374 (windows 10/14 and 8/14).
|
Summary
The 14-shard Windows dev batch (run 43343080374, windows 8/14 and 10/14) failed five link tests from #8584 and #8594. They created a "pending upload" by writing a 48 MiB body to a Home that never reads it, assuming the write cannot complete. Bun completes a plain TCP write once the OS accepts it, and Windows can take a whole large nonblocking send into its socket buffer. On the Windows runners the write completed immediately:
toHomeBytesread 50331648 instead of 0, cut uploads counted complete, and the zstd preparation allowance was released (0 instead of 30758256) before the Home read anything.The product counts what its contract says ("bytes whose socket write completed"); the tests' platform assumption was wrong. This PR:
tests/helpers/held-socket-writes.ts, which holds completion of largenode:netwrites the way an undrained send buffer does on Linux/macOS (bytes still flow; the socket ending or closing fails the write), and uses it in the five cases, so they exercise a pending write on every OS;cancel(). The relay's SSE cancel is fire-and-forget (void reader.cancel(...)insrc/client/link-relay.ts), so release on the same tick was a Linux timing coincidence, not a promise;src/link/traffic.ts,structure/remote-link.mdand the Remote Link guide that a write completes when the OS accepts it, and that Windows can accept a whole large body at once (it did on CI). Winsock may also accept less, so this is described as possible, not guaranteed.No runtime code changes; every original assertion is kept.
Verification
Socket#_writecomplete on acceptance, as Windows does. Before the fix:bun test --preload <eager> tests/clients/link-traffic.test.ts tests/clients/link-request-zstd.test.tsgave 31 pass, 5 fail, the same five tests with the same values as CI (50331648; 30758256 vs 0). After: 36 pass, 0 fail.bun run typecheck: exit 0.bun run structure:check: passed.bun run test:changed(1580 files, because a helper changed): the only failures are in files that do not import the new helper, and they fail identically on unmodified dev on this host in isolation (e.g.tests/server/local-control-socket.test.ts17 fail,tests/cli/cli-codex-cli-update.test.ts16 fail).tests/storage/storage-mutation-race.test.tsfailed under parallel load and passes alone (7/7).Checklist