Repository navigation
Conversation
The per-user port registry used SQLite's rollback journal, where a peer committing reservations back to back can lock a new connection's schema read out past the 2s busy timeout. Opening the registry in WAL mode lets opens and reads proceed while another connection writes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MBEk1M3LvdWBHSeFmCJaGq
|
/ai-review Generated by Claude Code |
There was a problem hiding this comment.
Superseded by a newer AI review
🤖 AI Review
Code inspection confirms all three findings: two distinct test weaknesses and a low-impact contention case when migrating an existing registry to WAL. No findings were duplicates. Tests were not run.
Findings
| Severity | Location | Category | Sources | Claim |
|---|---|---|---|---|
| 🟡 MINOR | packages/stack/src/namespace/PortReservations.integration.test.ts:18 |
test-reliability |
claude | The test derives the registry path from homedir(), while the service resolves the OS account home independently. An overridden HOME can make the assertion inspect the wrong file and the peer lock a different database. |
| 🟡 MINOR | packages/stack/src/namespace/PortReservations.ts:99 |
error-handling |
claude | Migrating an existing rollback-journal registry to WAL can fail under peer locks that previously allowed opening and reading the registry, and that failure aborts registry initialization. |
| 🟡 MINOR | packages/stack/src/namespace/PortReservations.integration.test.ts:18 |
test-coverage |
codex | The regression test can pass after production WAL initialization is removed because it reuses a database whose WAL mode persists between runs. |
Stats
Claude findings: 2 · Codex findings: 1 · Confirmed: 3 · Refuted: 0 · Uncertain: 0
Models: claude-opus-5-5 + gpt-6.1-sol · Trigger: auto · Workflow run
This review runs once per PR. A maintainer can request another with a /ai-review comment.
There was a problem hiding this comment.
🤖 AI Review
Both independent reviews completed; Codex reported no findings. Confirmed Claude's test-path mismatch, a low-risk shared-registry contention concern, and an import-grouping nit. No production defect was identified in the WAL initialization change.
Findings
| Severity | Location | Category | Sources | Claim |
|---|---|---|---|---|
| 🟡 MINOR | packages/stack/src/namespace/PortReservations.integration.test.ts:18 |
test-coverage |
claude | The test derives the registry path from homedir(), while the service resolves the OS account home independently of HOME. When those differ, the test can fail or lock a different database and pass without exercising contention. |
| 🟡 MINOR | packages/stack/src/namespace/PortReservations.integration.test.ts:23 |
test-reliability |
claude | The test holds a write transaction on the shared per-user registry while reopening the service. Concurrent integration workers can exhaust their two-second writer timeout if this interval becomes slow. |
| ⚪ NIT | packages/stack/src/namespace/PortReservations.integration.test.ts:5 |
style |
claude | The node:crypto and node:os imports are separated by the Effect imports. |
Stats
Claude findings: 3 · Codex findings: 0 · Confirmed: 3 · Refuted: 0 · Uncertain: 0
Models: claude-opus-5-5 + gpt-6.1-sol · Trigger: manual · Workflow run
This review runs once per PR. A maintainer can request another with a /ai-review comment.
…to WAL SQLite does not consult the busy timeout when two connections switch a fresh file into WAL at once, so parallel stack owners could fail to open the registry with "database is locked". The switch now retries on busy for up to the same 2s budget. The registry layer also takes a directory so its test runs against a fresh, isolated database. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MBEk1M3LvdWBHSeFmCJaGq
Flaky test check: ✅ no flaky testsCommit Each execution is a separate Vitest process; |
TL;DR
The per-user port registry (
~/.supabase/ports.sqlite) now opens in WAL mode, so a peer committing reservations no longer locks other connections out of opening or reading it.Network.integration.test.ts › retains dedicated assignments across network reopenfailed on Windows withdatabase is lockedwhile opening the registry. Under the rollback journal, a peer that commits back to back holds the lock nearly all the time, and a new connection's schema read keeps losing the race until the 2s busy timeout runs out. Parallel test files that scan for ports produce exactly that write pattern. In WAL mode readers never wait on a writer. Writers still serialize throughBEGIN IMMEDIATE, as before. A new integration test opens and reads the registry while a peer holds its write lock: it fails on the old code with the samedatabase is lockederror and passes with this change.ref
spotted in: https://github.com/supabase/cli/actions/runs/40438309049/job/121972299083
Generated by Claude Code