Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): threads follow their worktree's branch changes #31599

MergedYash-Singh1(GitHub profile, opens in a new tab)merged 5 commits intomain fromrefs/pull/31599/headmerged by Yash-Singh1(GitHub profile, opens in a new tab) View on GitHub

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

x
0 of 5 viewed, 5 left
111 additions and 0 deletionsapps/server/src/orchestration-v2/WorktreeBranchSync.test.tsAdded
View file
@@ -0,0 +1,111 @@
+import { assert, it } from "@effect/vitest";
+import {
+ ThreadId,
+ type OrchestrationV2ThreadShell,
+ type OrchestrationV2ServerCommand,
+} from "@t3tools/contracts";
+import * as Deferred from "effect/Deferred";
+import * as Stream from "effect/Stream";
+import * as Effect from "effect/Effect";
+import * as FileSystem from "effect/FileSystem";
+import * as Layer from "effect/Layer";
+​
+import * as GitWorkflowService from "../git/GitWorkflowService.ts";
+import * as VcsStatusBroadcaster from "../vcs/VcsStatusBroadcaster.ts";
+import * as ProjectionStore from "./ProjectionStore.ts";
+import * as Orchestrator from "./Orchestrator.ts";
+import * as ThreadManagement from "./ThreadManagementService.ts";
+import * as WorktreeBranchSync from "./WorktreeBranchSync.ts";
+​
+it.effect.each([false, true])(
+ "reconciles shared worktree branches without changing root checkouts or detached HEADs, conflict=%s",
+ (conflict) => {
+ const reconciled = Deferred.makeUnsafe<void>();
+ const commands: OrchestrationV2ServerCommand[] = [];
+ const thread = (id: string, branch: string, worktreePath: string | null) =>
+ ({ id: ThreadId.make(id), branch, worktreePath }) as OrchestrationV2ThreadShell;
+ const snapshot = {
+ schemaVersion: 2,
+ snapshotSequence: 0,
+ threads: [