Skip to content

Tolerate a host-held LAN port in the occupied-port companion test - #203

Merged
BunsDev merged 1 commit into
mainfrom
fix-companion-port-test
Oct 14, 2026
Merged

BunsDev merged 1 commit into
mainfrom
fix-companion-port-test

Conversation

@BunsDev

@BunsDev BunsDev commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

Fixes a hosted-runner flake in companion-network.test.ts: "an occupied port on a new interface does not move or disconnect the existing interface".

What failed

On PR #196 (run 38404430584), the test failed with:

Error: listen EADDRINUSE: address already in use 192.168.64.13:49240

The test starts the companion on loopback at port P. It then binds a blocker to P on the Mac's LAN address, to check that the new interface's listener avoids the occupied port. On the runner, something else already held P on the LAN address, likely the local end of an outgoing connection. So the blocker's own listen failed, and the test never got to the server behavior it checks. The same commit's other macOS run passed.

Fix

If the blocker gets EADDRINUSE, the port is already occupied on the LAN address, which is the condition under test, so the test continues. Any other error still fails it, and every assertion is unchanged.

Verification

  • A local simulation reproduced the collision by holding P on the LAN address with an extra listener before the blocker binds:
    • before this change, the test fails with the hosted listen EADDRINUSE;
    • after it, the test passes.
  • The test passes normally.
  • npm run build and npm test pass: 1,426 unit tests, 1,410 passed, 16 skipped, 0 failed.

"an occupied port on a new interface does not move or disconnect the
existing interface" binds a blocker to the companion's port on the
Mac's LAN address. On a hosted runner (PR #196, run 38404430584) another
socket already held that address and port, so the blocker's own listen
failed with EADDRINUSE and the test failed before exercising anything.

The port is occupied either way, which is the condition under test, so
EADDRINUSE from the blocker now counts as the occupied state. With a
second listener simulating the hosted collision, the old code fails
with the same EADDRINUSE and the new code passes. The other assertions
are unchanged.

Coven-Harness: Claude Code / claude-opus-5-5
@vercel

vercel Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
modex Ready Ready Preview Oct 14, 2026 1:07am UTC

Request Review

@BunsDev
BunsDev merged commit 3dbc609 into main Oct 14, 2026
7 checks passed
@BunsDev
BunsDev deleted the fix-companion-port-test branch October 14, 2026 01:25

This branch was successfully deployed

1 active deployment
Preview — 34a6b391 Deployed Oct 14, 2026 by vercel[bot]
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.

1 participant