Skip to content

Commit dfd163f

Browse files
committed
test(server): preserve worktrees when thread paths cannot resolve
1 parent 19b891e commit dfd163f

1 file changed

Lines changed: 22 additions & 4 deletions

File tree

‎apps/server/src/storageCleanup.test.ts‎

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,8 @@ describe("settled worktree retention", () => {
154154
"updated",
155155
"shared",
156156
"shared-alias",
157+
"shared-alias-cycle",
158+
"archived-shared-alias-cycle",
157159
"shared-alias-late",
158160
"session-alias",
159161
"session-alias-descendant",
@@ -233,17 +235,29 @@ describe("settled worktree retention", () => {
233235
)
234236
`;
235237
}
236-
if (["shared", "shared-alias", "deleted-shared-alias"].includes(protection)) {
238+
if (
239+
[
240+
"shared",
241+
"shared-alias",
242+
"shared-alias-cycle",
243+
"archived-shared-alias-cycle",
244+
"deleted-shared-alias",
245+
].includes(protection)
246+
) {
237247
yield* store.apply({
238248
...event("thread.created"),
239249
id: EventId.make("shared"),
240250
threadId: ThreadId.make("shared"),
241251
payload: {
242252
...thread,
243253
id: ThreadId.make("shared"),
244-
worktreePath: protection === "shared-alias" ? worktreeAlias : worktreePath,
254+
worktreePath: protection.endsWith("-cycle")
255+
? activityAlias
256+
: protection === "shared-alias"
257+
? worktreeAlias
258+
: worktreePath,
245259
deletedAt: null,
246-
archivedAt: at(0),
260+
archivedAt: protection === "shared-alias-cycle" ? null : at(0),
247261
settledOverride: "active",
248262
},
249263
});
@@ -525,7 +539,11 @@ describe("settled worktree retention", () => {
525539
message.includes("storage cleanup could not resolve provider session workspace"),
526540
),
527541
);
528-
if (protection === "terminal-alias-cycle")
542+
if (
543+
["terminal-alias-cycle", "shared-alias-cycle", "archived-shared-alias-cycle"].includes(
544+
protection,
545+
)
546+
)
529547
assert.isTrue(warnings.some((message) => message.includes("worktree cleanup failed")));
530548
if (["wait", "auto-recent", "active", "pinned-active"].includes(protection))
531549
assert.strictEqual(headReads, 0);

0 commit comments

Comments
 (0)