Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): filter pending items before fetching history payloads #23926

Closedazogz(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/23926/headopened View on GitHub

Showing 5 changed files with 117 additions and 0 deletions (loading 2).

x
0 of 5 viewed, 5 left
77 additions and 0 deletionsapps/server/src/orchestration-v2/ProjectionStore.test.tsModified
View file
@@ -2374,6 +2374,83 @@
+ it.effect("filters pending turn items from the ordering index before reading payloads", () =>
+ Effect.gen(function* () {
+ const store = yield* ProjectionStore.ProjectionStoreV2;
+ const sql = yield* SqlClient.SqlClient;
+ const threadId = yield* addRolledBackRecoveryCandidate("pending-status-index");
+ const initial = (yield* store.getThreadProjection(threadId)).turnItems[0]!;
+ const statuses = [
+ "completed",
+ "waiting",
+ "pending",
+ "failed",
+ "running",
+ "cancelled",
+ ] as const;
+ for (const [index, status] of statuses.entries()) {
+ yield* store.apply({
+ id: EventId.make(`event:pending-status-index:${index}`),
+ type: "turn-item.updated",
+ threadId,
+ occurredAt: initial.updatedAt,
+ payload: {
+ ...initial,
+ id: TurnItemId.make(`item:pending-status-index:${index}`),
+ ordinal: 2 + Math.floor(index / 2),
+ status,
+ },