|
12 | 12 | // primary-routed read finds the row, with no replica==primary aliasing to mask the drop. |
13 | 13 |
|
14 | 14 | import { heteroPostgresTest } from "@internal/testcontainers"; |
| 15 | +import { generateRunOpsId } from "@trigger.dev/core/v3/isomorphic"; |
15 | 16 | import type { PrismaClient } from "@trigger.dev/database"; |
16 | 17 | import { describe, expect } from "vitest"; |
17 | 18 | import { PostgresRunStore } from "./PostgresRunStore.js"; |
18 | 19 | import { RoutingRunStore } from "./runOpsStore.js"; |
19 | 20 | import { markReadReplicaClient } from "./readReplicaClient.js"; |
20 | 21 | import type { CreateRunInput } from "./types.js"; |
21 | 22 |
|
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. |
23 | 25 | const CUID_25 = "c".repeat(25); |
24 | | -const KSUID_27 = "k".repeat(27); |
| 26 | +const RUN_OPS_ID_BODY = generateRunOpsId(); |
25 | 27 |
|
26 | 28 | // Router topology where the OWNING store (the one the test's run ids route to) writes to `writer` |
27 | 29 | // 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 |
189 | 191 | } |
190 | 192 | ); |
191 | 193 |
|
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 |
193 | 195 | // physical DB for a NEW-resident run — so this also pins that the client is never forwarded |
194 | 196 | // verbatim: the read must resolve on the owning NEW store's OWN primary. |
195 | 197 | 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", |
197 | 199 | async ({ prisma14, prisma17 }) => { |
198 | 200 | // Owning (NEW) store writes to prisma14; the control-plane/other store is prisma17. |
199 | 201 | const { router } = splitTopology("NEW", prisma14, prisma17); |
200 | 202 | const seed = await seedEnvironment(prisma14, "snap_new"); |
201 | | - const runId = `run_${KSUID_27}`; |
| 203 | + const runId = `run_${RUN_OPS_ID_BODY}`; |
202 | 204 | await router.createRun( |
203 | 205 | buildCreateRunInput({ |
204 | 206 | runId, |
|
0 commit comments