Skip to content

Commit 2ac07b1

Browse files
committed
fix: satisfy knip and runops-legacy guard for queue slot holders
Drop unused exports on internal slot-holder types, remove now-clean lefthook knip exemption, and route QueueRetrievePresenter's run lookup through runStore instead of the control-plane replica client.
1 parent 2381a8a commit 2ac07b1

3 files changed

Lines changed: 13 additions & 15 deletions

File tree

apps/webapp/app/presenters/v3/QueueRetrievePresenter.server.ts

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { formatTriggerUri } from "@internal/dashboard-agent-contracts";
22
import { assertExhaustive } from "@trigger.dev/core/utils";
33
import { type Prettify, type QueueItem, type RetrieveQueueParam } from "@trigger.dev/core/v3";
44
import {
5-
boundedIn,
65
type PrismaClientOrTransaction,
76
type TaskQueue,
87
type TaskRunStatus,
@@ -11,12 +10,13 @@ import {
1110
} from "@trigger.dev/database";
1211
import { type AuthenticatedEnvironment } from "~/services/apiAuth.server";
1312
import { engine } from "~/v3/runEngine.server";
13+
import { runStore } from "~/v3/runStore.server";
1414
import { BasePresenter } from "./basePresenter.server";
1515

16-
export type SlotHolderPhase = "admitted" | "dequeued";
16+
type SlotHolderPhase = "admitted" | "dequeued";
1717
export type SlotHolderConsistency = "consistent" | "mismatch" | "unresolved";
1818
/** "not_found": a Redis slot holder with no matching TaskRun row. */
19-
export type SlotHolderStatus = TaskRunStatus | "not_found";
19+
type SlotHolderStatus = TaskRunStatus | "not_found";
2020

2121
/** Env-scope concurrency, alongside the queue row — the queue can show headroom while the env is saturated. */
2222
export type EnvConcurrency = {
@@ -247,22 +247,20 @@ export class QueueRetrievePresenter extends BasePresenter {
247247
return unresolved;
248248
}
249249

250-
let runs: { id: string; friendlyId: string; status: TaskRunStatus }[] | undefined;
250+
let runsById: Map<string, { friendlyId: string; status: TaskRunStatus }> | undefined;
251251
if (snapshot.holders.length > 0) {
252252
try {
253-
runs = await this._replica.taskRun.findMany({
254-
where: { id: { in: boundedIn(snapshot.holders.map((holder) => holder.runId)) } },
255-
select: { id: true, friendlyId: true, status: true },
256-
});
253+
runsById = await runStore.findRunsByIds(
254+
snapshot.holders.map((holder) => holder.runId),
255+
{ select: { friendlyId: true, status: true } }
256+
);
257257
} catch {
258-
runs = undefined;
258+
runsById = undefined;
259259
}
260260
} else {
261-
runs = [];
261+
runsById = new Map();
262262
}
263263

264-
const runsById = runs ? new Map(runs.map((run) => [run.id, run])) : undefined;
265-
266264
// An empty member id can't be formatted into a URI, so it can't be reported.
267265
const slotHolders = snapshot.holders
268266
.filter((holder) => holder.runId.length > 0)

internal-packages/run-engine/src/run-queue/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,9 @@ const DEFAULT_SLOT_HOLDER_MAX_VARIANTS = 50;
147147
* "admitted": the run holds a concurrency slot (member of currentConcurrency).
148148
* "dequeued": a worker has also pulled it off the worker queue (member of currentDequeued).
149149
*/
150-
export type QueueSlotHolderPhase = "admitted" | "dequeued";
150+
type QueueSlotHolderPhase = "admitted" | "dequeued";
151151

152-
export type QueueSlotHolder = {
152+
type QueueSlotHolder = {
153153
runId: string;
154154
concurrencyKey: string | null;
155155
phase: QueueSlotHolderPhase;

knip.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"workspaces": {
55
".": {
66
"entry": ["scripts/**/*.{js,mjs,cjs,ts,mts,cts}"],
7-
"ignoreDependencies": ["agentcrumbs", "eslint", "lefthook"],
7+
"ignoreDependencies": ["agentcrumbs", "eslint"],
88
"ignoreBinaries": ["infisical", "prisma"]
99
},
1010
"apps/supervisor": {

0 commit comments

Comments
 (0)