Summary
Two integration test files hardcode RPC ports inside Linux's default ephemeral range (32768–60999), so an unrelated outbound socket on the CI runner can grab the port before the daemon binds it, causing a spurious EADDRINUSE and a failed test run:
test/cli/mintpass-integration.test.ts:19 — RPC_PORT = 59238
test/cli/challenge-integration.test.ts:21 — RPC_PORT = 59138
Evidence
Observed on a confidence re-run of PR #71 (ubuntu-latest, run 27090701580):
FAIL test/cli/mintpass-integration.test.ts > @bitsocial/mintpass-challenge integration tests
Daemon failed to start: listen EADDRINUSE: address already in use :::59238
The test under test was unrelated to the failure — the daemon simply couldn't bind its RPC port because another process on the runner transiently held it.
Root cause
This is the same class of flake fixed previously in 470d317 ("test(daemon): move RPC ports out of Linux ephemeral range to fix CI flake"), which moved the daemon.test.ts ports into a clean 9148–9208 block below every platform's ephemeral floor (Linux 32768, macOS/Windows 49152). The two challenge integration test files (added later) reintroduced ports in the ephemeral range.
Fix
Move both ports out of the ephemeral range into the established 91xx/93xx/95xx/96xx convention used by the other test files, picking values not already taken (existing: 9148–9208, 9338/9348/9358, 9438, 9538/9548, 9638/9648, 9748). Verify the chosen ports don't collide with any other test file or src default, then run npm run test:cli to confirm.
Note: only the RPC ports sit in the ephemeral range; the kubo API / gateway ports in these files (5xxxx/6xxx) are already outside it, matching the other test files.
Summary
Two integration test files hardcode RPC ports inside Linux's default ephemeral range (32768–60999), so an unrelated outbound socket on the CI runner can grab the port before the daemon binds it, causing a spurious
EADDRINUSEand a failed test run:test/cli/mintpass-integration.test.ts:19—RPC_PORT = 59238test/cli/challenge-integration.test.ts:21—RPC_PORT = 59138Evidence
Observed on a confidence re-run of PR #71 (ubuntu-latest, run 27090701580):
The test under test was unrelated to the failure — the daemon simply couldn't bind its RPC port because another process on the runner transiently held it.
Root cause
This is the same class of flake fixed previously in
470d317("test(daemon): move RPC ports out of Linux ephemeral range to fix CI flake"), which moved thedaemon.test.tsports into a clean9148–9208block below every platform's ephemeral floor (Linux 32768, macOS/Windows 49152). The two challenge integration test files (added later) reintroduced ports in the ephemeral range.Fix
Move both ports out of the ephemeral range into the established
91xx/93xx/95xx/96xxconvention used by the other test files, picking values not already taken (existing: 9148–9208, 9338/9348/9358, 9438, 9538/9548, 9638/9648, 9748). Verify the chosen ports don't collide with any other test file or src default, then runnpm run test:clito confirm.Note: only the RPC ports sit in the ephemeral range; the kubo API / gateway ports in these files (5xxxx/6xxx) are already outside it, matching the other test files.