Problem
macOS CI intermittently fails (e.g. run 27199400016) with:
Daemon failed to start: Error: serveHTTPApi: manet.Listen(/ip4/0.0.0.0/tcp/50599) failed:
listen tcp4 0.0.0.0:50599: bind: address already in use
Root cause
Every kubo API port hardcoded in the test suite (50039, 50049, 50079, 50089, 50099, 50121, 50129, 50139, 50209, 50299, 50309, 50399, 50499, 50599, …) falls inside macOS's ephemeral port range (49152–65535). With fileParallelism: true, the macOS kernel can transiently assign one of those ports as the source port for an outbound fetch() from a concurrently running test file, so kubo's bind on that port intermittently fails. (Swarm ports were already fixed via preInitKuboWithEphemeralSwarm → /tcp/0; API/gateway/RPC were not.)
Proven fix already in-repo
test/kubo/kuboRpcGateway.integration.test.ts already does the right thing — allocate a free port via net bind-to-:0, then retry kubo startup on /already in use/i with fresh ports. It is not flaky.
Plan
Problem
macOS CI intermittently fails (e.g. run 27199400016) with:
Root cause
Every kubo API port hardcoded in the test suite (50039, 50049, 50079, 50089, 50099, 50121, 50129, 50139, 50209, 50299, 50309, 50399, 50499, 50599, …) falls inside macOS's ephemeral port range (49152–65535). With
fileParallelism: true, the macOS kernel can transiently assign one of those ports as the source port for an outboundfetch()from a concurrently running test file, so kubo's bind on that port intermittently fails. (Swarm ports were already fixed viapreInitKuboWithEphemeralSwarm→/tcp/0; API/gateway/RPC were not.)Proven fix already in-repo
test/kubo/kuboRpcGateway.integration.test.tsalready does the right thing — allocate a free port vianetbind-to-:0, then retry kubo startup on/already in use/iwith fresh ports. It is not flaky.Plan
allocateFreePort(),allocateKuboEndpoints(),startPkcDaemonWithDynamicPorts()(retry on bind race) intest/helpers/daemon-helpers.ts.preInitKuboWithEphemeralSwarmidempotent so retries can reuse a seeded dataPath.npm run test:cligreen locally.