diff --git a/packages/shared/src/connection-routing.ts b/packages/shared/src/connection-routing.ts index fa29ecccbed..6c506acd09b 100644 --- a/packages/shared/src/connection-routing.ts +++ b/packages/shared/src/connection-routing.ts @@ -217,9 +217,19 @@ for (const [toolkit, name] of composioCatalog.toolkits as Array<[string, string] } } +const supportIdentities = new Map(); +function supportIdentity(entry: AggregatorServiceDefinition) { + let identity = supportIdentities.get(entry); + if (identity === undefined) { + identity = aggregatorAppIdentity(entry.name); + supportIdentities.set(entry, identity); + } + return identity; +} for (const app of arcadeCatalog.apps) { + const appIdentity = aggregatorAppIdentity(app.name); const existing = AGGREGATOR_SUPPORT_INDEX.find((entry) => - entry.slug === app.slug || aggregatorAppIdentity(entry.name) === aggregatorAppIdentity(app.name)); + entry.slug === app.slug || supportIdentity(entry) === appIdentity); if (existing) { existing.aliases = [...new Set([...existing.aliases, app.slug, ...app.aliases])]; existing.providers = { ...existing.providers, arcade: arcadeCatalog.verifiedAt }; diff --git a/tests/runner-e2e/README.md b/tests/runner-e2e/README.md index 5b67e67a15a..07a6b0041e0 100644 --- a/tests/runner-e2e/README.md +++ b/tests/runner-e2e/README.md @@ -1219,6 +1219,18 @@ unavailable/terminated test process produce a `launcher/environment failure` diagnostic and exit 2. Assertion failures retain the test runner's exit status and output; assess installed-product failures from those assertions separately. +Each Vitest file runs in its own isolated worker, so every file loads its +imports again. The suite is CPU-bound on the 4-vCPU CI runner, so it keeps +Vitest's default of one worker fewer than the CPU count. A fourth worker raised +load enough to fail a process-tree cleanup test. The unit command sets +`NODE_COMPILE_CACHE` to `/paperclip-runner-e2e-compile-cache` unless it +is already set, so workers and the Node processes that tests start reuse +compiled code for dependencies such as `@playwright/test`. Node checks each +cache entry against the source and recompiles on a mismatch. Set +`NODE_DISABLE_COMPILE_CACHE=1` to run without it. Keep work that runs when a +module loads small: about 140 test files load `catalog.ts` and about 230 load +`chat-feature-cases.ts`, so a cost at load is paid once per file. + PR CI runs `pnpm test:e2e:runner:unit` as the required "Runner support suite" job in `pr-trusted.yml`. It runs when server, CLI, package or UI source changes, and on every full CI run. The suite pins workflow security policy, diff --git a/tests/runner-e2e/catalog.ts b/tests/runner-e2e/catalog.ts index ddb9df5b582..28d4b024e65 100644 --- a/tests/runner-e2e/catalog.ts +++ b/tests/runner-e2e/catalog.ts @@ -2170,6 +2170,7 @@ export function buildRunnerMatrix( ): MatrixExecution[] { return suites.flatMap((suite) => { const excludedExecutionIds = new Set(suite.excludedExecutionIds ?? []); + const definitionHash = suiteDefinitionHash(suite); return suite.profiles.flatMap((profile) => suite.environments .filter((environment) => @@ -2183,7 +2184,7 @@ export function buildRunnerMatrix( return { id: `${suite.id}.${profile.id}.${environment.id}.${task.id}`, suite, - suiteDefinitionHash: suiteDefinitionHash(suite), + suiteDefinitionHash: definitionHash, profile, environment: selectedEnvironment, task: suite.id === "confirmation-replies" && profile.id === "runner-codex" && environment.id === "daytona" && task.id === "task-card-accept" diff --git a/tests/runner-e2e/chat-catalog-fingerprint.ts b/tests/runner-e2e/chat-catalog-fingerprint.ts index f21ef91b2a4..fdc39ab7abf 100644 --- a/tests/runner-e2e/chat-catalog-fingerprint.ts +++ b/tests/runner-e2e/chat-catalog-fingerprint.ts @@ -32,6 +32,22 @@ function conservativeSources(directory: string): string[] { return entry.isDirectory() ? conservativeSources(child) : /\.(ts|tsx|js|mjs|json|yaml)$/.test(entry.name) ? [child] : []; }); } +const importScans = new Map(); +function scanImports(absolute: string, body: string) { + const key = `${absolute}\0${hash(body)}`; + const cached = importScans.get(key); + if (cached) return cached; + const parsed = buildSync({ stdin: { contents: body, sourcefile: absolute, + loader: absolute.endsWith(".tsx") ? "tsx" : /\.ts$/.test(absolute) ? "ts" : "js" }, + bundle: false, metafile: true, write: false, format: "esm", platform: "node", minifyWhitespace: true, + legalComments: "none", logLevel: "silent" }); + const scan = { + dependencies: Object.values(parsed.metafile!.outputs).flatMap(output => output.imports.map(item => item.path)), + variableImport: /\bimport\s*\(\s*(?!["'])/.test(parsed.outputFiles[0]!.text), + }; + importScans.set(key, scan); + return scan; +} /** Compile and inspect actual executable imports, rather than trusting a hand-maintained sourceFiles list. */ export function fingerprintChatDependencyClosure(input: { root: string; entries: readonly string[]; selected: unknown; @@ -54,12 +70,8 @@ export function fingerprintChatDependencyClosure(input: { const body = readFileSync(absolute, "utf8"); files.set(relative, body); if (!/\.[cm]?[jt]sx?$/.test(absolute)) return; - const parsed = buildSync({ stdin: { contents: body, sourcefile: absolute, - loader: absolute.endsWith(".tsx") ? "tsx" : /\.ts$/.test(absolute) ? "ts" : "js" }, - bundle: false, metafile: true, write: false, format: "esm", platform: "node", minifyWhitespace: true, - legalComments: "none", logLevel: "silent" }); - const dependencies = Object.values(parsed.metafile!.outputs).flatMap(output => output.imports.map(item => item.path)); - if (/\bimport\s*\(\s*(?!["'])/.test(parsed.outputFiles[0]!.text) && relative !== input.selectedDispatchFile) { + const { dependencies, variableImport } = scanImports(absolute, body); + if (variableImport && relative !== input.selectedDispatchFile) { const reviewed = input.reviewedDynamicResolutions?.[relative]; if (reviewed && reviewed.sourceSha256 === hash(body)) { resolvedDynamicImports.push({ file: relative, resolution: reviewed.resolution }); diff --git a/tests/runner-e2e/chat-rendered-links.test.ts b/tests/runner-e2e/chat-rendered-links.test.ts index 9b6ec4a1560..e034a09e591 100644 --- a/tests/runner-e2e/chat-rendered-links.test.ts +++ b/tests/runner-e2e/chat-rendered-links.test.ts @@ -149,6 +149,9 @@ describe("waits for a finished run's reply to be saved, then rendered, before it // finalization after the run's terminal status and logged no comment_added, so the open conversation never // fetched it; the thread kept only the person's message. One reload reads the saved conversation. describe("reloads once when a saved reply never renders in the open conversation", () => { + beforeEach(() => { vi.useFakeTimers(); }); + afterEach(() => { vi.useRealTimers(); }); + const settle = async (waiting: Promise) => { await vi.runAllTimersAsync(); return waiting; }; const reloading = (onReload: () => void) => { let reloads = 0; const page = { evaluate: async (read: (arg: A) => T, arg: A) => read(arg), @@ -159,7 +162,7 @@ describe("reloads once when a saved reply never renders in the open conversation const comments = async () => input().comments; document.querySelector('#comment-reply')!.remove(); const p = reloading(() => document.querySelector('[data-testid="task-chat-scroller"]')!.insertAdjacentHTML("beforeend", '')); - const wait = await waitForSavedTurnReplyRenderReloadingOnce(p.page, { comments, leadId: "ceo", runIds: ["run"] }, 300, 50); + const wait = await settle(waitForSavedTurnReplyRenderReloadingOnce(p.page, { comments, leadId: "ceo", runIds: ["run"] }, 300, 50)); expect(wait.result).toBe("rendered"); expect(p.reloads()).toBe(1); expect(wait.attempts.map(row => [row.phase, row.result])).toEqual([["open-document", "pending"], ["after-reload", "rendered"]]); }); @@ -171,17 +174,17 @@ describe("reloads once when a saved reply never renders in the open conversation document.body.innerHTML = "
Loading
"; setTimeout(() => { document.body.innerHTML = saved; document.querySelector('[data-testid="task-chat-scroller"]')!.insertAdjacentHTML("beforeend", ''); }, 300); }); - const wait = await waitForSavedTurnReplyRenderReloadingOnce(p.page, { comments, leadId: "ceo", runIds: ["run"] }, 1_000, 50); + const wait = await settle(waitForSavedTurnReplyRenderReloadingOnce(p.page, { comments, leadId: "ceo", runIds: ["run"] }, 1_000, 50)); expect(wait.attempts.map(row => [row.phase, row.result])).toEqual([["open-document", "pending"], ["after-reload", "rendered"]]); }); it("does not reload a reply that rendered live, and still reports a reply that never renders", async () => { const comments = async () => input().comments; const live = reloading(() => undefined); - expect((await waitForSavedTurnReplyRenderReloadingOnce(live.page, { comments, leadId: "ceo", runIds: ["run"] }, 300, 50)).result).toBe("rendered"); + expect((await settle(waitForSavedTurnReplyRenderReloadingOnce(live.page, { comments, leadId: "ceo", runIds: ["run"] }, 300, 50))).result).toBe("rendered"); expect(live.reloads()).toBe(0); document.querySelector('#comment-reply')!.remove(); const never = reloading(() => undefined); - const wait = await waitForSavedTurnReplyRenderReloadingOnce(never.page, { comments, leadId: "ceo", runIds: ["run"] }, 200, 50); + const wait = await settle(waitForSavedTurnReplyRenderReloadingOnce(never.page, { comments, leadId: "ceo", runIds: ["run"] }, 200, 50)); expect(wait.result).toBe("pending"); expect(never.reloads()).toBe(1); expect(wait.attempts).toHaveLength(2); }); }); diff --git a/tests/runner-e2e/run-unit.mjs b/tests/runner-e2e/run-unit.mjs index b2e14598d60..5bdfed2d3df 100644 --- a/tests/runner-e2e/run-unit.mjs +++ b/tests/runner-e2e/run-unit.mjs @@ -1,5 +1,6 @@ import { spawnSync } from "node:child_process"; import { existsSync } from "node:fs"; +import { tmpdir } from "node:os"; import path from "node:path"; import { fileURLToPath } from "node:url"; @@ -19,6 +20,7 @@ const { invocationEnv } = await import(new URL("../../scripts/ci-profile/record. const env = { ...process.env }; delete env.NODE_PATH; delete env.NODE_OPTIONS; +env.NODE_COMPILE_CACHE ??= path.join(tmpdir(), "paperclip-runner-e2e-compile-cache"); for (const [name, command] of [ // Server modules under test import the built plugin SDK (and shared) package. diff --git a/tests/runner-e2e/source-sdk-public-inputs.json b/tests/runner-e2e/source-sdk-public-inputs.json index e9c3fba6caa..b5c65ee2abf 100644 --- a/tests/runner-e2e/source-sdk-public-inputs.json +++ b/tests/runner-e2e/source-sdk-public-inputs.json @@ -220,7 +220,7 @@ "packages/shared/src/connection-intent-guidance.test.ts": "ae89f72dff415181d07c29a75d005c229d5c61b8", "packages/shared/src/connection-intent-guidance.ts": "c121d7e31f3c44c7b0879db3929c23be20ef7987", "packages/shared/src/connection-routing.test.ts": "95f6d30b790a2ef69f409fb72e4ba83256d7771e", - "packages/shared/src/connection-routing.ts": "fa29ecccbed3f38497ed7f6eadcb8f7c2b193177", + "packages/shared/src/connection-routing.ts": "6c506acd09b75d4f70ecde6cc5b652a244a7eb8a", "packages/shared/src/connection-search.test.ts": "fc7a3ee0df22b19afe1d58f4d9bfbf8213ed0092", "packages/shared/src/connection-search.ts": "6aa86e3fb28a8e32da1aa99b841aacede055e0bf", "packages/shared/src/connection-setup-state.test.ts": "252f1a1627b80f322385a415df4656f8aa9148e9",