Skip to content
Source
Sign inSign up
pingdotgg/t3code

perf(server): drive shell last-error lookup from thread bindings #17842

Mergedonly21mil(GitHub profile, opens in a new tab)merged 2 commits intomain fromrefs/pull/17842/headmerged by t3dotgg(GitHub profile, opens in a new tab) View on GitHub

Showing 2 changed files with 182 additions and 6 deletions.

x
0 of 2 viewed, 2 left
174 additions and 0 deletionsapps/server/src/orchestration-v2/ProjectionStore.test.tsModified
View file
@@ -2914,6 +2914,180 @@
+ it.effect("looks up a thread's last provider error through its own session bindings", () =>
+ Effect.gen(function* () {
+ const projectionStore = yield* ProjectionStore.ProjectionStoreV2;
+ const sql = yield* SqlClient.SqlClient;
+ const now = yield* DateTime.now;
+ const later = DateTime.add(now, { minutes: 1 });
+ const projectId = ProjectId.make("project:projection-session-error-lookup");
+ const attachErroredSession = Effect.fnUntraced(function* (
+ name: string,
+ lastError: string,
+ updatedAt: DateTime.Utc,
+ ) {
+ const threadId = ThreadId.make(`thread:projection-session-error-lookup:${name}`);
+ yield* projectionStore.apply({
+ id: EventId.make(`event:projection-session-error-lookup:${name}:thread`),
+ type: "thread.created",
+ threadId,
+ occurredAt: now,
+ payload: {
+ createdBy: "user",
+ creationSource: "web",
+ id: threadId,
+ projectId,
+ title: name,
+ providerInstanceId,
+ modelSelection,