Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): storage cleanup builds shells only for threads with a worktree on disk #38908

Openjuliusmarmingewants to merge 3 commits intomain fromrefs/pull/38908/headopened View on GitHub

Showing 5 changed files with 25 additions and 0 deletions (loading 4).

x
0 of 5 viewed, 5 left
25 additions and 0 deletionsapps/server/src/orchestration-v2/ProjectionStore.test.tsModified
View file
@@ -144,6 +144,31 @@
assert.isFalse(statements.some((statement) => /COUNT\(\*\)|GROUP BY/i.test(statement)));
​
+ const cleanupStatementsFrom = statements.length;
+ const cleanupThreads = yield* store.getStorageCleanupThreads().pipe(Effect.withTracer(tracer));
+ const omitted = new Set([
+ "itemCount",
+ "visibleItemCount",
+ "latestRunStopRequested",
+ "latestRunBackgroundWake",
+ "activityRunStatus",
+ "activityRunStartedAt",
+ "hasActionableProposedPlan",
+ ]);
+ const byId = <T extends { readonly id: string }>(threads: ReadonlyArray<T>) =>
+ threads.toSorted((left, right) => (left.id < right.id ? -1 : left.id > right.id ? 1 : 0));
+ assert.deepEqual(
+ byId(cleanupThreads),
+ byId([...shells, ...snapshot.archivedThreads]).map((shell) =>
+ Object.fromEntries(Object.entries(shell).filter(([key]) => !omitted.has(key))),
+ ),
+ );
+ assert.isFalse(
+ statements
+ .slice(cleanupStatementsFrom)
+ .some((statement) => /COUNT\(\*\)|GROUP BY|projection_plans/i.test(statement)),
+ );
+​
const iso = (value: DateTime.Utc | null | undefined) =>