Skip to content

Commit 4d07473

Browse files
committed
docs(run-store): correct findRuns routing comments after id-set change
1 parent a69429a commit 4d07473

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

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

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -301,12 +301,12 @@ export class RoutingRunStore implements RunStore {
301301
},
302302
client?: ReadClient
303303
): Promise<unknown> {
304-
// SPLIT-mode fan-out across NEW + LEGACY. A `findRuns` `where` can span ids of mixed
305-
// residency, so we resolve each owning store and merge, preserving orderBy/take/skip.
306-
// The caller's client is never forwarded verbatim (it is the control-plane client); its
307-
// presence routes each leg to that store's OWN primary (read-your-writes), else each store
308-
// reads its own replica as before. NEW wins on id collisions (the copy->fence migration
309-
// window) so a half-migrated run is never double-reported.
304+
// SPLIT-mode routing across NEW + LEGACY. A bounded id set is routed per id to its owning
305+
// store by residency (#findRunsByIdSet); an open predicate with no id to route on unions both
306+
// stores and dedupes NEW-wins (#findRunsOpen). Either way orderBy/take/skip are re-imposed
307+
// globally over the merged rows. The caller's client is never forwarded verbatim (it is the
308+
// control-plane client); its presence routes each leg to that store's OWN primary
309+
// (read-your-writes), else each store reads its own replica as before.
310310
return this.#findRunsRouted(args, client);
311311
}
312312

@@ -324,6 +324,12 @@ export class RoutingRunStore implements RunStore {
324324
return idList ? this.#findRunsByIdSet(args, idList, client) : this.#findRunsOpen(args, client);
325325
}
326326

327+
// Bounded id-set (the list hydrate + engine sweeps). Residency is a total function of the id
328+
// (classifyResidency), so route each id to its owning store and query each store only for its
329+
// own ids, in parallel; never query NEW for a cuid or LEGACY for a run-ops id. The partitions
330+
// are disjoint by construction, so the merge needs no dedupe. take/skip are never pushed per
331+
// store (that would truncate a store's page before the merge knows membership); finalizeRows
332+
// re-imposes orderBy/take/skip once, globally, over the merged rows.
327333
async #findRunsByIdSet(
328334
args: FindRunsArgs,
329335
ids: string[],

0 commit comments

Comments
 (0)