From 65f9fc397e327feae4383582265c863dace4fbbd Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Tue, 7 Apr 2026 09:12:25 +0100 Subject: [PATCH] perf(test): split support boundary shard --- docs/help/testing.md | 2 +- docs/reference/test.md | 2 +- scripts/check-extension-plugin-sdk-boundary.mjs | 6 +++++- test/scripts/test-projects.test.ts | 6 ++++++ vitest.full-core-support-boundary.config.ts | 7 +++++++ vitest.test-shards.mjs | 11 ++++++----- 6 files changed, 26 insertions(+), 8 deletions(-) create mode 100644 vitest.full-core-support-boundary.config.ts diff --git a/docs/help/testing.md b/docs/help/testing.md index d22cddca39f..d8e777d16d8 100644 --- a/docs/help/testing.md +++ b/docs/help/testing.md @@ -58,7 +58,7 @@ Think of the suites as “increasing realism” (and increasing flakiness/cost): - No real keys required - Should be fast and stable - Projects note: - - Untargeted `pnpm test` now runs ten smaller shard configs (`core-unit-src`, `core-unit-security`, `core-unit-ui`, `core-unit-support`, `core-contracts`, `core-bundled`, `core-runtime`, `agentic`, `auto-reply`, `extensions`) instead of one giant native root-project process. This cuts peak RSS on loaded machines and avoids auto-reply/extension work starving unrelated suites. + - Untargeted `pnpm test` now runs eleven smaller shard configs (`core-unit-src`, `core-unit-security`, `core-unit-ui`, `core-unit-support`, `core-support-boundary`, `core-contracts`, `core-bundled`, `core-runtime`, `agentic`, `auto-reply`, `extensions`) instead of one giant native root-project process. This cuts peak RSS on loaded machines and avoids auto-reply/extension work starving unrelated suites. - `pnpm test --watch` still uses the native root `vitest.config.ts` project graph, because a multi-shard watch loop is not practical. - `pnpm test`, `pnpm test:watch`, and `pnpm test:perf:imports` route explicit file/directory targets through scoped lanes first, so `pnpm test extensions/discord/src/monitor/message-handler.preflight.test.ts` avoids paying the full root project startup tax. - `pnpm test:changed` expands changed git paths into the same scoped lanes when the diff only touches routable source/test files; config/setup edits still fall back to the broad root-project rerun. diff --git a/docs/reference/test.md b/docs/reference/test.md index 75780fcde91..cbbcb949afe 100644 --- a/docs/reference/test.md +++ b/docs/reference/test.md @@ -13,7 +13,7 @@ title: "Tests" - `pnpm test:coverage`: Runs the unit suite with V8 coverage (via `vitest.unit.config.ts`). Global thresholds are 70% lines/branches/functions/statements. Coverage excludes integration-heavy entrypoints (CLI wiring, gateway/telegram bridges, webchat static server) to keep the target focused on unit-testable logic. - `pnpm test:coverage:changed`: Runs unit coverage only for files changed since `origin/main`. - `pnpm test:changed`: expands changed git paths into scoped Vitest lanes when the diff only touches routable source/test files. Config/setup changes still fall back to the native root projects run so wiring edits rerun broadly when needed. -- `pnpm test`: routes explicit file/directory targets through scoped Vitest lanes. Untargeted runs now execute ten sequential shard configs (`vitest.full-core-unit-src.config.ts`, `vitest.full-core-unit-security.config.ts`, `vitest.full-core-unit-ui.config.ts`, `vitest.full-core-unit-support.config.ts`, `vitest.full-core-contracts.config.ts`, `vitest.full-core-bundled.config.ts`, `vitest.full-core-runtime.config.ts`, `vitest.full-agentic.config.ts`, `vitest.full-auto-reply.config.ts`, `vitest.full-extensions.config.ts`) instead of one giant root-project process. +- `pnpm test`: routes explicit file/directory targets through scoped Vitest lanes. Untargeted runs now execute eleven sequential shard configs (`vitest.full-core-unit-src.config.ts`, `vitest.full-core-unit-security.config.ts`, `vitest.full-core-unit-ui.config.ts`, `vitest.full-core-unit-support.config.ts`, `vitest.full-core-support-boundary.config.ts`, `vitest.full-core-contracts.config.ts`, `vitest.full-core-bundled.config.ts`, `vitest.full-core-runtime.config.ts`, `vitest.full-agentic.config.ts`, `vitest.full-auto-reply.config.ts`, `vitest.full-extensions.config.ts`) instead of one giant root-project process. - Selected `plugin-sdk` and `commands` test files now route through dedicated light lanes that keep only `test/setup.ts`, leaving runtime-heavy cases on their existing lanes. - Selected `plugin-sdk` and `commands` helper source files also map `pnpm test:changed` to explicit sibling tests in those light lanes, so small helper edits avoid rerunning the heavy runtime-backed suites. - `auto-reply` now also splits into three dedicated configs (`core`, `top-level`, `reply`) so the reply harness does not dominate the lighter top-level status/token/helper tests. diff --git a/scripts/check-extension-plugin-sdk-boundary.mjs b/scripts/check-extension-plugin-sdk-boundary.mjs index d8c82b83129..199fdb3ee48 100644 --- a/scripts/check-extension-plugin-sdk-boundary.mjs +++ b/scripts/check-extension-plugin-sdk-boundary.mjs @@ -64,6 +64,10 @@ function isCodeFile(fileName) { return /\.(ts|tsx|mts|cts|js|jsx|mjs|cjs)$/.test(fileName); } +function isBoundaryCanaryFile(fileName) { + return fileName.includes("__rootdir_boundary_canary__"); +} + async function collectExtensionSourceFiles(rootDir) { const out = []; async function walk(dir) { @@ -77,7 +81,7 @@ async function collectExtensionSourceFiles(rootDir) { await walk(fullPath); continue; } - if (!entry.isFile() || !isCodeFile(entry.name)) { + if (!entry.isFile() || !isCodeFile(entry.name) || isBoundaryCanaryFile(entry.name)) { continue; } const relativePath = normalizeRepoPath(repoRoot, fullPath); diff --git a/test/scripts/test-projects.test.ts b/test/scripts/test-projects.test.ts index dae72f6f1d0..f473bcca69f 100644 --- a/test/scripts/test-projects.test.ts +++ b/test/scripts/test-projects.test.ts @@ -187,6 +187,12 @@ describe("scripts/test-projects full-suite sharding", () => { includePatterns: null, watchMode: false, }, + { + config: "vitest.full-core-support-boundary.config.ts", + forwardedArgs: [], + includePatterns: null, + watchMode: false, + }, { config: "vitest.full-core-contracts.config.ts", forwardedArgs: [], diff --git a/vitest.full-core-support-boundary.config.ts b/vitest.full-core-support-boundary.config.ts new file mode 100644 index 00000000000..5d3196199c8 --- /dev/null +++ b/vitest.full-core-support-boundary.config.ts @@ -0,0 +1,7 @@ +import { createProjectShardVitestConfig } from "./vitest.project-shard-config.ts"; +import { fullSuiteVitestShards } from "./vitest.test-shards.mjs"; + +export default createProjectShardVitestConfig( + fullSuiteVitestShards.find((shard) => shard.config === "vitest.full-core-support-boundary.config.ts") + ?.projects ?? [], +); diff --git a/vitest.test-shards.mjs b/vitest.test-shards.mjs index 2e71f80ab70..0b7a7298490 100644 --- a/vitest.test-shards.mjs +++ b/vitest.test-shards.mjs @@ -25,11 +25,12 @@ export const fullSuiteVitestShards = [ { config: "vitest.full-core-unit-support.config.ts", name: "core-unit-support", - projects: [ - "vitest.unit-support.config.ts", - "vitest.boundary.config.ts", - "vitest.tooling.config.ts", - ], + projects: ["vitest.unit-support.config.ts"], + }, + { + config: "vitest.full-core-support-boundary.config.ts", + name: "core-support-boundary", + projects: ["vitest.boundary.config.ts", "vitest.tooling.config.ts"], }, { config: "vitest.full-core-contracts.config.ts",