test(lbug): fix stale CHECKPOINT guard regex after the c.query refactor (#2264)

lbug-checkpoint.test.ts asserted exactly two CHECKPOINT sites by grepping the
literal `conn.query('CHECKPOINT')`. The connection-serialization refactor changed
flushWAL/tryFlushWAL to capture `const c = conn` and call `c.query('CHECKPOINT')`
inside withConnLock, so the literal grep found 0 and the test failed (expected 2).

Make the regex receiver-agnostic (`.query('CHECKPOINT')`) — preserves the guard's
intent (exactly two authorized CHECKPOINT sites; a third is a regression) while
tolerating the captured-receiver form.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JBJomjoTdBV2eveDVq4JMm
This commit is contained in:
Gergo Magyar 2026-06-21 06:25:41 +00:00
parent 837a852858
commit a9cde029d9

View file

@ -54,7 +54,11 @@ describe('flushWAL / safeClose — consolidation guard (#1376)', () => {
});
it('CHECKPOINT is issued only by flushWAL (best-effort) and tryFlushWAL (rethrows for the retry driver)', () => {
const matches = adapterSource.match(/conn\.query\('CHECKPOINT'\)/g) ?? [];
// Receiver-agnostic: since the connection-serialization refactor (#2264)
// both sites capture `const c = conn` and call `c.query('CHECKPOINT')`
// inside withConnLock, so match `.query('CHECKPOINT')` regardless of the
// receiver name rather than the literal `conn.query(...)`.
const matches = adapterSource.match(/\.query\('CHECKPOINT'\)/g) ?? [];
// Two authorized sites: `flushWAL` (swallows errors — used by
// `safeClose` and the server's best-effort flush) and `tryFlushWAL`
// (rethrows so the manual checkpoint driver in `wal-checkpoint-driver.ts`