From 7669321ea29f1b96260501c130275281c5e21255 Mon Sep 17 00:00:00 2001 From: Jarvis Date: Tue, 18 Aug 2026 04:24:48 +0000 Subject: [PATCH] =?UTF-8?q?test(gateway):=20cross-user-isolation=20cleanup?= =?UTF-8?q?=20honors=20dbAvailable=20=E2=80=94=20unblocks=20gated=20publis?= =?UTF-8?q?h=20verify=20(#1275)=20(#1304)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Squash-merged by topher (jarvis principal) via break-glass API path (wrapper main-only gap, documented in #1275 log). Gates: CI 2487 green at head 81f500bd, review 180 APPROVED (fred) at pinned head. Unblocks gated publish: verify's no-DB path now skips cleanly. Co-authored-by: Jarvis --- apps/gateway/src/__tests__/cross-user-isolation.test.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/gateway/src/__tests__/cross-user-isolation.test.ts b/apps/gateway/src/__tests__/cross-user-isolation.test.ts index 439b750e..781aba79 100644 --- a/apps/gateway/src/__tests__/cross-user-isolation.test.ts +++ b/apps/gateway/src/__tests__/cross-user-isolation.test.ts @@ -190,7 +190,13 @@ beforeEach((ctx) => { }); afterAll(async () => { - if (!handle) return; + // Cleanup only when the fixture actually installed rows. `handle` is set + // before the first query (createDb connects lazily), so on an unreachable + // database `handle` is truthy while nothing was inserted — cleanup must + // honor `dbAvailable` or the skip path fails the file with ECONNREFUSED in + // afterAll (caught live by the publish pipeline's no-DATABASE_URL verify + // step, pipeline 2486). + if (!handle || !dbAvailable) return; const db = handle.db; // Delete in dependency order (FK constraints)