Skip to content

Commit ba08693

Browse files
byapparovclaude
andcommitted
test(cli): close the legacy-session fixture's SQLite handle for real (#200)
addLegacySnapshotData prepared an INSERT and never finalized it, so bun:sqlite's close() kept the connection open as a zombie (the -wal file stays and another connection cannot take an exclusive lock). Its deferred close and checkpoint can then run while the next aictrl run opens the database, which fails at once with "database is locked" because db.ts sets busy_timeout only after journal_mode. Finalize the statement and close with throwOnError so a leaked statement fails loudly. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_015nwvfUHdM3bgMgD9Zpz7Mj
1 parent 7f5f35b commit ba08693

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎packages/cli/test/cli/run-legacy-session.test.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,12 @@ function addLegacySnapshotData(input: Fixture, sessionID: string) {
178178
now,
179179
JSON.stringify({ type: "snapshot", snapshot: "1".repeat(40) }),
180180
)
181+
// close() silently keeps the connection open while a prepared statement is live,
182+
// and its deferred close can lock the database while the next run opens it.
183+
insert.finalize()
181184
return steps.length
182185
} finally {
183-
db.close()
186+
db.close(true)
184187
}
185188
}
186189

0 commit comments

Comments
 (0)