test(probe): pin deleted rows in isolation controls and per-account count (#176)

Refs #176

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
le king fu 2026-11-08 10:30:40 -05:00 • committed by maximus
commit 0d561a8983

View file

@ -248,11 +248,35 @@ describe('web/scripts/probe.sql: each control detects its seeded anomaly', () =>
expect(await counts()).toEqual(expected({ lien_etiquette_autre_compte: 1 }));
});
it('compte_sans_inbox: an account with an active task and only a deleted Inbox', async () => {
it('compte_sans_inbox: an account with active tasks and only a deleted Inbox counts once', async () => {
await healthyBase();
const C = `user-${u()}`;
await list(C, { inbox: true, deleted: true });
await task(C, await list(C));
const cList = await list(C);
await task(C, cList);
await task(C, cList);
expect(await counts()).toEqual(expected({ compte_sans_inbox: 1 }));
});
});
// Controls 7 to 9 are isolation checks: a cross-account row is a leak even
// once soft-deleted, so they count deleted rows too.
describe('web/scripts/probe.sql: isolation controls count deleted rows', () => {
it('tache_liste_autre_compte: a deleted task of B in a list of A', async () => {
const { A, B } = await healthyBase();
await task(B.userId, A.list, { deleted: true });
expect(await counts()).toEqual(expected({ tache_liste_autre_compte: 1 }));
});
it('sous_tache_parent_autre_compte: a deleted subtask of B under a task of A', async () => {
const { A, B } = await healthyBase();
await task(B.userId, B.list, { parentId: A.task, deleted: true });
expect(await counts()).toEqual(expected({ sous_tache_parent_autre_compte: 1 }));
});
it('lien_etiquette_autre_compte: a deleted tag of B linked to a task of A', async () => {
const { A, B } = await healthyBase();
await link(A.task, await tag(B.userId, { deleted: true }));
expect(await counts()).toEqual(expected({ lien_etiquette_autre_compte: 1, lien_etiquette_supprimee: 1 }));
});
});