* fix(projects): restore cross-host grouping Random host-local project IDs replaced the remote-derived value that had also served as grouping identity. Persist a separate opaque group key and let normal boot reconciliation backfill older records without a migration. * fix(projects): keep ambiguous clones separate A shared remote can identify a project across hosts, but it cannot distinguish two independent clones on one host. Treat those keys as ambiguous so host-local project IDs remain separate. * fix(projects): preserve host-local project identity * fix(projects): strengthen grouping identity * test(app): update project host shape contract * fix(projects): preserve selected host identity * fix(projects): close grouped routing gaps * fix(projects): stabilize legacy subproject grouping * fix(projects): preserve selected project identity * fix(projects): isolate legacy host identity * fix(projects): preserve symlinked bootstrap roots * fix(projects): reconcile grouped custom names * fix(projects): stabilize settings and path identity * fix(projects): normalize default remote ports * fix(projects): harden host and remote identity * fix(projects): preserve host-scoped actions * fix(projects): preserve remote path semantics * fix(projects): model SCP remote semantics * fix(projects): keep settings on routed host * fix(projects): preserve SSH URL path semantics * fix(projects): separate identity from presentation * test(projects): use grouped identity in UI specs * fix(projects): harden grouped project routing * test(projects): expect framed settings route * fix(projects): preserve exact placement identity * fix(projects): harden grouping identity and routing * fix(projects): restore project key as grouping identity Random host-local project IDs had replaced the persisted cross-host value carried by projectKey. Keep projectId for routing while reconciliation owns and persists projectKey for grouping. * fix(projects): prevent project key collisions Preserve platform path semantics and generic remote transports in cross-host keys, and compare legacy checkout roots using filesystem equivalence before materializing ownership. * test(projects): assert host-scoped project keys * fix(projects): preserve project key compatibility Resolve legacy workspace project references at the daemon boundary while keeping projectKey as the cross-host identity. Complete generic SSH normalization without collapsing distinct repositories. * fix(projects): harden project reference identity * fix(projects): retain archived reference errors * fix(projects): scope legacy paths to hosts * test(app): model persisted project keys * fix(projects): retain absolute scp users * fix(projects): resolve legacy mutation aliases * fix(projects): preserve conservative identity boundaries * fix(projects): preserve legacy placement identity * test(projects): assert legacy placement identity * test(projects): expect canonical Windows keys * fix(projects): separate bootstrap identity fields * fix(projects): scope legacy paths by host * fix(projects): stabilize opaque project identity * fix(projects): preserve remaining opaque identities * fix(projects): classify forward-slash UNC roots * fix(projects): preserve opaque selection keys * fix(projects): frame host-local project keys * fix(projects): canonicalize framed identities * test(projects): isolate repeated remote fixtures * fix(projects): keep project key as UI identity * fix(projects): reconcile hydrated project references * fix(projects): preserve archived project identity * refactor(projects): group projects from project records, not workspaces Cross-host grouping had been built by hanging a projectKey off every workspace descriptor. That scoped the key to the wrong entity: the app then had to reconstruct project identity per workspace in six modules, which forced projectKey fallbacks into RPC arguments and a server-side resolver that turned grouping keys back into project ids. A workspace has a projectId. The key belongs to the project, and grouping is a display concern, so the daemon now publishes projects over project.list plus the existing project.update channel and the app groups them in one place. Projects are addressed by host-local projectId everywhere, including the settings route. Projects persisted without a key are backfilled by ordinary boot reconciliation, with no migration. Old daemons advertise no projectList capability and simply do not group. * test(projects): seed projects alongside workspaces in fixtures Sidebar fixtures seeded workspaces without their projects, which the daemon cannot produce now that projects arrive on their own channel, so nothing rendered. Adds a seeding helper that supplies both. Also drops the provisioning test for accepting a project key where a project id belongs; that resolver was removed deliberately. * fix(projects): keep derived project identity stable Four gaps left by shrinking the key derivation: Local keys used a bare path resolve, so one directory reached by a different spelling produced a different key and reset grouped identity. Windows CI caught this with the 8.3 and long-name forms of one temp path. Canonicalize through the shared realpath-aware normalization. Subproject display names lost their selected-path input, so every subproject of a monorepo rendered under the same remote-derived name. Reconciliation only ever backfilled a missing key, so a project whose remote changed stayed grouped with hosts on the old remote. Project settings kept a disconnected host selected and rendered a dead end with no way back to an editable host. * fix(projects): read scheme remotes as URLs, not scp form An `ssh://user@host:22/org/repo` remote matched the scp-form pattern first, because `[^@]+` happily eats `ssh://git`, so the port landed in the path and the project keyed as `remote:host/22/org/repo`. Two spellings of one remote therefore never grouped. Try scp form only when there is no scheme, and drop protocol-default ports so an explicitly written `:22` matches the same remote without it.
269 lines
10 KiB
TypeScript
269 lines
10 KiB
TypeScript
import { expect, test } from "./fixtures";
|
|
import { gotoAppShell } from "./helpers/app";
|
|
import {
|
|
connectNewWorkspaceDaemonClient,
|
|
expectNewWorkspaceProjectSelected,
|
|
openGlobalNewWorkspaceComposer,
|
|
openNewWorkspaceComposer,
|
|
openNewWorkspaceProjectPickerWithShortcut,
|
|
} from "./helpers/new-workspace";
|
|
import { getE2EDaemonPort } from "./helpers/daemon-port";
|
|
import { seedWorkspace, type SeededWorkspace } from "./helpers/seed-client";
|
|
import { seedSavedSettingsHosts } from "./helpers/settings";
|
|
import { getServerId } from "./helpers/server-id";
|
|
import { clickArchiveWorkspaceMenuItem, expectWorkspaceAbsentFromSidebar } from "./helpers/sidebar";
|
|
import { waitForSidebarHydration } from "./helpers/workspace-ui";
|
|
|
|
// Model B entry points into the New Workspace screen. The surviving entries are
|
|
// the global button (universal) and each project's per-row New workspace icon
|
|
// (preselects that project) — shown for git projects and for non-git projects on
|
|
// a multiplicity-capable host. These specs prove the global entry opens the
|
|
// screen, the project icon preselects the right project across the reused 'new'
|
|
// screen, and non-git projects never offer the worktree Isolation control.
|
|
|
|
function projectRow(page: import("@playwright/test").Page, projectKey: string) {
|
|
return page.getByTestId(`sidebar-project-row-${projectKey}`);
|
|
}
|
|
|
|
test.describe("New workspace entry points", () => {
|
|
let client: Awaited<ReturnType<typeof connectNewWorkspaceDaemonClient>>;
|
|
|
|
test.describe.configure({ timeout: 240_000 });
|
|
|
|
test.beforeEach(async () => {
|
|
client = await connectNewWorkspaceDaemonClient();
|
|
});
|
|
|
|
test.afterEach(async () => {
|
|
await client?.close().catch(() => undefined);
|
|
});
|
|
|
|
test("the global new-workspace button opens the New Workspace screen", async ({ page }) => {
|
|
const seeded: SeededWorkspace = await seedWorkspace({ repoPrefix: "entry-global-button-" });
|
|
|
|
try {
|
|
await seedSavedSettingsHosts(page, [
|
|
{
|
|
serverId: getServerId(),
|
|
label: "localhost",
|
|
endpoint: `127.0.0.1:${getE2EDaemonPort()}`,
|
|
},
|
|
{
|
|
serverId: "secondary-new-workspace-host",
|
|
label: "Secondary host",
|
|
endpoint: "127.0.0.1:9",
|
|
},
|
|
]);
|
|
|
|
await gotoAppShell(page);
|
|
await waitForSidebarHydration(page);
|
|
await expect(
|
|
page.getByTestId(`sidebar-workspace-row-${getServerId()}:${seeded.workspaceId}`),
|
|
).toBeVisible({ timeout: 30_000 });
|
|
|
|
const globalButton = page.getByTestId("sidebar-global-new-workspace");
|
|
await expect(globalButton).toBeVisible({ timeout: 30_000 });
|
|
|
|
await openGlobalNewWorkspaceComposer(page);
|
|
await expect(page.getByTestId("host-chooser")).toHaveCount(0);
|
|
|
|
await expect(page.getByTestId("new-workspace-project-picker-trigger")).toBeVisible({
|
|
timeout: 30_000,
|
|
});
|
|
await expect(page.getByTestId("host-picker-trigger")).toBeVisible({ timeout: 30_000 });
|
|
} finally {
|
|
await seeded.cleanup();
|
|
}
|
|
});
|
|
|
|
test("the New Workspace screen hides the host selector when there is only one host", async ({
|
|
page,
|
|
}) => {
|
|
const seeded: SeededWorkspace = await seedWorkspace({ repoPrefix: "entry-single-host-" });
|
|
|
|
try {
|
|
await seedSavedSettingsHosts(page, [
|
|
{
|
|
serverId: getServerId(),
|
|
label: "localhost",
|
|
endpoint: `127.0.0.1:${getE2EDaemonPort()}`,
|
|
},
|
|
]);
|
|
|
|
await gotoAppShell(page);
|
|
await waitForSidebarHydration(page);
|
|
await expect(
|
|
page.getByTestId(`sidebar-workspace-row-${getServerId()}:${seeded.workspaceId}`),
|
|
).toBeVisible({ timeout: 30_000 });
|
|
|
|
await openGlobalNewWorkspaceComposer(page);
|
|
|
|
await expect(page.getByTestId("new-workspace-project-picker-trigger")).toBeVisible({
|
|
timeout: 30_000,
|
|
});
|
|
await expect(page.getByTestId("host-picker-trigger")).toHaveCount(0);
|
|
} finally {
|
|
await seeded.cleanup();
|
|
}
|
|
});
|
|
|
|
test("Ctrl+P opens the project picker with search focused", async ({ page }) => {
|
|
const seeded: SeededWorkspace = await seedWorkspace({ repoPrefix: "entry-shortcut-" });
|
|
|
|
try {
|
|
await gotoAppShell(page);
|
|
await waitForSidebarHydration(page);
|
|
await openGlobalNewWorkspaceComposer(page);
|
|
|
|
await openNewWorkspaceProjectPickerWithShortcut(page);
|
|
} finally {
|
|
await seeded.cleanup();
|
|
}
|
|
});
|
|
|
|
test("keeps the in-progress form when the remembered workspace is archived elsewhere", async ({
|
|
page,
|
|
}) => {
|
|
const otherProject: SeededWorkspace = await seedWorkspace({
|
|
repoPrefix: "aa-new-workspace-archive-other-",
|
|
});
|
|
const rememberedProject: SeededWorkspace = await seedWorkspace({
|
|
repoPrefix: "zz-new-workspace-archive-remembered-",
|
|
});
|
|
const serverId = getServerId();
|
|
const draftText = "keep this new workspace draft";
|
|
|
|
try {
|
|
await seedSavedSettingsHosts(page, [
|
|
{
|
|
serverId,
|
|
label: "localhost",
|
|
endpoint: `127.0.0.1:${getE2EDaemonPort()}`,
|
|
},
|
|
]);
|
|
|
|
await gotoAppShell(page);
|
|
await waitForSidebarHydration(page);
|
|
await page
|
|
.getByTestId(`sidebar-workspace-row-${serverId}:${rememberedProject.workspaceId}`)
|
|
.click();
|
|
await expect(page).toHaveURL(/\/workspace\//, { timeout: 30_000 });
|
|
|
|
await page.goto(`/new?serverId=${encodeURIComponent(serverId)}`);
|
|
await expectNewWorkspaceProjectSelected(page, rememberedProject.projectDisplayName);
|
|
|
|
const composer = page.getByRole("textbox", { name: "Message agent..." });
|
|
await expect(composer).toBeEditable({ timeout: 30_000 });
|
|
await composer.fill(draftText);
|
|
await expect(composer).toHaveValue(draftText);
|
|
|
|
await clickArchiveWorkspaceMenuItem(page, rememberedProject.workspaceId);
|
|
await expectWorkspaceAbsentFromSidebar(page, rememberedProject.workspaceId);
|
|
|
|
await expect(page).toHaveURL(/\/new(?:\?.*)?$/, { timeout: 30_000 });
|
|
await expect(composer).toHaveValue(draftText);
|
|
await expectNewWorkspaceProjectSelected(page, rememberedProject.projectDisplayName);
|
|
} finally {
|
|
await otherProject.cleanup();
|
|
await rememberedProject.cleanup();
|
|
}
|
|
});
|
|
|
|
test("each project's row icon preselects that project, and the reused screen resets a stale manual choice across projects", async ({
|
|
page,
|
|
}) => {
|
|
const projectA: SeededWorkspace = await seedWorkspace({ repoPrefix: "entry-preselect-a-" });
|
|
const projectB: SeededWorkspace = await seedWorkspace({ repoPrefix: "entry-preselect-b-" });
|
|
const projectC: SeededWorkspace = await seedWorkspace({ repoPrefix: "entry-preselect-c-" });
|
|
|
|
try {
|
|
await gotoAppShell(page);
|
|
await waitForSidebarHydration(page);
|
|
await expect(projectRow(page, projectA.projectKey)).toBeVisible({ timeout: 30_000 });
|
|
await expect(projectRow(page, projectB.projectKey)).toBeVisible({ timeout: 30_000 });
|
|
await expect(projectRow(page, projectC.projectKey)).toBeVisible({ timeout: 30_000 });
|
|
|
|
// Project A's row icon opens New Workspace with A preselected.
|
|
await openNewWorkspaceComposer(page, {
|
|
projectKey: projectA.projectKey,
|
|
projectDisplayName: projectA.projectDisplayName,
|
|
});
|
|
await expectNewWorkspaceProjectSelected(page, projectA.projectDisplayName);
|
|
|
|
// Manually override the selection to C from inside A's screen. This stale
|
|
// manualProjectKey is what the reused 'new' screen must reset when the next
|
|
// route-driven navigation targets a different project.
|
|
await page.getByTestId("new-workspace-project-picker-trigger").click();
|
|
const optionC = page.getByTestId(
|
|
`new-workspace-project-picker-option-${projectC.projectKey}`,
|
|
);
|
|
await expect(optionC).toBeVisible({ timeout: 30_000 });
|
|
await optionC.click();
|
|
await expectNewWorkspaceProjectSelected(page, projectC.projectDisplayName);
|
|
|
|
// Navigate via B's row icon. B must be preselected — the route project wins
|
|
// because the stale manual choice (C) was reset on the route change. If the
|
|
// reset were missing, the trigger would still read C.
|
|
await openNewWorkspaceComposer(page, {
|
|
projectKey: projectB.projectKey,
|
|
projectDisplayName: projectB.projectDisplayName,
|
|
});
|
|
await expectNewWorkspaceProjectSelected(page, projectB.projectDisplayName);
|
|
} finally {
|
|
await projectA.cleanup();
|
|
await projectB.cleanup();
|
|
await projectC.cleanup();
|
|
}
|
|
});
|
|
|
|
test("the Isolation control is hidden for a non-git project and shown for a git project", async ({
|
|
page,
|
|
}) => {
|
|
const gitProject: SeededWorkspace = await seedWorkspace({ repoPrefix: "entry-iso-git-" });
|
|
const nonGitProject: SeededWorkspace = await seedWorkspace({
|
|
repoPrefix: "entry-iso-nongit-",
|
|
git: false,
|
|
});
|
|
|
|
try {
|
|
await gotoAppShell(page);
|
|
await waitForSidebarHydration(page);
|
|
await expect(projectRow(page, gitProject.projectKey)).toBeVisible({ timeout: 30_000 });
|
|
await expect(projectRow(page, nonGitProject.projectKey)).toBeVisible({ timeout: 30_000 });
|
|
|
|
// Open New Workspace for the non-git project via the global button, then
|
|
// select it in the picker (the per-row icon would preselect it too).
|
|
await openGlobalNewWorkspaceComposer(page);
|
|
const trigger = page.getByTestId("new-workspace-project-picker-trigger");
|
|
await expect(trigger).toBeVisible({ timeout: 30_000 });
|
|
await trigger.click();
|
|
const nonGitOption = page.getByTestId(
|
|
`new-workspace-project-picker-option-${nonGitProject.projectKey}`,
|
|
);
|
|
await expect(nonGitOption).toBeVisible({ timeout: 30_000 });
|
|
await nonGitOption.click();
|
|
await expectNewWorkspaceProjectSelected(page, nonGitProject.projectDisplayName);
|
|
|
|
// No git checkout means no worktree isolation choice: the Isolation row is
|
|
// absent entirely.
|
|
await expect(page.getByTestId("workspace-create-isolation-trigger")).toHaveCount(0);
|
|
|
|
// Switching to the git project on the same screen reveals the Isolation row.
|
|
await trigger.click();
|
|
const gitOption = page.getByTestId(
|
|
`new-workspace-project-picker-option-${gitProject.projectKey}`,
|
|
);
|
|
await expect(gitOption).toBeVisible({ timeout: 30_000 });
|
|
await gitOption.click();
|
|
await expectNewWorkspaceProjectSelected(page, gitProject.projectDisplayName);
|
|
|
|
await expect(page.getByTestId("workspace-create-isolation-trigger")).toBeVisible({
|
|
timeout: 30_000,
|
|
});
|
|
} finally {
|
|
await gitProject.cleanup();
|
|
await nonGitProject.cleanup();
|
|
}
|
|
});
|
|
});
|