Skip to content

Commit 3835389

Browse files
committed
refactor(webapp): use the branded run-ops legacy handle in cancelTaskRun
Swap cancelTaskRun's V1 finalize writes from runOpsLegacyPrisma (control-plane typed, needed a runops-legacy-ok annotation) to the branded runOpsLegacyPrismaClient, which the guard classifies as run-ops. Same legacy writer at runtime; drops the two annotations and their baseline entries. Matches the existing legacyWriter usage.
1 parent f98b350 commit 3835389

2 files changed

Lines changed: 5 additions & 20 deletions

File tree

apps/webapp/app/v3/runOpsMigration/track1-baseline.json

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
"write": 0,
7676
"read": 4,
7777
"files": 1,
78-
"legacyAnnotations": 2
78+
"legacyAnnotations": 0
7979
},
8080
"violations": [
8181
{
@@ -115,18 +115,5 @@
115115
"snippet": "const legacyRows = (await legacyReplica.taskRun.findMany({"
116116
}
117117
],
118-
"legacyAnnotations": [
119-
{
120-
"file": "apps/webapp/app/v3/services/cancelTaskRun.server.ts",
121-
"line": 48,
122-
"reason": "bulk-action tag on a historical V1 run (legacy-resident)",
123-
"receiver": "runOpsLegacyPrisma"
124-
},
125-
{
126-
"file": "apps/webapp/app/v3/services/cancelTaskRun.server.ts",
127-
"line": 57,
128-
"reason": "finalize (cancel) a historical V1 run (legacy-resident)",
129-
"receiver": "runOpsLegacyPrisma"
130-
}
131-
]
118+
"legacyAnnotations": []
132119
}

apps/webapp/app/v3/services/cancelTaskRun.server.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { RunEngineVersion, type TaskRun } from "@trigger.dev/database";
2-
import { runOpsLegacyPrisma } from "~/db.server";
2+
import { runOpsLegacyPrismaClient } from "~/db.server";
33
import { engine } from "../runEngine.server";
44
import { isCancellableRunStatus } from "../taskStatus";
55
import { BaseService } from "./baseService.server";
@@ -44,17 +44,15 @@ export class CancelTaskRunService extends BaseService {
4444
// DB row directly. Never throw here: the cancel route returns 500 on any throw.
4545
if (!isCancellableRunStatus(taskRun.status)) {
4646
if (options?.bulkActionId) {
47-
// runops-legacy-ok: bulk-action tag on a historical V1 run (legacy-resident)
48-
await runOpsLegacyPrisma.taskRun.update({
47+
await runOpsLegacyPrismaClient.taskRun.update({
4948
where: { id: taskRun.id },
5049
data: { bulkActionGroupIds: { push: options.bulkActionId } },
5150
});
5251
}
5352
return { id: taskRun.id, alreadyFinished: true };
5453
}
5554

56-
// runops-legacy-ok: finalize (cancel) a historical V1 run (legacy-resident)
57-
await runOpsLegacyPrisma.taskRun.update({
55+
await runOpsLegacyPrismaClient.taskRun.update({
5856
where: { id: taskRun.id },
5957
data: {
6058
status: "CANCELED",

0 commit comments

Comments
 (0)