From a9cde029d906eef06297610112032710d57f9aa2 Mon Sep 17 00:00:00 2001 From: Gergo Magyar Date: Sun, 21 Jun 2026 06:25:41 +0000 Subject: [PATCH] test(lbug): fix stale CHECKPOINT guard regex after the c.query refactor (#2264) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) Claude-Session: https://claude.ai/code/session_01JBJomjoTdBV2eveDVq4JMm --- gitnexus/test/unit/lbug-checkpoint.test.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gitnexus/test/unit/lbug-checkpoint.test.ts b/gitnexus/test/unit/lbug-checkpoint.test.ts index 6eac7e73a..06f54a044 100644 --- a/gitnexus/test/unit/lbug-checkpoint.test.ts +++ b/gitnexus/test/unit/lbug-checkpoint.test.ts @@ -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`