From 9242c2c1965b8363f5abbb57e6bf4e5f23a8b381 Mon Sep 17 00:00:00 2001 From: choksi2212 Date: Tue, 13 Oct 2026 23:11:28 +0530 Subject: [PATCH] fix(org): build the deleteOrg child test under the pg config deleteOrg.childTest.ts read its leftover counts with db.get(sql...), a better-sqlite3 driver method. The pg config type-checks the same file with the pg driver's types, where .get() does not exist, so build-postgres failed on PR #3895's head (TS2339 at deleteOrg.childTest.ts:108) and main has carried the break since the merge landed 40 seconds before the job reported red. Read the counts through the query builder instead - the same .select({ count: count() }) shape deleteOrg.ts itself uses, which compiles under both configs - keeping the observations JSON the parent test parses unchanged. Signed-off-by: Manas Choksi <12302040701105@mbit.edu.in> Signed-off-by: choksi2212 --- server/lib/deleteOrg.childTest.ts | 34 +++++++++++++++---------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/server/lib/deleteOrg.childTest.ts b/server/lib/deleteOrg.childTest.ts index b00a4f96d..15e0763e8 100644 --- a/server/lib/deleteOrg.childTest.ts +++ b/server/lib/deleteOrg.childTest.ts @@ -16,7 +16,7 @@ import { newtSessions, clientSitesAssociationsCache } from "@server/db"; -import { sql } from "drizzle-orm"; +import { count, eq } from "drizzle-orm"; const peerRemovals: string[] = []; const server = http.createServer((req, res) => { @@ -105,28 +105,28 @@ server.listen(0, "127.0.0.1", async () => { const result = await deleteOrgById("org1"); - const row = (await db.get( - sql`select - (select count(*) from sites) as sites, - (select count(*) from "newt") as newts, - (select count(*) from "newtSession") as sessions, - (select count(*) from clientSitesAssociationsCache where siteId = 3) as assoc` - )) as { - sites: number; - newts: number; - sessions: number; - assoc: number; - }; + // Read the leftovers through the query builder, not db.get(): the + // pg build type-checks this file against the pg driver too, and + // .get() exists only on the sqlite driver. + const [sitesRow] = await db.select({ count: count() }).from(sites); + const [newtsRow] = await db.select({ count: count() }).from(newts); + const [sessionsRow] = await db + .select({ count: count() }) + .from(newtSessions); + const [assocRow] = await db + .select({ count: count() }) + .from(clientSitesAssociationsCache) + .where(eq(clientSitesAssociationsCache.siteId, 3)); console.log( "OBSERVATIONS " + JSON.stringify({ peerRemovals: peerRemovals.slice().sort(), terminatedNewtIds: result.deletedNewtIds.slice().sort(), - sitesLeft: Number(row.sites), - newtsLeft: Number(row.newts), - sessionsLeft: Number(row.sessions), - associationRowsLeft: Number(row.assoc) + sitesLeft: sitesRow.count, + newtsLeft: newtsRow.count, + sessionsLeft: sessionsRow.count, + associationRowsLeft: assocRow.count }) ); server.close();