From c855c4c504ab42763d73e58e3c532aa3d04b0738 Mon Sep 17 00:00:00 2001 From: MXAntian Date: Mon, 3 Aug 2026 13:53:04 +0800 Subject: [PATCH] test(health): assert detectBlindspot's branch, not the build that made the DB MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The "(d) missing recall_log reads as not instrumented" check relies on the table being absent at that point. That is not a property of the test — it is a property of whichever engine created DB_PATH. A build that instruments recall creates recall_log in initMemory(), the "no table" state becomes unreachable, and the check fails with a perfectly correct value: ✗ (d) missing recall_log reads as "not instrumented" — {"available":false,"reason":"no recall_log rows in the last 7 days"} Nothing is wrong with detectBlindspot there; the test simply cannot reach the branch it wants to assert. Dropping the table first tests the logic either way. Found while rebasing a downstream runtime (which does instrument recall) onto main — the kind of failure that reads as a real regression and costs a while to disbelieve. Verified against both engines: 63/63 on a build without instrumentation, and 62/1 -> 63/0 on one with it. Co-authored-by: 千夏 Co-Authored-By: Claude Opus 5 --- memory-health.test.mjs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/memory-health.test.mjs b/memory-health.test.mjs index 6b0bc8a..fd8c867 100644 --- a/memory-health.test.mjs +++ b/memory-health.test.mjs @@ -332,6 +332,13 @@ function check(label, cond, detail = '') { const Database = (await import('better-sqlite3')).default const db = new Database(DB_PATH) + // Assert the branch, not the build. Whether recall_log exists at this point + // depends on which engine created DB_PATH — a build that instruments recall + // creates the table in initMemory(), making the "no table" state unreachable + // and this check a false failure. Dropping it first tests detectBlindspot's + // logic either way. + db.exec('DROP TABLE IF EXISTS recall_log') + const noTable = detectBlindspot(db) check('(d) missing recall_log reads as "not instrumented"', noTable.available === false && !noTable.instrumentation_stalled && /not present/.test(noTable.reason),