Repository navigation
Conversation
The replan-conflict test released an OS ephemeral port and then restarted rest on it, so another parallel test or outbound socket could take it in between. Bind a fixed port below the auto and ephemeral ranges instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MBEk1NPzAvnzR5sjBpqm6p
|
/ai-review Generated by Claude Code |
CLI benchmark (Lightweight Commands): no changes foundCommit
API calls: unchanged for all 9 commands. Binary size: 135.7 MB, unchanged. Details: timing ranges, API calls per command, slowest phasesTiming ranges
API calls per command
Slowest phasesNo command moved beyond noise, so there are no phase deltas. Comment |
There was a problem hiding this comment.
Superseded by a newer AI review
🤖 AI Review
CLI reference prose guidance: not applicable (no reference sources changed).
The PR avoids reusing an OS-assigned ephemeral port in the stack restart test. One minor test-isolation issue remains: an existing listener on TCP 9395 can fail fixture setup before the test checks how the stack handles a port conflict. The diff changes only test code, so CLI reference prose review was inapplicable.
Findings
| Severity | Location | Category | Sources | Claim |
|---|---|---|---|---|
| 🟡 MINOR | packages/stack/src/effect.integration.test.ts:1774 |
test-isolation |
codex | An unrelated listener on TCP 9395 can fail fixture setup before the test attempts the stack start that should report the port conflict. |
Stats
Claude findings: 0 · Codex findings: 1 · Confirmed: 1 · Refuted: 0 · Uncertain: 0
Models: claude-opus-5-5 + gpt-6.2-sol · Trigger: manual · Workflow run
This review runs once per PR. A maintainer can request another with a /ai-review comment.
| const conflictingPort = FIXED_API_PORT + 2; | ||
| const holder = yield* holdPort(conflictingPort); |
There was a problem hiding this comment.
🟡 MINOR · test-isolation · source: codex
An unrelated listener on TCP 9395 can fail fixture setup before the test attempts the stack start that should report the port conflict.
Evidence: Lines 1774–1775 immediately acquire a listener on FIXED_API_PORT + 2 (9395). Lines 1733–1736 bind that exact loopback port and propagate bind errors. The stack start under test begins at line 1781.
Suggested fix: Try binding candidates in a test-owned range below the ephemeral range and advance to another candidate on EADDRINUSE. Keep a separate test-only lease through the stack's rebind to coordinate concurrent test runs.
There was a problem hiding this comment.
This rests on the same assumption as the file's existing FIXED_API_PORT (9393), which its sibling tests already bind directly. 9395 sits below the stack's automatic range (20000+) and every OS ephemeral range, so neither the stack's own allocations nor outbound sockets can take it. No other test in the repo uses 9395: the only other fixed port nearby is FIXED_STUDIO_PORT 9391. Tests in this file also run one after another. A fixed bind failing on EADDRINUSE would mean a foreign process on a CI runner, and the error would name it. A candidate scan plus a cross-run lease would add machinery that nothing needs yet, so I'm keeping the fixed port.
Generated by Claude Code
There was a problem hiding this comment.
🤖 AI Review
CLI reference prose guidance: not applicable (no reference sources changed).
One minor test-isolation finding is confirmed. The conflict fixture now requires loopback port 9395 to be free before it can exercise the stack’s port-conflict handling. The diff changes only an integration test, so CLI reference prose review was inapplicable. Verification used source inspection.
Findings
| Severity | Location | Category | Sources | Claim |
|---|---|---|---|---|
| 🟡 MINOR | packages/stack/src/effect.integration.test.ts:1774 |
test-isolation |
codex | An existing listener on loopback port 9395 makes the integration test fail during fixture setup, before it exercises the stack’s port-conflict handling. |
Stats
Claude findings: 0 · Codex findings: 1 · Confirmed: 1 · Refuted: 0 · Uncertain: 0
Models: claude-opus-5-5 + gpt-6.2-sol · Trigger: auto · Workflow run
This review runs once per PR. A maintainer can request another with a /ai-review comment.
| const conflictingPort = FIXED_API_PORT + 2; | ||
| const holder = yield* holdPort(conflictingPort); |
There was a problem hiding this comment.
🟡 MINOR · test-isolation · source: codex
An existing listener on loopback port 9395 makes the integration test fail during fixture setup, before it exercises the stack’s port-conflict handling.
Evidence: packages/stack/src/effect.integration.test.ts:51 defines FIXED_API_PORT as 9393. Lines 1774–1775 add 2 and bind the resulting port through holdPort. Lines 1735–1736 propagate the listener’s bind error as an Effect failure, so an EADDRINUSE exits setup before the open call at line 1781. The previous helper used listen(0), letting the OS select an available port for the fixture.
Suggested fix: Try a bounded set of ports outside the stack’s automatic and OS ephemeral ranges. Retry the actual bind on EADDRINUSE, then keep the successful listener open until the test deliberately releases it for restart.
There was a problem hiding this comment.
This is the same finding as #7830 (comment). The fixed port follows the file's existing FIXED_API_PORT convention: it sits below the auto and ephemeral ranges, and nothing else uses it. A bounded retry scan would still have to release the port before the restart, which is the window this PR closes.
Generated by Claude Code
Flaky test check: ✅ no flaky testsCommit Each execution is a separate Vitest process; |
TL;DR
Hold the conflicting port in the replan-conflict test from a range the test owns, not from the OS ephemeral range.
effect.integration.test.ts › fails a start whose requested fixed port is taken, keeping the requested intent saved: the restart after freeing the port sometimes failed withCannot bind api at 127.0.0.1:<port>: … Is port <port> in use?. The test boundlisten(0), so the port came from the OS ephemeral range. It then released that port and restarted rest on it, and another parallel test or outbound socket could take it in between. The holder now bindsFIXED_API_PORT + 2, which sits below the stack's automatic range and every ephemeral range, like the sibling tests' fixed ports.ref
spotted in: https://github.com/supabase/cli/actions/runs/45586961422/job/139110897914
Generated by Claude Code