Skip to content

Commit 4e3325d

Browse files
test(server): the peer-link leak scan reads stored tables, not virtual ones
Migration 114 adds an fts3tokenize table that the recall triggers read with `input =`. SQLite refuses to scan it without that constraint, so the PeerLinkRequests helper that ran `SELECT *` over every sqlite_master table failed with "SQL logic error". The helper now lists tables and FTS shadow tables from pragma_table_list: every stored row is still read, and virtual tables, whose rows are computed or live in those shadow and content tables, are skipped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent f65e955 commit 4e3325d

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎apps/server/src/peer/PeerLinkRequests.test.ts‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -415,12 +415,15 @@ const recordPendingCard = (a: Laptop, key: string) =>
415415

416416
/**
417417
* Every row of every table in the laptop's database, as text, to scan for
418-
* anything leaked: events, projections, receipts and outbox alike.
418+
* anything leaked: events, projections, receipts and outbox alike. Virtual
419+
* tables store nothing themselves: FTS rows live in shadow tables, and some
420+
* (fts3tokenize) cannot be scanned at all.
419421
*/
420422
const storedText = (a: Laptop) =>
421423
Effect.gen(function* () {
422424
const tables = yield* a.sql<{ name: string }>`
423-
SELECT name FROM sqlite_master WHERE type = 'table' AND name NOT LIKE 'sqlite_%'
425+
SELECT name FROM pragma_table_list
426+
WHERE schema = 'main' AND type IN ('table', 'shadow') AND name NOT LIKE 'sqlite_%'
424427
`;
425428
const rows = yield* Effect.forEach(tables, ({ name }) =>
426429
a.sql.unsafe<Record<string, unknown>>(`SELECT * FROM "${name}"`),

0 commit comments

Comments
 (0)