Skip to content

Commit 4e63af3

Browse files
d-csclaude
andcommitted
fix(run-engine): mark replica-retry failures in logs, narrow release note, trim dead test setup
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 4825e1d commit 4e63af3

3 files changed

Lines changed: 5 additions & 29 deletions

File tree

.server-changes/snapshots-since-replica-primary-fallback.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ type: improvement
44
---
55

66
Run snapshot polling no longer errors or pays extra latency when the database read replica
7-
briefly lags behind the primary (`RUN_ENGINE_READ_REPLICA_SNAPSHOTS_SINCE_ENABLED`): the read
8-
is served from the primary instead.
7+
hasn't yet replicated the snapshot the runner is polling from
8+
(`RUN_ENGINE_READ_REPLICA_SNAPSHOTS_SINCE_ENABLED`): the read is served from the primary instead.

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1964,6 +1964,7 @@ export class RunEngine {
19641964
message: retryError instanceof Error ? retryError.message : retryError,
19651965
runId,
19661966
snapshotId,
1967+
retriedFromReplica: true,
19671968
});
19681969
return null;
19691970
}

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

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -789,7 +789,6 @@ describe("RunEngine getSnapshotsSince", () => {
789789
containerTest(
790790
"returns null when the snapshot is missing on both replica and primary",
791791
async ({ prisma, schemaOnlyPrisma, redisOptions }) => {
792-
const authenticatedEnvironment = await setupAuthenticatedEnvironment(prisma, "PRODUCTION");
793792
const { meter, getCounterValue } = createTestMetricsMeter();
794793

795794
const engine = new RunEngine({
@@ -825,33 +824,9 @@ describe("RunEngine getSnapshotsSince", () => {
825824
});
826825

827826
try {
828-
const taskIdentifier = "test-task";
829-
await setupBackgroundWorker(engine, authenticatedEnvironment, taskIdentifier);
830-
831-
const runFriendlyId = generateFriendlyId("run");
832-
const run = await engine.trigger(
833-
{
834-
number: 1,
835-
friendlyId: runFriendlyId,
836-
environment: authenticatedEnvironment,
837-
taskIdentifier,
838-
payload: "{}",
839-
payloadType: "application/json",
840-
context: {},
841-
traceContext: {},
842-
traceId: "t_replica_both_miss",
843-
spanId: "s_replica_both_miss",
844-
workerQueue: "main",
845-
queue: "task/test-task",
846-
isTest: false,
847-
tags: [],
848-
},
849-
prisma
850-
);
851-
852-
// A snapshot id that exists nowhere - a genuine miss stays an error (null).
827+
// runId is never consulted - the since-snapshot lookup throws on the bogus id first.
853828
const result = await engine.getSnapshotsSince({
854-
runId: run.id,
829+
runId: "run_does_not_exist",
855830
snapshotId: "snapshot_does_not_exist",
856831
});
857832

0 commit comments

Comments
 (0)