test(sqlite): one sandbox connection, no more Database busy flakes (#79) #95

Merged
jfro merged 1 commit from fix/79-sqlite-busy into main 2026-11-28 19:21:23 +00:00
Owner

What changed

PR #95 (fix/79-sqlite-busy, 449439a) sets the SQLite test pool to one sandbox connection, which stops the random "Database busy" failures: F1 proved fixed (12 of 12 full SQLite runs, C37), CI green on Postgres and SQLite, precommit passes with 1312 tests. Calling ready again because the last Prover got stuck without a verdict.

Fixes #94

Red, then green

No test: It's a test-config change; the proof is the flake script F1 (fails on main, passes on the branch), already recorded as fixed.

Checks

  • With PR #95's pool_size 1 sandbox config at 449439a, the full SQLite test suite passes in all 12 of 12 back-to-back runs, with no Database busy errors (it failed about half the runs at 428c773). (Nye): /home/peak/work/lamplighter-v1-4/nye-checks/l95/sqlite_flake12.sh, exit 0
  • PR #95 only changes config/test.exs (SQLite test pool_size 5 → 1), so it can't deploy; about 33 full SQLite runs at 449439a gave no "Database busy", but one run had 2 unexplained non-busy failures (log not kept). Untested: 2-core CI timing. (Upper Wolfjaw): bash -c 'cd /home/peak/scratch/p95/wt && source ~/.rmenv; export PATH=$HOME/.local/bin:$PATH; eval "$(mise activate bash --shims)"; unset FORGEJO_TOKEN; export LAMPLIGHTER_DB=sqlite MIX_BUILD_ROOT=_build_sqlite MIX_ENV=test MIX_TEST_PARTITION=_p95v; for i in 1 2 3; do mix test 2>&1 </dev/null | grep -E "^Result: [0-9]+ passed" || exit 1; done', exit 0
  • Only config/test.exs changes (SQLite pool_size 5→1), so it can't deploy and a revert undoes it; two full SQLite runs in my own worktree gave 1312 passed, no Database busy. Untested: 2-core CI timing and the builder's one unexplained non-busy failure run. (Prover): bash -c 'cd /tmp/pv95 && source ~/.rmenv; export PATH=$HOME/.local/bin:$PATH; eval "$(mise activate bash --shims)"; unset FORGEJO_TOKEN; export LAMPLIGHTER_DB=sqlite MIX_ENV=test MIX_TEST_PARTITION=_pv9; mix test 2>&1 </dev/null | grep -E "^Result: [0-9]+ passed"', exit 0

Shipping it

  • Goes live when it merges: no. It only changes config/test.exs, and merging to main deploys nothing; releases are Jeremy's own mise run release.
  • Undo: a revert puts it back.
  • Not tried on the real thing: nothing named.
  • For later: All test suites on one machine share /tmp/lamplighter-test-claude and port 4002, so concurrent full runs can collide (ClaudeCodeTest); worth isolating per partition someday.

Prover

Passed (Sonnet): Only config/test.exs changes (SQLite pool_size 5→1), so it can't deploy and a revert undoes it; two full SQLite runs in my own worktree gave 1312 passed, no Database busy. Untested: 2-core CI timing and the builder's one unexplained non-busy failure run.

Every command above was run by Fortysix's Basecamp itself, on the branch named.

## What changed PR #95 (fix/79-sqlite-busy, 449439a) sets the SQLite test pool to one sandbox connection, which stops the random "Database busy" failures: F1 proved fixed (12 of 12 full SQLite runs, C37), CI green on Postgres and SQLite, precommit passes with 1312 tests. Calling ready again because the last Prover got stuck without a verdict. Fixes #94 ## Red, then green No test: It's a test-config change; the proof is the flake script F1 (fails on main, passes on the branch), already recorded as fixed. ## Checks - With PR #95's pool_size 1 sandbox config at 449439a, the full SQLite test suite passes in all 12 of 12 back-to-back runs, with no Database busy errors (it failed about half the runs at 428c773). (Nye): `/home/peak/work/lamplighter-v1-4/nye-checks/l95/sqlite_flake12.sh`, exit 0 - PR #95 only changes config/test.exs (SQLite test pool_size 5 → 1), so it can't deploy; about 33 full SQLite runs at 449439a gave no "Database busy", but one run had 2 unexplained non-busy failures (log not kept). Untested: 2-core CI timing. (Upper Wolfjaw): `bash -c 'cd /home/peak/scratch/p95/wt && source ~/.rmenv; export PATH=$HOME/.local/bin:$PATH; eval "$(mise activate bash --shims)"; unset FORGEJO_TOKEN; export LAMPLIGHTER_DB=sqlite MIX_BUILD_ROOT=_build_sqlite MIX_ENV=test MIX_TEST_PARTITION=_p95v; for i in 1 2 3; do mix test 2>&1 </dev/null | grep -E "^Result: [0-9]+ passed" || exit 1; done'`, exit 0 - Only config/test.exs changes (SQLite pool_size 5→1), so it can't deploy and a revert undoes it; two full SQLite runs in my own worktree gave 1312 passed, no Database busy. Untested: 2-core CI timing and the builder's one unexplained non-busy failure run. (Prover): `bash -c 'cd /tmp/pv95 && source ~/.rmenv; export PATH=$HOME/.local/bin:$PATH; eval "$(mise activate bash --shims)"; unset FORGEJO_TOKEN; export LAMPLIGHTER_DB=sqlite MIX_ENV=test MIX_TEST_PARTITION=_pv9; mix test 2>&1 </dev/null | grep -E "^Result: [0-9]+ passed"'`, exit 0 ## Shipping it - Goes live when it merges: no. It only changes config/test.exs, and merging to main deploys nothing; releases are Jeremy's own mise run release. - Undo: a revert puts it back. - Not tried on the real thing: nothing named. - For later: All test suites on one machine share /tmp/lamplighter-test-claude and port 4002, so concurrent full runs can collide (ClaudeCodeTest); worth isolating per partition someday. ## Prover Passed (Sonnet): Only config/test.exs changes (SQLite pool_size 5→1), so it can't deploy and a revert undoes it; two full SQLite runs in my own worktree gave 1312 passed, no Database busy. Untested: 2-core CI timing and the builder's one unexplained non-busy failure run. Every command above was run by Fortysix's Basecamp itself, on the branch named.
jfro added this to the v1.4 milestone 2026-11-28 18:40:50 +00:00
test(sqlite): use one sandbox connection so tests don't hit Database busy
All checks were successful
CI / test (postgres) (pull_request) Successful in 1m26s
CI / test (sqlite) (pull_request) Successful in 1m27s
449439a04e
With pool_size 5, roughly half of the full SQLite runs failed one random
test's first insert with Exqlite "Database busy". Tests already run one at
a time on SQLite, so one connection is enough and nothing can hold the
file's lock across tests.

Refs #79
jfro merged commit 448212f8a3 into main 2026-11-28 19:21:23 +00:00
jfro deleted branch fix/79-sqlite-busy 2026-11-28 19:21:23 +00:00
Sign in to join this conversation.
No description provided.