Skip to content

Commit 69464b9

Browse files
committed
fix(webapp): bound the fixed-length flag key IN filters
CI's oxlint flags an unbounded Prisma `in:` filter: the list length becomes the bind-parameter count, so each distinct length is a separate prepared statement. Both lists here are compile-time constants, but boundedIn is what the neighbouring call sites use and it needs no suppression comment. It pads to the next power of two by repeating the last key, which an IN over a unique column does not notice.
1 parent 19ae402 commit 69464b9

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

apps/webapp/app/v3/featureFlags.server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ async function stampGracedGroups(
252252
graceMs: number
253253
): Promise<Record<string, unknown>> {
254254
const existingRows = await tx.featureFlag.findMany({
255-
where: { key: { in: GRACED_GLOBAL_KEYS } },
255+
where: { key: { in: boundedIn(GRACED_GLOBAL_KEYS) } },
256256
select: { key: true, value: true },
257257
});
258258
const existingGlobal: Record<string, unknown> = {};

apps/webapp/app/v3/runOpsMigration/runOpsMintShard.server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { createHash } from "node:crypto";
22
import type { ShardKey } from "@trigger.dev/core/v3/isomorphic";
3-
import { $replica } from "~/db.server";
3+
import { $replica, boundedIn } from "~/db.server";
44
import { env } from "~/env.server";
55
import { logger } from "~/services/logger.server";
66
import { BoundedTtlCache } from "~/services/realtime/boundedTtlCache";
@@ -208,7 +208,7 @@ const liveCache = singleton("runOpsMintShardCache", (): { current: MintShardCach
208208

209209
async function readSetFlags(): Promise<Record<string, unknown>> {
210210
const rows = await $replica.featureFlag.findMany({
211-
where: { key: { in: GLOBAL_SHARD_KEYS } },
211+
where: { key: { in: boundedIn(GLOBAL_SHARD_KEYS) } },
212212
select: { key: true, value: true },
213213
});
214214
const flags: Record<string, unknown> = {};

0 commit comments

Comments
 (0)