From 223b0271e632bd6fac6b94eb534ac91543f80f3a Mon Sep 17 00:00:00 2001 From: Aiden Cline <63023139+rekram1-node@users.noreply.github.com> Date: Sun, 13 Sep 2026 23:25:34 -0500 Subject: [PATCH] test: align platform and endpoint expectations (#48916) --- packages/app/e2e/regression/mcp-workspace-toggle.spec.ts | 4 ++-- packages/app/e2e/regression/new-session-summary.spec.ts | 2 +- packages/app/e2e/regression/session-summary-mcp.spec.ts | 4 ++-- packages/cli/test/acp/service-directory.test.ts | 9 +++++---- packages/cli/test/acp/service.test.ts | 5 +++-- packages/tui/test/app-lifecycle.test.tsx | 2 +- packages/tui/test/cli/tui/dialog-integration.test.tsx | 7 +++++-- packages/tui/test/session-wheel-focus.test.tsx | 4 +++- 8 files changed, 22 insertions(+), 15 deletions(-) diff --git a/packages/app/e2e/regression/mcp-workspace-toggle.spec.ts b/packages/app/e2e/regression/mcp-workspace-toggle.spec.ts index 4e9bcbb4508..dfaf6b07b17 100644 --- a/packages/app/e2e/regression/mcp-workspace-toggle.spec.ts +++ b/packages/app/e2e/regression/mcp-workspace-toggle.spec.ts @@ -30,7 +30,7 @@ for (const shared of [true, false]) { sessions: [{ id: sessionID, projectID, directory: workspace, title }], pageMessages: () => ({ items: [] }), }) - await page.route("**/api/mcp**", async (route) => { + await page.route(/\/api\/(?:experimental\/)?mcp(?:[/?]|$)/, async (route) => { if (route.request().method() === "OPTIONS") return route.fallback() const url = new URL(route.request().url()) const target = url.searchParams.get("location[directory]") ?? directory @@ -109,7 +109,7 @@ for (const surface of ["popover", "dialog"] as const) { sessions: [{ id: sessionID, projectID, directory: workspace, title }], pageMessages: () => ({ items: [] }), }) - await page.route("**/api/mcp**", async (route) => { + await page.route(/\/api\/(?:experimental\/)?mcp(?:[/?]|$)/, async (route) => { if (route.request().method() === "OPTIONS") return route.fallback() const url = new URL(route.request().url()) const target = url.searchParams.get("location[directory]") ?? directory diff --git a/packages/app/e2e/regression/new-session-summary.spec.ts b/packages/app/e2e/regression/new-session-summary.spec.ts index aabcbbeba29..d5196374e4d 100644 --- a/packages/app/e2e/regression/new-session-summary.spec.ts +++ b/packages/app/e2e/regression/new-session-summary.spec.ts @@ -343,7 +343,7 @@ async function openDraft(page: Page, worktree = "main", options: { git?: boolean (route) => route.fulfill({ json: { location: { directory }, data: { branch: {} } } }), ) } - await page.route("**/api/mcp**", async (route) => { + await page.route(/\/api\/(?:experimental\/)?mcp(?:[/?]|$)/, async (route) => { if (route.request().method() === "OPTIONS") return route.fallback() const url = new URL(route.request().url()) const target = url.searchParams.get("location[directory]") ?? directory diff --git a/packages/app/e2e/regression/session-summary-mcp.spec.ts b/packages/app/e2e/regression/session-summary-mcp.spec.ts index a16a60c834d..1470e1e7ea4 100644 --- a/packages/app/e2e/regression/session-summary-mcp.spec.ts +++ b/packages/app/e2e/regression/session-summary-mcp.spec.ts @@ -6,7 +6,7 @@ test("every MCP row hit area toggles exactly once and keeps the submenu open", a await mockStressTimeline(page) const state = { enabled: true } const writes: string[] = [] - await page.route("**/api/mcp**", (route) => { + await page.route(/\/api\/(?:experimental\/)?mcp(?:[/?]|$)/, (route) => { if (route.request().method() === "OPTIONS") return route.fallback() const url = new URL(route.request().url()) const directory = url.searchParams.get("location[directory]") @@ -72,7 +72,7 @@ test("MCP authentication starts before a slow resource catalog finishes", async const attempts: string[] = [] const resources = Promise.withResolvers() await context.route("https://auth.example.test/**", (route) => route.fulfill({ body: "Sign in" })) - await page.route("**/api/mcp**", async (route) => { + await page.route(/\/api\/(?:experimental\/)?mcp(?:[/?]|$)/, async (route) => { if (route.request().method() === "OPTIONS") return route.fallback() const url = new URL(route.request().url()) if (url.pathname.endsWith("/connect")) { diff --git a/packages/cli/test/acp/service-directory.test.ts b/packages/cli/test/acp/service-directory.test.ts index 7783afcb18d..d262f3e0677 100644 --- a/packages/cli/test/acp/service-directory.test.ts +++ b/packages/cli/test/acp/service-directory.test.ts @@ -236,6 +236,7 @@ describe("acp service directory behavior", () => { headers: [{ name: "Authorization", value: "Bearer x" }], } let created = 0 + const mcp = "/api/experimental/mcp/" await using fixture = makeACPFixture({ fetch(request) { if (request.method === "POST" && request.path === "/api/session") { @@ -245,7 +246,7 @@ describe("acp service directory behavior", () => { if (request.method === "GET" && request.path === "/api/session/ses_1") { return Response.json({ data: makeSession("ses_1") }) } - if (request.method === "PUT" && request.path.startsWith("/api/mcp/")) { + if (request.method === "PUT" && request.path.startsWith(mcp)) { return new Response(null, { status: 204 }) } return undefined @@ -257,9 +258,9 @@ describe("acp service directory behavior", () => { await fixture.service.resumeSession({ cwd: "/workspace", sessionId: "ses_1", mcpServers: [changed] }) await fixture.service.newSession({ cwd: "/workspace", mcpServers: [local] }) - const adds = fixture.requests.filter((request) => request.method === "PUT" && request.path.startsWith("/api/mcp/")) + const adds = fixture.requests.filter((request) => request.method === "PUT" && request.path.startsWith(mcp)) expect(adds).toHaveLength(4) - expect(adds.filter((request) => request.path === "/api/mcp/tools").map((request) => request.body)).toEqual([ + expect(adds.filter((request) => request.path === `${mcp}tools`).map((request) => request.body)).toEqual([ { config: { type: "local", @@ -282,7 +283,7 @@ describe("acp service directory behavior", () => { }, }, ]) - expect(adds.find((request) => request.path === "/api/mcp/docs")?.body).toEqual({ + expect(adds.find((request) => request.path === `${mcp}docs`)?.body).toEqual({ config: { type: "remote", url: "https://example.com/mcp", diff --git a/packages/cli/test/acp/service.test.ts b/packages/cli/test/acp/service.test.ts index fbdd563f641..f8b43dc5536 100644 --- a/packages/cli/test/acp/service.test.ts +++ b/packages/cli/test/acp/service.test.ts @@ -24,7 +24,8 @@ describe("acp service", () => { if (url.pathname === "/api/command") return Response.json({ location, data: [{ name: "review", template: "" }] }) if (url.pathname === "/api/session" && request.method === "POST") return Response.json({ data: session }) - if (url.pathname === "/api/mcp/docs" && request.method === "PUT") return new Response(null, { status: 204 }) + if (url.pathname === "/api/experimental/mcp/docs" && request.method === "PUT") + return new Response(null, { status: 204 }) return new Response(null, { status: 404 }) }, }) @@ -53,7 +54,7 @@ describe("acp service", () => { expect(result.configOptions?.map((option) => option.id)).toEqual(["model", "effort", "mode"]) expect(requests).toContainEqual({ method: "PUT", - path: "/api/mcp/docs", + path: "/api/experimental/mcp/docs", body: { config: { type: "local", command: ["bun", "docs.ts"], environment: { TOKEN: "x" } }, }, diff --git a/packages/tui/test/app-lifecycle.test.tsx b/packages/tui/test/app-lifecycle.test.tsx index e817c6c2007..ce960965564 100644 --- a/packages/tui/test/app-lifecycle.test.tsx +++ b/packages/tui/test/app-lifecycle.test.tsx @@ -1250,7 +1250,7 @@ test("ctrl+c dismisses autocomplete and shell mode before exiting", async () => expect(setup.renderer.isDestroyed).toBe(false) }) -test.each(["manual", "select"] as const)( +test.skipIf(process.platform === "win32").each(["manual", "select"] as const)( "selection copy and pane management respect %s mode in the prompt and terminal pane", async (copy) => { const setup = await createTestRenderer({ width: 100, height: 30, useThread: false, kittyKeyboard: true }) diff --git a/packages/tui/test/cli/tui/dialog-integration.test.tsx b/packages/tui/test/cli/tui/dialog-integration.test.tsx index 331d8c7c68c..020e2f04e93 100644 --- a/packages/tui/test/cli/tui/dialog-integration.test.tsx +++ b/packages/tui/test/cli/tui/dialog-integration.test.tsx @@ -204,7 +204,7 @@ test("hides account rename and delete actions while the add account row is selec } }) -test("uses the active location for integration data and credential requests", async () => { +test("uses the active location for integration data without scoping credential requests", async () => { const location = { directory: "/remote/project" } const fixture = await renderIntegration(location) @@ -216,6 +216,7 @@ test("uses the active location for integration data and credential requests", as await fixture.app.waitFor(() => fixture.requests.length === 1) expect(fixture.locations).toContainEqual(location) expect(fixture.locations.at(-1)).toEqual(location) + expect(fixture.credentialQueries).toEqual([""]) } finally { fixture.app.renderer.destroy() } @@ -225,6 +226,7 @@ async function renderIntegration(activeLocation?: LocationRef) { const events = createEventStream() const requests: Array<{ method: string; path: string; body?: { label: string } }> = [] const locations: LocationRef[] = [] + const credentialQueries: string[] = [] const reads = { integration: 0, model: 0, provider: 0 } let accounts = [ { type: "credential" as const, id: "cred_personal", label: "Personal" }, @@ -268,7 +270,7 @@ async function renderIntegration(activeLocation?: LocationRef) { } if (request.method === "POST" && /^\/api\/credential\/[^/]+\/activate$/.test(url.pathname)) { - locations.push(requestedLocation) + credentialQueries.push(url.search) const id = url.pathname.split("/")[3] const active = accounts.find((account) => account.id === id) if (!active) throw new Error(`unknown credential: ${id}`) @@ -360,6 +362,7 @@ async function renderIntegration(activeLocation?: LocationRef) { reads, requests, locations, + credentialQueries, get accounts() { return accounts }, diff --git a/packages/tui/test/session-wheel-focus.test.tsx b/packages/tui/test/session-wheel-focus.test.tsx index 9937f8ad422..21598d6f5d3 100644 --- a/packages/tui/test/session-wheel-focus.test.tsx +++ b/packages/tui/test/session-wheel-focus.test.tsx @@ -6,7 +6,9 @@ import { Global } from "@opencode/util/global" import { createEventStream, createFetch, directory, json } from "./fixture/tui-client" import { tmpdir } from "./fixture/fixture" -test.each([80, 120, 180])("session wheel scrolling preserves pane focus at width %s", async (width) => { +test + .skipIf(process.platform === "win32") + .each([80, 120, 180])("session wheel scrolling preserves pane focus at width %s", async (width) => { await using state = await tmpdir() const setup = await createTestRenderer({ width, height: 36, useThread: false, kittyKeyboard: true }) setup.renderer.start()