Skip to content

Commit 139f179

Browse files
d-csclaude
andcommitted
chore(run-engine): trim assertion-echo comments, tighten fallback comment
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 8ec0842 commit 139f179

2 files changed

Lines changed: 3 additions & 8 deletions

File tree

internal-packages/run-engine/src/engine/index.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1947,10 +1947,9 @@ export class RunEngine {
19471947
return await query(prisma);
19481948
} catch (e) {
19491949
if (useReplica && e instanceof ExecutionSnapshotNotFoundError) {
1950-
// Expected during replica lag: the runner learned the snapshot id from the writer
1951-
// before the replica caught up. Serve the read from the writer instead of failing
1952-
// the poll. Only count/warn when the writer actually has the snapshot - a permanent
1953-
// miss (bogus or pruned snapshot id) is a real error, not replica lag.
1950+
// Replica lag: the runner learned this snapshot id from the writer before the
1951+
// replica caught up. Serve from the writer; only count/warn if the writer has it
1952+
// (a permanent miss is a real error, not lag).
19541953
try {
19551954
const result = await query(this.prisma);
19561955
this.snapshotsSinceReplicaMissCounter.add(1);

internal-packages/run-engine/src/engine/tests/getSnapshotsSince.test.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -889,7 +889,6 @@ describe("RunEngine getSnapshotsSince", () => {
889889
expect(result!.length).toBe(expectedSnapshots.length);
890890
expect(result!.map((s) => s.snapshot.id)).toEqual(expectedSnapshots.map((s) => s.id));
891891

892-
// The fallback fired exactly once - this counter is the prod rollout signal.
893892
expect(await getCounterValue("run_engine.snapshots_since.replica_miss")).toBe(1);
894893
} finally {
895894
await engine.quit();
@@ -1053,7 +1052,6 @@ describe("RunEngine getSnapshotsSince", () => {
10531052
expect(result!.map((s) => s.snapshot.id)).not.toContain(tail.id);
10541053
expect(result!.map((s) => s.snapshot.id)).toEqual(expectedSnapshots.map((s) => s.id));
10551054

1056-
// The since snapshot was on the replica - no fallback fired.
10571055
expect(await getCounterValue("run_engine.snapshots_since.replica_miss")).toBe(0);
10581056
} finally {
10591057
await engine.quit();
@@ -1151,7 +1149,6 @@ describe("RunEngine getSnapshotsSince", () => {
11511149
expect(expectedSnapshots.length).toBeGreaterThan(0);
11521150
expect(result!.map((s) => s.snapshot.id)).toEqual(expectedSnapshots.map((s) => s.id));
11531151

1154-
// No replica read attempted, so no fallback could have fired.
11551152
expect(await getCounterValue("run_engine.snapshots_since.replica_miss")).toBe(0);
11561153
} finally {
11571154
await engine.quit();
@@ -1251,7 +1248,6 @@ describe("RunEngine getSnapshotsSince", () => {
12511248
expect(expectedSnapshots.length).toBeGreaterThan(0);
12521249
expect(result!.map((s) => s.snapshot.id)).toEqual(expectedSnapshots.map((s) => s.id));
12531250

1254-
// The tx served the read directly - the fallback path never ran.
12551251
expect(await getCounterValue("run_engine.snapshots_since.replica_miss")).toBe(0);
12561252
} finally {
12571253
await engine.quit();

0 commit comments

Comments
 (0)