Skip to content
Source
Sign inSign up
pingdotgg/t3code

perf(server): t3_thread_list reads only the listed project's threads #17843

Mergedonly21mil(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/17843/headmerged by Yash-Singh1(GitHub profile, opens in a new tab) View on GitHub

Showing 3 changed files with 180 additions and 0 deletions (loading 2).

x
0 of 3 viewed, 3 left
180 additions and 0 deletionsapps/server/src/orchestration-v2/ProjectionStore.test.tsModified
View file
@@ -349,6 +349,157 @@
}).pipe(Effect.provide(ProjectionStore.layerMemory)),
​
+// Project A holds an active thread, an archived thread and a fork of a run in
+// an archived project B thread, so a project-scoped snapshot still has to load
+// a fork source that is outside the project and archived.
+const assertProjectScopedShells = Effect.fn("assertProjectScopedShells")(function* (
+ suffix: string,
+) {
+ const projectionStore = yield* ProjectionStore.ProjectionStoreV2;
+ const now = yield* DateTime.now;
+ const projectId = ProjectId.make(`project:${suffix}:a`);
+ const otherProjectId = ProjectId.make(`project:${suffix}:b`);
+ const activeThreadId = ThreadId.make(`thread:${suffix}:a-active`);
+ const archivedThreadId = ThreadId.make(`thread:${suffix}:a-archived`);
+ const forkThreadId = ThreadId.make(`thread:${suffix}:a-fork`);
+ const sourceThreadId = ThreadId.make(`thread:${suffix}:b-source`);
+ const otherThreadId = ThreadId.make(`thread:${suffix}:b-other`);
+ const sourceRunId = RunId.make(`run:${suffix}:b-source`);
+ const sourceNodeId = NodeId.make(`node:${suffix}:b-source`);
+ const createThread = (input: {
+ readonly threadId: ThreadId;
+ readonly projectId: ProjectId;
+ readonly archived?: boolean;
+ readonly forkedFromRunOf?: ThreadId;
+ }) =>
+ projectionStore.apply({
+ id: EventId.make(`event:${input.threadId}:created`),
+ type: "thread.created",