* 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.
321 lines
11 KiB
TypeScript
321 lines
11 KiB
TypeScript
import { expect, test } from "./fixtures";
|
|
import { clickNewChat } from "./helpers/launcher";
|
|
import { expectComposerVisible } from "./helpers/composer";
|
|
import { expectAgentIdle } from "./helpers/agent-stream";
|
|
import {
|
|
openAttachmentMenu,
|
|
openGithubPickerFromMenu,
|
|
attachImageFromMenu,
|
|
expectAttachmentPill,
|
|
removeAttachmentPill,
|
|
openImageLightbox,
|
|
closeImageLightbox,
|
|
pressInterruptShortcut,
|
|
expectComposerDraft,
|
|
expectComposerDisabled,
|
|
expectComposerEditable,
|
|
expectAttachButtonDisabled,
|
|
fillComposerDraft,
|
|
dropFileOnComposer,
|
|
sendDraftToQueue,
|
|
expectQueuedMessageButton,
|
|
startRunningMockAgent,
|
|
selectGithubOption,
|
|
expectGithubAttachmentPill,
|
|
openGithubWorkspace,
|
|
} from "./helpers/composer";
|
|
import { delayBrowserAgentCreatedStatus, openNewWorkspaceComposer } from "./helpers/new-workspace";
|
|
import { gotoAppShell } from "./helpers/app";
|
|
import { waitForSidebarHydration, switchWorkspaceViaSidebar } from "./helpers/workspace-ui";
|
|
import { seedWorkspace } from "./helpers/seed-client";
|
|
import { hasGithubAuth, createTempGithubRepo } from "./helpers/github-fixtures";
|
|
import { getServerId } from "./helpers/server-id";
|
|
|
|
const MINIMAL_PNG = Buffer.from(
|
|
"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==",
|
|
"base64",
|
|
);
|
|
|
|
const TEST_IMAGE = { name: "test.png", mimeType: "image/png", buffer: MINIMAL_PNG };
|
|
const TEST_JSON = {
|
|
name: "config.json",
|
|
mimeType: "application/json",
|
|
buffer: Buffer.from(JSON.stringify({ composer: "drop" })),
|
|
};
|
|
|
|
test.describe("Composer attachments", () => {
|
|
test("Plus menu shows image and GitHub options", async ({ page, withWorkspace }) => {
|
|
test.setTimeout(60_000);
|
|
const workspace = await withWorkspace({ prefix: "attach-plus-" });
|
|
await workspace.navigateTo();
|
|
await clickNewChat(page);
|
|
await expectComposerVisible(page);
|
|
|
|
await openAttachmentMenu(page);
|
|
|
|
await expect(page.getByTestId("message-input-attachment-menu-item-image")).toBeVisible();
|
|
await expect(page.getByTestId("message-input-attachment-menu-item-github")).toBeVisible();
|
|
});
|
|
|
|
test("GitHub combobox does not render until the picker is opened", async ({
|
|
page,
|
|
withWorkspace,
|
|
}) => {
|
|
test.setTimeout(60_000);
|
|
const workspace = await withWorkspace({ prefix: "attach-gh-lazy-" });
|
|
await workspace.navigateTo();
|
|
await clickNewChat(page);
|
|
await expectComposerVisible(page);
|
|
|
|
await expect(page.getByTestId("combobox-desktop-container")).not.toBeVisible();
|
|
|
|
await openGithubPickerFromMenu(page);
|
|
|
|
await expect(page.getByPlaceholder("Search issues and PRs...")).toBeVisible({ timeout: 5_000 });
|
|
await expect(
|
|
page.getByTestId("combobox-empty-text").or(page.getByText("Searching...")),
|
|
).toBeVisible({ timeout: 10_000 });
|
|
});
|
|
|
|
test("GitHub issue attachment pill visible after search and selection", async ({ page }) => {
|
|
test.setTimeout(120_000);
|
|
if (!hasGithubAuth()) {
|
|
test.skip(true, "GitHub auth not available in this environment");
|
|
}
|
|
|
|
const ghRepo = await createTempGithubRepo({
|
|
category: "attach-issue",
|
|
issues: [{ title: "fix: attach-issue-unique-alpha" }],
|
|
prs: [{ title: "feat: attach-issue-dummy-pr", state: "open" }],
|
|
});
|
|
const handle = await openGithubWorkspace(page, ghRepo.prs[0].localPath);
|
|
try {
|
|
await clickNewChat(page);
|
|
await expectComposerVisible(page);
|
|
|
|
await selectGithubOption(
|
|
page,
|
|
"attach-issue-unique-alpha",
|
|
`issue:${ghRepo.issues[0].number}`,
|
|
);
|
|
|
|
await expectGithubAttachmentPill(page, {
|
|
number: ghRepo.issues[0].number,
|
|
title: ghRepo.issues[0].title,
|
|
});
|
|
} finally {
|
|
await handle.cleanup();
|
|
await ghRepo.cleanup();
|
|
}
|
|
});
|
|
|
|
test("GitHub PR attachment pill visible after search and selection", async ({ page }) => {
|
|
test.setTimeout(120_000);
|
|
if (!hasGithubAuth()) {
|
|
test.skip(true, "GitHub auth not available in this environment");
|
|
}
|
|
|
|
const ghRepo = await createTempGithubRepo({
|
|
category: "attach-pr",
|
|
prs: [{ title: "feat: attach-pr-unique-beta", state: "open" }],
|
|
});
|
|
const handle = await openGithubWorkspace(page, ghRepo.prs[0].localPath);
|
|
try {
|
|
await clickNewChat(page);
|
|
await expectComposerVisible(page);
|
|
|
|
await selectGithubOption(page, "attach-pr-unique-beta", `pr:${ghRepo.prs[0].number}`);
|
|
|
|
await expectGithubAttachmentPill(page, {
|
|
number: ghRepo.prs[0].number,
|
|
title: ghRepo.prs[0].title,
|
|
});
|
|
} finally {
|
|
await handle.cleanup();
|
|
await ghRepo.cleanup();
|
|
}
|
|
});
|
|
|
|
test.fixme("workspace-review pill suppresses on X-click and reappears after send", async () => {
|
|
// The review attachment is created via InlineReviewEditor in surface.tsx (addComment action).
|
|
// Automating this requires: a workspace with staged changes, navigating to the diff panel,
|
|
// hovering the gutter "+" button, typing a comment, and submitting. A dedicated
|
|
// helpers/review.ts with addInlineReviewComment(page, filePath, lineNumber, comment) is
|
|
// needed before this can be exercised end-to-end.
|
|
});
|
|
|
|
test.fixme("browser-element attachment pill is created from Electron webview selection", async () => {
|
|
// The browser-element attachment is only created in browser-pane.electron.tsx via DOM
|
|
// element selection in the Electron webview. It is not exercisable in headless Chromium E2E.
|
|
});
|
|
|
|
test("image lightbox opens on pill click and closes on Escape", async ({
|
|
page,
|
|
withWorkspace,
|
|
}) => {
|
|
test.setTimeout(60_000);
|
|
const workspace = await withWorkspace({ prefix: "attach-lightbox-" });
|
|
await workspace.navigateTo();
|
|
await clickNewChat(page);
|
|
await expectComposerVisible(page);
|
|
|
|
await attachImageFromMenu(page, TEST_IMAGE);
|
|
await expectAttachmentPill(page, "composer-image-attachment-pill");
|
|
|
|
await openImageLightbox(page);
|
|
await closeImageLightbox(page);
|
|
});
|
|
|
|
test("image attachment pill renders after file is selected", async ({ page, withWorkspace }) => {
|
|
test.setTimeout(60_000);
|
|
const workspace = await withWorkspace({ prefix: "attach-pill-" });
|
|
await workspace.navigateTo();
|
|
await clickNewChat(page);
|
|
await expectComposerVisible(page);
|
|
|
|
await attachImageFromMenu(page, TEST_IMAGE);
|
|
|
|
await expectAttachmentPill(page, "composer-image-attachment-pill");
|
|
});
|
|
|
|
test("dropped JSON file renders as a file attachment in active chat", async ({
|
|
page,
|
|
withWorkspace,
|
|
}) => {
|
|
test.setTimeout(60_000);
|
|
const workspace = await withWorkspace({ prefix: "attach-drop-json-" });
|
|
await workspace.navigateTo();
|
|
await clickNewChat(page);
|
|
await expectComposerVisible(page);
|
|
|
|
await dropFileOnComposer(page, TEST_JSON);
|
|
|
|
await expectAttachmentPill(page, "composer-file-attachment-pill");
|
|
});
|
|
|
|
test("dropped JSON file renders as a file attachment in New Workspace", async ({ page }) => {
|
|
test.setTimeout(120_000);
|
|
const workspace = await seedWorkspace({ repoPrefix: "attach-drop-new-workspace-" });
|
|
|
|
try {
|
|
await gotoAppShell(page);
|
|
await waitForSidebarHydration(page);
|
|
await switchWorkspaceViaSidebar({
|
|
page,
|
|
serverId: getServerId(),
|
|
workspaceId: workspace.workspaceId,
|
|
});
|
|
|
|
await openNewWorkspaceComposer(page, {
|
|
projectKey: workspace.projectKey,
|
|
projectDisplayName: workspace.projectDisplayName,
|
|
});
|
|
|
|
await dropFileOnComposer(page, TEST_JSON);
|
|
|
|
await expectAttachmentPill(page, "composer-file-attachment-pill");
|
|
} finally {
|
|
await workspace.cleanup();
|
|
}
|
|
});
|
|
|
|
test("clicking the X on an image pill removes it", async ({ page, withWorkspace }) => {
|
|
test.setTimeout(60_000);
|
|
const workspace = await withWorkspace({ prefix: "attach-remove-" });
|
|
await workspace.navigateTo();
|
|
await clickNewChat(page);
|
|
await expectComposerVisible(page);
|
|
|
|
await attachImageFromMenu(page, TEST_IMAGE);
|
|
await expectAttachmentPill(page, "composer-image-attachment-pill");
|
|
|
|
await removeAttachmentPill(page, "composer-image-attachment-pill", "Remove image attachment");
|
|
|
|
await expect(page.getByTestId("composer-image-attachment-pill")).toHaveCount(0, {
|
|
timeout: 5_000,
|
|
});
|
|
});
|
|
|
|
test("submitting while agent is running queues the message and clears the draft", async ({
|
|
page,
|
|
}) => {
|
|
test.setTimeout(120_000);
|
|
const agent = await startRunningMockAgent(page, {
|
|
prefix: "attach-queue-",
|
|
model: "one-minute-stream",
|
|
prompt: "Stay running for queue test.",
|
|
});
|
|
try {
|
|
await fillComposerDraft(page, "queued draft text");
|
|
await sendDraftToQueue(page);
|
|
|
|
await expectQueuedMessageButton(page);
|
|
await expectComposerDraft(page, "");
|
|
} finally {
|
|
await agent.cleanup();
|
|
}
|
|
});
|
|
|
|
test("Escape interrupt cancels the running agent and preserves composer draft", async ({
|
|
page,
|
|
}) => {
|
|
test.setTimeout(120_000);
|
|
const agent = await startRunningMockAgent(page, {
|
|
prefix: "attach-interrupt-",
|
|
model: "ten-second-stream",
|
|
prompt: "Stay running for interrupt test.",
|
|
});
|
|
try {
|
|
await fillComposerDraft(page, "preserve me");
|
|
await pressInterruptShortcut(page);
|
|
|
|
await expectAgentIdle(page, 15_000);
|
|
await expectComposerDraft(page, "preserve me");
|
|
} finally {
|
|
await agent.cleanup();
|
|
}
|
|
});
|
|
|
|
test("composer is locked while new workspace agent is being created", async ({ page }) => {
|
|
test.setTimeout(120_000);
|
|
const serverId = getServerId();
|
|
|
|
const agentCreatedDelay = await delayBrowserAgentCreatedStatus(page);
|
|
const workspace = await seedWorkspace({ repoPrefix: "attach-lock-" });
|
|
|
|
try {
|
|
await gotoAppShell(page);
|
|
await waitForSidebarHydration(page);
|
|
await switchWorkspaceViaSidebar({
|
|
page,
|
|
serverId,
|
|
workspaceId: workspace.workspaceId,
|
|
});
|
|
|
|
await openNewWorkspaceComposer(page, {
|
|
projectKey: workspace.projectKey,
|
|
projectDisplayName: workspace.projectDisplayName,
|
|
});
|
|
await fillComposerDraft(page, "lock test prompt");
|
|
const createButton = page
|
|
.getByTestId("message-input-root")
|
|
.getByRole("button", { name: "Create" });
|
|
await expect(createButton).toBeVisible({ timeout: 30_000 });
|
|
await createButton.click();
|
|
|
|
await agentCreatedDelay.waitForCreateRequest();
|
|
await agentCreatedDelay.waitForDelayedCreatedStatus();
|
|
|
|
await expectComposerDisabled(page);
|
|
await expectAttachButtonDisabled(page);
|
|
|
|
agentCreatedDelay.release();
|
|
|
|
await expectComposerEditable(page);
|
|
} finally {
|
|
agentCreatedDelay.release();
|
|
await workspace.cleanup();
|
|
}
|
|
});
|
|
});
|