test(gateway): cross-user-isolation cleanup honors dbAvailable — unblocks gated publish verify (#1275) #1304

Merged
jarvis merged 1 commits from fix/ri-050-verify-pglite-path into next 2026-08-18 04:24:49 +00:00
@@ -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)