Skip to content

Commit 95fbc44

Browse files
d-csclaude
andcommitted
test(run-store): seed the NEW-arm routed-read test with a v1 run-ops id
The routed-read primary test (from #4153) hardcoded a 27-char KSUID as the NEW-resident id, which the base32hex version-char discriminator now classifies LEGACY — so the NEW arm routed to the wrong store and failed. Seed it with a real generateRunOpsId() v1 body instead. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 40fca04 commit 95fbc44

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

internal-packages/run-store/src/runOpsStore.routedReadPrimary.test.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,18 @@
1212
// primary-routed read finds the row, with no replica==primary aliasing to mask the drop.
1313

1414
import { heteroPostgresTest } from "@internal/testcontainers";
15+
import { generateRunOpsId } from "@trigger.dev/core/v3/isomorphic";
1516
import type { PrismaClient } from "@trigger.dev/database";
1617
import { describe, expect } from "vitest";
1718
import { PostgresRunStore } from "./PostgresRunStore.js";
1819
import { RoutingRunStore } from "./runOpsStore.js";
1920
import { markReadReplicaClient } from "./readReplicaClient.js";
2021
import type { CreateRunInput } from "./types.js";
2122

22-
// ownerEngine classifies by internal-id LENGTH: 25 chars → cuid → LEGACY, 27 → ksuid → NEW.
23+
// ownerEngine classifies by the version char: a 25-char cuid → LEGACY; a valid run-ops v1 body
24+
// (26 chars: base32hex core + region char + version "1") → NEW.
2325
const CUID_25 = "c".repeat(25);
24-
const KSUID_27 = "k".repeat(27);
26+
const RUN_OPS_ID_BODY = generateRunOpsId();
2527

2628
// Router topology where the OWNING store (the one the test's run ids route to) writes to `writer`
2729
// but reads by default from `lagging` — a physically separate, never-written DB. The other store
@@ -189,16 +191,16 @@ describe("run-ops split — routed reads honor a caller-passed client via the ow
189191
}
190192
);
191193

192-
// NEW (ksuid) routing arm. The caller's client here is the CONTROL-PLANE writer — the wrong
194+
// NEW (run-ops id) routing arm. The caller's client here is the CONTROL-PLANE writer — the wrong
193195
// physical DB for a NEW-resident run — so this also pins that the client is never forwarded
194196
// verbatim: the read must resolve on the owning NEW store's OWN primary.
195197
heteroPostgresTest(
196-
"NEW ksuid: a control-plane client routes the snapshot read to the NEW store's OWN primary",
198+
"NEW run-ops id: a control-plane client routes the snapshot read to the NEW store's OWN primary",
197199
async ({ prisma14, prisma17 }) => {
198200
// Owning (NEW) store writes to prisma14; the control-plane/other store is prisma17.
199201
const { router } = splitTopology("NEW", prisma14, prisma17);
200202
const seed = await seedEnvironment(prisma14, "snap_new");
201-
const runId = `run_${KSUID_27}`;
203+
const runId = `run_${RUN_OPS_ID_BODY}`;
202204
await router.createRun(
203205
buildCreateRunInput({
204206
runId,

0 commit comments

Comments
 (0)