Skip to content

Commit 2a92b7a

Browse files
d-csclaude
andcommitted
chore(run-ops): rename stale "ksuid" identifiers to runOpsId (no behavior change)
The run-ops NEW-store run id is a 26-char base32hex id, not a KSUID, so code identifiers named "ksuid" were stale and misleading. Rename them to a consistent runOpsId/run-ops family (vars, test constants, helpers, fixture strings) and update comments/test descriptions to describe the current design. Also fixes 3 review findings in the touched test files: apiRunResultPresenter's newFriendlyId helper now mints a valid 26-char NEW body (was 27-char, silently LEGACY), lifecycleRouter's newRunId maps suffixes without the lossy outlier->"0" collision, and triggerTask uses the static generateRunOpsId import. Load-bearing wire values are untouched: the RUN_OPS_MINT_KSUID_ENABLED env var, the runOpsMintKsuid feature-flag key, and the persisted "ksuid"/"cuid" enum values. The one KSUID history note and the checksummed migration comment remain. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 48a6686 commit 2a92b7a

76 files changed

Lines changed: 473 additions & 462 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

apps/webapp/app/env.server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1727,8 +1727,8 @@ const EnvironmentSchema = z
17271727
RUN_REPLICATION_LEGACY_ORIGIN_GENERATION: z.coerce.number().int().default(0),
17281728
RUN_REPLICATION_NEW_ORIGIN_GENERATION: z.coerce.number().int().default(1),
17291729

1730-
// Run-ops KSUID mint cutover — per-env, canary-first, OFF by default.
1731-
// Even when on, an env mints KSUID only if its per-org runOpsMintKsuid flag is
1730+
// Run-ops id mint cutover — per-env, canary-first, OFF by default.
1731+
// Even when on, an env mints run-ops ids only if its per-org runOpsMintKsuid flag is
17321732
// "ksuid" 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),

apps/webapp/app/presenters/v3/ApiBatchResultsPresenter.server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ export class ApiBatchResultsPresenter extends BasePresenter {
131131
}
132132

133133
// Split: resolve the batch row new-first then off the legacy READ REPLICA only (a batch id may
134-
// be cuid or ksuid, and a cuid-shaped id can still have been backfilled onto NEW, so id-shape
134+
// be cuid or run-ops id, and a cuid-shaped id can still have been backfilled onto NEW, so id-shape
135135
// residency is not authoritative for the row — the new-first-then-legacy probe is), then
136136
// hydrate every member run independently via the per-run read-through primitive.
137137
async #callSplit(

apps/webapp/app/presenters/v3/ApiWaitpointPresenter.server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export class ApiWaitpointPresenter extends BasePresenter {
4242
// Public waitpoint retrieve. Split on: new run-ops client first, then the LEGACY
4343
// RUN-OPS READ REPLICA ONLY on a new-probe miss — never the legacy primary.
4444
// Split off (single-DB / self-host): one plain waitpoint.findFirst against the replica
45-
// (passthrough). The waitpointId is the residency-classifiable KSUID id (the route
45+
// (passthrough). The waitpointId is the residency-classifiable run-ops id (the route
4646
// pre-decodes the friendlyId via WaitpointId.toId).
4747
const hydrate = (client: PrismaReplicaClient) =>
4848
client.waitpoint.findFirst({

apps/webapp/app/presenters/v3/BatchListPresenter.server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ export class BatchListPresenter extends BasePresenter {
101101
}
102102
}
103103

104-
// codepoint comparator (NEVER localeCompare): BatchTaskRun.id is ASCII (cuid or ksuid).
104+
// codepoint comparator (NEVER localeCompare): BatchTaskRun.id is ASCII (cuid or run-ops id).
105105
const sign = direction === "forward" ? 1 : -1; // forward => DESC; backward => ASC
106106
return Array.from(byId.values())
107107
.sort((a, b) => (a.id < b.id ? sign : a.id > b.id ? -sign : 0))

apps/webapp/app/presenters/v3/BatchPresenter.server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export class BatchPresenter extends BasePresenter {
7979
const batchResult = await readThrough<BatchRow>({
8080
// The read-through key; here it is the batch friendlyId. A cuid-shaped batch friendlyId
8181
// classifies as LEGACY and the read-through probes both stores (new first, then legacy
82-
// replica); a ksuid-shaped one (cut-over orgs) classifies as NEW and reads only the new
82+
// replica); a run-ops-shaped one (cut-over orgs) classifies as NEW and reads only the new
8383
// store — either way the row is found on the DB that owns it.
8484
runId: batchId,
8585
environmentId,

apps/webapp/app/routes/api.v1.runs.$runFriendlyId.input-streams.wait.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ const { action, loader } = createActionApiRoute(
7878
}
7979
}
8080

81-
// Create the waitpoint. Co-locate it with the owning run (run-ops split) so a ksuid
81+
// Create the waitpoint. Co-locate it with the owning run (run-ops split) so a run-ops id
8282
// run's input-stream waitpoint lands on the run's DB and its block edge resolves.
8383
const result = await engine.createManualWaitpoint({
8484
runId: run.id,

apps/webapp/app/routes/api.v1.runs.$runFriendlyId.session-streams.wait.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ const { action, loader } = createActionApiRoute(
9999
}
100100
}
101101

102-
// Create the waitpoint. Co-locate it with the owning run (run-ops split) so a ksuid
102+
// Create the waitpoint. Co-locate it with the owning run (run-ops split) so a run-ops id
103103
// run's session-stream waitpoint lands on the run's DB and its block edge resolves.
104104
const result = await engine.createManualWaitpoint({
105105
runId: run.id,

apps/webapp/app/routes/engine.v1.runs.$runFriendlyId.wait.duration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const { action } = createActionApiRoute(
4242
: undefined;
4343

4444
const { waitpoint } = await engine.createDateTimeWaitpoint({
45-
// Co-locate the waitpoint with the run that blocks on it (run-ops split): a ksuid run lives
45+
// Co-locate the waitpoint with the run that blocks on it (run-ops split): a run-ops run lives
4646
// on the dedicated DB, but the minted waitpoint id is always a cuid, so without the run id
4747
// the waitpoint would route to the control-plane DB and the block edge would never resolve.
4848
runId: run.id,

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ describe("resolveIdempotencyDedupClient", () => {
3838
expect(client).toBe(FALLBACK);
3939
});
4040

41-
it("routes a root run to the NEW client when the env mints ksuid", async () => {
41+
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 },
4444
makeDeps({ resolveMintKind: async () => "ksuid" })
@@ -54,10 +54,10 @@ describe("resolveIdempotencyDedupClient", () => {
5454
expect(client).toBe(LEGACY_CLIENT);
5555
});
5656

57-
it("routes a child to the NEW client when the ksuid parent is NEW-resident", async () => {
58-
const ksuidParent = RunId.toFriendlyId("a".repeat(24) + "01");
57+
it("routes a child to the NEW client when the run-ops parent is NEW-resident", async () => {
58+
const runOpsParent = RunId.toFriendlyId("a".repeat(24) + "01");
5959
const client = await resolveIdempotencyDedupClient(
60-
{ environmentForMint: env, parentRunFriendlyId: ksuidParent },
60+
{ environmentForMint: env, parentRunFriendlyId: runOpsParent },
6161
makeDeps({ resolveMintKind: async () => "cuid" }) // mint flag must NOT win for a child
6262
);
6363
expect(client).toBe(NEW_CLIENT);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ export class StreamBatchItemsService extends WithRunEngine {
129129
const batchId = this.parseBatchFriendlyId(batchFriendlyId);
130130

131131
// Validate batch exists and belongs to this environment. Routed by batch id so a
132-
// ksuid (NEW-resident) batch is found on the owning DB; the env-ownership check that
132+
// run-ops id (NEW-resident) batch is found on the owning DB; the env-ownership check that
133133
// was in the where clause is enforced app-side below.
134134
const batch = await this._engine.runStore.findBatchTaskRunById(batchId);
135135

0 commit comments

Comments
 (0)