Skip to content

Commit 163f1ed

Browse files
d-csclaude
andcommitted
chore(run-ops): rename the "ksuid" mint-kind value to "runOpsId"
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 95fbc44 commit 163f1ed

21 files changed

Lines changed: 71 additions & 71 deletions

.changeset/olive-bees-repeat.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
"@trigger.dev/core": patch
33
---
44

5-
Change the run-ops run id format from a 27-char base62 KSUID to a 26-char lowercase base32hex id (ms timestamp + CSPRNG core, region char, version char) so run ids are DNS-1123 safe for Kubernetes pod names while staying lexicographically time-sortable
5+
Change the run-ops run id format from a 27-char base62 KSUID to a 26-char lowercase base32hex id (ms timestamp + CSPRNG core, region char, version char) so run ids are DNS-1123 safe for Kubernetes pod names while staying lexicographically time-sortable, and rename the exported `ResidencyKind` value `"ksuid"` to `"runOpsId"` to reflect that the NEW-store id is no longer a KSUID

apps/webapp/app/env.server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1729,7 +1729,7 @@ const EnvironmentSchema = z
17291729

17301730
// Run-ops id mint cutover — per-env, canary-first, OFF by default.
17311731
// Even when on, an env mints run-ops ids only if its per-org runOpsMintKsuid flag is
1732-
// "ksuid" AND isSplitEnabled() is true. Cache mirrors REALTIME_BACKEND_FLAG_CACHE_*.
1732+
// "runOpsId" AND isSplitEnabled() is true. Cache mirrors REALTIME_BACKEND_FLAG_CACHE_*.
17331733
RUN_OPS_MINT_KSUID_ENABLED: BoolEnv.default(false),
17341734
RUN_OPS_MINT_FLAG_CACHE_TTL_MS: z.coerce.number().int().default(30_000),
17351735
RUN_OPS_MINT_FLAG_CACHE_MAX_ENTRIES: z.coerce.number().int().default(10_000),

apps/webapp/app/runEngine/concerns/idempotencyResidency.server.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function makeDeps(over: Partial<ResolveIdempotencyClientDeps>): ResolveIdempoten
1616
fallbackClient: FALLBACK,
1717
newClient: NEW_CLIENT,
1818
legacyClient: LEGACY_CLIENT,
19-
resolveMintKind: async () => "ksuid",
19+
resolveMintKind: async () => "runOpsId",
2020
classify: (id) => {
2121
if (id.length === 26 && id[25] === "1") return "NEW";
2222
if (id.length === 25) return "LEGACY";
@@ -41,7 +41,7 @@ describe("resolveIdempotencyDedupClient", () => {
4141
it("routes a root run to the NEW client when the env mints run-ops ids", async () => {
4242
const client = await resolveIdempotencyDedupClient(
4343
{ environmentForMint: env, parentRunFriendlyId: undefined },
44-
makeDeps({ resolveMintKind: async () => "ksuid" })
44+
makeDeps({ resolveMintKind: async () => "runOpsId" })
4545
);
4646
expect(client).toBe(NEW_CLIENT);
4747
});
@@ -67,7 +67,7 @@ describe("resolveIdempotencyDedupClient", () => {
6767
const cuidParent = RunId.toFriendlyId("b".repeat(25));
6868
const client = await resolveIdempotencyDedupClient(
6969
{ environmentForMint: env, parentRunFriendlyId: cuidParent },
70-
makeDeps({ resolveMintKind: async () => "ksuid" }) // mint flag must NOT win for a child
70+
makeDeps({ resolveMintKind: async () => "runOpsId" }) // mint flag must NOT win for a child
7171
);
7272
expect(client).toBe(LEGACY_CLIENT);
7373
});

apps/webapp/app/runEngine/concerns/idempotencyResidency.server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ownerEngine, RunId, type Residency } from "@trigger.dev/core/v3/isomorphic";
22
import type { PrismaClientOrTransaction } from "@trigger.dev/database";
33

4-
type MintKind = "cuid" | "ksuid";
4+
type MintKind = "cuid" | "runOpsId";
55

66
export type ResolveIdempotencyClientDeps = {
77
isSplitEnabled: () => Promise<boolean>;
@@ -52,5 +52,5 @@ export async function resolveIdempotencyDedupClient(
5252
}
5353

5454
const kind = await deps.resolveMintKind(args.environmentForMint);
55-
return clientFor(kind === "ksuid" ? "NEW" : "LEGACY");
55+
return clientFor(kind === "runOpsId" ? "NEW" : "LEGACY");
5656
}

apps/webapp/app/runEngine/services/triggerFailedTask.server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export class TriggerFailedTaskService {
102102
orgFeatureFlags: args.orgFeatureFlags,
103103
});
104104

105-
return mintKind === "ksuid"
105+
return mintKind === "runOpsId"
106106
? RunId.toFriendlyId(generateRunOpsId())
107107
: RunId.generate().friendlyId;
108108
}

apps/webapp/app/runEngine/services/triggerTask.server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ export class RunEngineTriggerTaskService {
153153
orgFeatureFlags: environment.organization.featureFlags,
154154
});
155155

156-
return mintKind === "ksuid"
156+
return mintKind === "runOpsId"
157157
? RunId.toFriendlyId(generateRunOpsId(region))
158158
: RunId.generate().friendlyId;
159159
}

apps/webapp/app/v3/featureFlags.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export const FeatureFlagCatalog = {
5353
[FEATURE_FLAG.devBranchesEnabled]: z.coerce.boolean(),
5454
// Per-org run-ops-id mint cutover. Defaults to "cuid"; only honored when
5555
// RUN_OPS_MINT_KSUID_ENABLED is on AND isSplitEnabled() is true.
56-
[FEATURE_FLAG.runOpsMintKsuid]: z.enum(["cuid", "ksuid"]),
56+
[FEATURE_FLAG.runOpsMintKsuid]: z.enum(["cuid", "runOpsId"]),
5757
};
5858

5959
export type FeatureFlagKey = keyof typeof FeatureFlagCatalog;

apps/webapp/app/v3/runOpsMigration/mintBatchFriendlyId.server.test.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ import { batchIdForMintKind, resolveBatchMintKind } from "./mintBatchFriendlyId.
33
import { classifyKind } from "@trigger.dev/core/v3/isomorphic";
44

55
describe("batchIdForMintKind (pure)", () => {
6-
it("'ksuid' kind -> 26-char classifiable NEW batch id (no 21-char ids)", () => {
7-
const r = batchIdForMintKind("ksuid");
6+
it("'runOpsId' kind -> 26-char classifiable NEW batch id (no 21-char ids)", () => {
7+
const r = batchIdForMintKind("runOpsId");
88
expect(r.friendlyId.startsWith("batch_")).toBe(true);
99
expect(r.id.length).toBe(26);
10-
expect(classifyKind(r.id)).toBe("ksuid");
11-
expect(classifyKind(r.friendlyId)).toBe("ksuid");
10+
expect(classifyKind(r.id)).toBe("runOpsId");
11+
expect(classifyKind(r.friendlyId)).toBe("runOpsId");
1212
});
1313

1414
it("cuid -> 25-char classifiable LEGACY batch id", () => {
@@ -19,7 +19,7 @@ describe("batchIdForMintKind (pure)", () => {
1919
});
2020

2121
it("never mints a 21-char id", () => {
22-
for (const kind of ["cuid", "ksuid"] as const) {
22+
for (const kind of ["cuid", "runOpsId"] as const) {
2323
expect([25, 26]).toContain(batchIdForMintKind(kind).id.length);
2424
}
2525
});
@@ -29,12 +29,12 @@ describe("resolveBatchMintKind", () => {
2929
const environment = { organizationId: "org_1", id: "env_1", orgFeatureFlags: {} };
3030

3131
it("ROOT batch (no parent) resolves per-org kind via resolveRunIdMintKind", async () => {
32-
const resolveRunIdMintKind = vi.fn().mockResolvedValue("ksuid");
32+
const resolveRunIdMintKind = vi.fn().mockResolvedValue("runOpsId");
3333
const kind = await resolveBatchMintKind({
3434
environment,
3535
deps: { resolveRunIdMintKind },
3636
});
37-
expect(kind).toBe("ksuid");
37+
expect(kind).toBe("runOpsId");
3838
expect(resolveRunIdMintKind).toHaveBeenCalledWith({
3939
organizationId: "org_1",
4040
id: "env_1",
@@ -61,7 +61,7 @@ describe("resolveBatchMintKind", () => {
6161
deps: { resolveRunIdMintKind },
6262
});
6363

64-
expect(kind).toBe("ksuid");
64+
expect(kind).toBe("runOpsId");
6565
expect(resolveRunIdMintKind).not.toHaveBeenCalled();
6666
});
6767

@@ -81,9 +81,9 @@ describe("resolveBatchMintKind", () => {
8181

8282
// mint-on-FLIP invariant: a child follows its parent's store even after the org flag
8383
// flips the other way. The flag resolver must NEVER be consulted for a child.
84-
it("FLIP 'cuid'->'ksuid': a cuid (LEGACY) parent still mints a cuid child though the flag now says 'ksuid'", async () => {
84+
it("FLIP 'cuid'->'runOpsId': a cuid (LEGACY) parent still mints a cuid child though the flag now says 'runOpsId'", async () => {
8585
const parentRunFriendlyId = `run_${"a".repeat(25)}`;
86-
const resolveRunIdMintKind = vi.fn().mockResolvedValue("ksuid"); // flag flipped to ksuid
86+
const resolveRunIdMintKind = vi.fn().mockResolvedValue("runOpsId"); // flag flipped to runOpsId
8787
const kind = await resolveBatchMintKind({
8888
environment,
8989
parentRunFriendlyId,
@@ -93,15 +93,15 @@ describe("resolveBatchMintKind", () => {
9393
expect(resolveRunIdMintKind).not.toHaveBeenCalled();
9494
});
9595

96-
it("FLIP 'ksuid'->'cuid': a run-ops (NEW) parent still mints a run-ops child though the flag now says 'cuid'", async () => {
96+
it("FLIP 'runOpsId'->'cuid': a run-ops (NEW) parent still mints a run-ops child though the flag now says 'cuid'", async () => {
9797
const parentRunFriendlyId = `run_${"a".repeat(24) + "01"}`;
9898
const resolveRunIdMintKind = vi.fn().mockResolvedValue("cuid"); // flag flipped back to cuid
9999
const kind = await resolveBatchMintKind({
100100
environment,
101101
parentRunFriendlyId,
102102
deps: { resolveRunIdMintKind },
103103
});
104-
expect(kind).toBe("ksuid");
104+
expect(kind).toBe("runOpsId");
105105
expect(resolveRunIdMintKind).not.toHaveBeenCalled();
106106
});
107107
});

apps/webapp/app/v3/runOpsMigration/mintBatchFriendlyId.server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const defaultDeps: ResolveDeps = {
1414
};
1515

1616
export function batchIdForMintKind(kind: RunIdMintKind): { id: string; friendlyId: string } {
17-
if (kind === "ksuid") {
17+
if (kind === "runOpsId") {
1818
const id = generateRunOpsId();
1919
return { id, friendlyId: BatchId.toFriendlyId(id) };
2020
}

apps/webapp/app/v3/runOpsMigration/resolveInheritedMintKind.server.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ const NEW_PARENT = `run_${"a".repeat(24) + "01"}`; // run-ops id-shape -> NEW
55
const LEGACY_PARENT = `run_${"b".repeat(25)}`; // cuid id-shape -> LEGACY
66

77
describe("resolveInheritedMintKind (pure id-shape, shared across all mint paths)", () => {
8-
it("inherits a run-ops (NEW) parent by id-shape -> 'ksuid' kind", () => {
9-
expect(resolveInheritedMintKind(NEW_PARENT)).toBe("ksuid");
8+
it("inherits a run-ops (NEW) parent by id-shape -> 'runOpsId' kind", () => {
9+
expect(resolveInheritedMintKind(NEW_PARENT)).toBe("runOpsId");
1010
});
1111

1212
it("inherits a cuid (LEGACY) parent by id-shape -> cuid", () => {

0 commit comments

Comments
 (0)