Repository navigation
test(beyondleetcode): C43b multi-user fixture stops timing out on the shared database - #192
Merged
Merged
Conversation
…lock and retries a busy transaction Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…er test database Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
GauranshMathur
marked this pull request as ready for review
October 16, 2026 14:51
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Test-only fix for the "Operation has timed out" flake on the shared Multi-user test database (C43b). Only
src/routes/users/multi-fixture.tsandplaywright.config.tschange; no production code.Root cause
Prisma's "Operation has timed out" (P1008) is SQLITE_BUSY. Two causes stack:
createDbdoes not set one, so a write that meets another process's lock fails at once.ensureLearnercalls still failed). Better Auth also swallows the error and throws "Failed to create user".Fix
multi-fixture.ts: the fixture opens its own client with a 10 s busy timeout, counts P1008 errors via a Prisma query extension, andretryWhenBusyre-runsensureLearner/signIn(at most 4 attempts, jittered) only when a P1008 happened inside. Anything else (unique constraint, bad password) throws at once.playwright.config.ts: the 4174 test database is put in WAL mode (stored in the file). The server's own client (timeout 0, deferred transactions) was also failing sign-in in the e2e (P1008in the server log), which the fixture cannot reach.Results (
flock .../BeyondLeetcode.worktrees/.playwright.lock bunx playwright test --project=e2e-multi, workers 4)signin.multi.e2e.ts:353where the server's own sign-in hit P1008.bunx playwright test: 95 passed.biome checkclean.Follow-up (not done here, production code)
The app has the same exposure under concurrent writers:
src/lib/server/db.tscould set atimeoutand the adapter could begin transactions immediately. Worth a card.Reviews
Self-review done. Codex second opinion skipped: test-only diff outside runner/learning/.github (board.md allows it). No security review for this card.
🤖 Generated with Claude Code