Show New Workspace isolation controls immediately (#2702)
* fix(workspaces): show isolation without checkout delay * fix(workspaces): trust hydrated project capability * fix(workspaces): resolve branch before creation * fix(workspaces): honor invalidated checkout status * fix(workspaces): preserve isolation while projects load * fix(workspaces): keep provisional project routes usable Route-derived projects do not know their worktree capability. Represent that uncertainty at the placement boundary so remembered worktree intent survives hydration without disabling the New Workspace screen indefinitely.
This commit is contained in:
@@ -4,6 +4,7 @@ import {
|
||||
canCreateWorkspaceForHostProject,
|
||||
getHostProjectId,
|
||||
getHostProjectSourceDirectory,
|
||||
getWorktreeSupportForHostProject,
|
||||
hostProjectFromRoute,
|
||||
} from "./host-project-model";
|
||||
|
||||
@@ -19,13 +20,13 @@ function project(): HostProjectListItem {
|
||||
serverId: "host-a",
|
||||
projectId: "prj_a",
|
||||
iconWorkingDir: "/repo/a",
|
||||
canCreateWorktree: true,
|
||||
worktreeSupport: "supported" as const,
|
||||
},
|
||||
{
|
||||
serverId: "host-b",
|
||||
projectId: "prj_b",
|
||||
iconWorkingDir: "/repo/b",
|
||||
canCreateWorktree: true,
|
||||
worktreeSupport: "supported" as const,
|
||||
},
|
||||
],
|
||||
workspaceKeys: [],
|
||||
@@ -49,6 +50,38 @@ describe("host project lookups", () => {
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
test("checks worktree capability against the selected host placement", () => {
|
||||
const groupedProject = project();
|
||||
groupedProject.hosts[1] = {
|
||||
...groupedProject.hosts[1]!,
|
||||
worktreeSupport: "unsupported" as const,
|
||||
};
|
||||
|
||||
expect(getWorktreeSupportForHostProject({ project: groupedProject, serverId: "host-a" })).toBe(
|
||||
"supported",
|
||||
);
|
||||
expect(getWorktreeSupportForHostProject({ project: groupedProject, serverId: "host-b" })).toBe(
|
||||
"unsupported",
|
||||
);
|
||||
expect(getWorktreeSupportForHostProject({ project: groupedProject, serverId: "missing" })).toBe(
|
||||
"unknown",
|
||||
);
|
||||
});
|
||||
|
||||
test("marks route placeholder worktree support as unknown", () => {
|
||||
const routeProject = hostProjectFromRoute({
|
||||
serverId: "host-a",
|
||||
projectId: "prj_a",
|
||||
displayName: "App",
|
||||
sourceDirectory: "/repo/a",
|
||||
});
|
||||
expect(routeProject).not.toBeNull();
|
||||
expect(routeProject!.projectKind).toBe("unknown");
|
||||
expect(getWorktreeSupportForHostProject({ project: routeProject!, serverId: "host-a" })).toBe(
|
||||
"unknown",
|
||||
);
|
||||
});
|
||||
|
||||
test("builds an unhydrated route project around the routed project id", () => {
|
||||
expect(
|
||||
hostProjectFromRoute({
|
||||
|
||||
Reference in New Issue
Block a user