Skip to content

Commit 1012e5b

Browse files
d-csclaude
andcommitted
test(run-ops split): rewrite waitpoint-token tests to the always-cuid contract
Waitpoint ids are always cuid; residency is decided by co-location routing, not id-shape. Remove the removed setKsuidMintEnabled global and flip the standalone-token assertions to cuid/LEGACY. Drive the NEW/cross-seam side from a ksuid run co-locating its (cuid) token on #new instead of a ksuid token, and keep the cross-seam guard consulted unconditionally on a plain cuid token. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 1583f3e commit 1012e5b

2 files changed

Lines changed: 191 additions & 85 deletions

File tree

apps/webapp/test/api.v1.waitpoints.tokens.complete.crossSeamGuard.test.ts

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { describe, expect, afterEach, vi } from "vitest";
1+
import { describe, expect, vi } from "vitest";
22

33
// Regression for the waitpoint-token completion route path: the route calls
44
// engine.completeWaitpoint, which must consult the cross-seam residency guard
@@ -10,18 +10,13 @@ import { RunEngine } from "@internal/run-engine";
1010
import { setupAuthenticatedEnvironment } from "@internal/run-engine/tests";
1111
import { containerTest, heteroPostgresTest } from "@internal/testcontainers";
1212
import type { PrismaClient } from "@trigger.dev/database";
13-
import { setKsuidMintEnabled, WaitpointId } from "@trigger.dev/core/v3/isomorphic";
13+
import { WaitpointId } from "@trigger.dev/core/v3/isomorphic";
1414
import { trace } from "@opentelemetry/api";
1515

1616
vi.setConfig({ testTimeout: 60_000 });
1717

1818
type CrossSeamGuard = ConstructorParameters<typeof RunEngine>[0]["crossSeamGuard"];
1919

20-
afterEach(() => {
21-
// Never let the ksuid mint mode leak into other webapp tests.
22-
setKsuidMintEnabled(false);
23-
});
24-
2520
function buildEngine(opts: {
2621
prisma: any;
2722
redisOptions: any;
@@ -64,8 +59,6 @@ describe("waitpoint-token complete route — cross-seam guard", () => {
6459
containerTest(
6560
"consults the guard first (RESUME_TOKEN), then completes (single-store)",
6661
async ({ prisma, redisOptions }) => {
67-
setKsuidMintEnabled(true);
68-
6962
const seen: Array<{ waitpointId: string; routeKind: string }> = [];
7063
const engine = buildEngine({
7164
prisma,
@@ -95,7 +88,6 @@ describe("waitpoint-token complete route — cross-seam guard", () => {
9588
// The guard was consulted first, with the right id + RESUME_TOKEN route kind.
9689
expect(seen).toEqual([{ waitpointId: waitpoint.id, routeKind: "RESUME_TOKEN" }]);
9790

98-
// The completion was then applied via delegation (single-store path).
9991
const after = await prisma.waitpoint.findFirst({ where: { id: waitpoint.id } });
10092
expect(after?.status).toBe("COMPLETED");
10193
} finally {
@@ -109,8 +101,6 @@ describe("waitpoint-token complete route — cross-seam guard", () => {
109101
containerTest(
110102
"propagates a guard throw and leaves the waitpoint PENDING (loud)",
111103
async ({ prisma, redisOptions }) => {
112-
setKsuidMintEnabled(true);
113-
114104
const engine = buildEngine({
115105
prisma,
116106
redisOptions,
@@ -195,8 +185,6 @@ describe("waitpoint-token complete route — no FK abort across the PG14<->17 bo
195185
heteroPostgresTest(
196186
"completes a run-ops waitpoint on each version store without tripping the absent control-plane Cascade FK",
197187
async ({ prisma14, prisma17 }) => {
198-
setKsuidMintEnabled(true);
199-
200188
const legacy = prisma14 as unknown as PrismaClient;
201189
const next = prisma17 as unknown as PrismaClient;
202190

0 commit comments

Comments
 (0)