Repository navigation
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Note
Written by Claude Opus 5.5 on behalf of Gil.
Problem
findAvailablePort falls back when a wildcard listener occupies IPv4(packages/shared/src/Net.test.ts) fails on a Mac whose first non-loopback IPv4 address belongs to a tunnel the machine cannot dial itself. The test takes the first non-internal IPv4 address fromos.networkInterfaces()and assumes a connection to its own listener there succeeds. With the NextDNS app running, that address is the tunnel placeholder192.0.2.42onutun4: packets to it go into the DNS-only tunnel and are dropped, sohasListenerOnHosttimes out. macOS also lets a specific-address bind succeed next to a wildcard listener, sofindAvailablePortkeeps the occupied port and the assertionnotEqual(resolved, preferred)fails.No configuration change is needed to hit it: macOS appends a re-attached interface to the end of its list, so after a Wi-Fi driver restart
en0moves behind existing tunnels and the test starts failing.Change
The test now uses the first non-internal IPv4 address whose own listener accepts a connection within 250 ms (the same timeout
hasListenerOnHostuses). Only the test changes;Net.tsis unchanged. On Linux CI the first address is already reachable, so the chosen address is the same as before.Scope
A small fix for an obvious test bug, so no issue. It breaks
vp testinpackages/sharedon macOS machines with a tunnel listed before Wi-Fi.Verification
On macOS 27 with NextDNS (
utun4=192.0.2.42) listed beforeen0(10.0.0.198),vp test run src/Net.test.tsinpackages/shared:findAvailablePort falls back when a wildcard listener occupies IPv4fails (expected 58018 to not equal 58018).10.0.0.198.The two tests from #43478 (
findAvailablePort skips a port a LAN listener holds for wildcard host "0.0.0.0"and"") fail on this Mac before and after this change. That is a separate macOS issue and not part of this PR.Written with Claude Opus 5.5 in Claude Code.