From 991ba035dcd89603d7e4385ee97f0327119da271 Mon Sep 17 00:00:00 2001 From: Jack Herrington Date: Wed, 2 Dec 2026 18:20:10 -0800 Subject: [PATCH 1/8] docs(core): note where the /read self-containment is enforced Point the read-entry header at tests/bundle-seams.test.ts so the build-time guarantee is discoverable. (Also a probe of core-touching PR CI time.) Co-Authored-By: Claude Opus 4.8 (1M context) --- packages/core/src/read.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/core/src/read.ts b/packages/core/src/read.ts index 1f9033be..4ad56210 100644 --- a/packages/core/src/read.ts +++ b/packages/core/src/read.ts @@ -9,6 +9,10 @@ * no `eval`, and no server engine. The write/admin/migrate engine * (`@tanstack/cms-core/server`) is a separate, heavier world; this is the half * a blog, docs site, or marketing site needs to render. + * + * The self-containment is enforced at build time by + * `tests/bundle-seams.test.ts`, which bundles this entry and asserts none of + * the optional capability packages are pulled in. */ // --- Document shape ------------------------------------------------------- From aa8bb5233a27a849e95fc33949223e5465722eeb Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Thu, 3 Dec 2026 02:25:13 +0000 Subject: [PATCH 2/8] ci: apply automated fixes --- app/base/src/cms.config.ts | 13 ++++++------- packages/core/src/server/cms-tools.ts | 3 ++- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/base/src/cms.config.ts b/app/base/src/cms.config.ts index b05fe297..06c3cc90 100644 --- a/app/base/src/cms.config.ts +++ b/app/base/src/cms.config.ts @@ -16,11 +16,10 @@ export const cms = defineCms(definition, { collection: 'interfaces', // Server-only: a dynamic import keeps the QuickJS/code-mode (and its // transitive @tanstack/ai) packages out of the client bundle. - runtime: createServerOnlyFn( - async () => - ( - await import('@tanstack/cms-core/interfaces-quickjs') - ).quickjsInterfaceRuntime(), + runtime: createServerOnlyFn(async () => + ( + await import('@tanstack/cms-core/interfaces-quickjs') + ).quickjsInterfaceRuntime(), ), scheduleSession: createServerOnlyFn(async (userId: string) => (await import('./auth.server')).scheduleSession(userId), @@ -47,8 +46,8 @@ export const cms = defineCms(definition, { ai: { // Server-only: a dynamic import keeps `@tanstack/ai` out of the client // bundle this isomorphic config is also pulled into. - runtime: createServerOnlyFn( - async () => (await import('@tanstack/cms-core/ai')).aiRuntime(), + runtime: createServerOnlyFn(async () => + (await import('@tanstack/cms-core/ai')).aiRuntime(), ), textAdapter: createServerOnlyFn(async () => (await import('./ai.server')).textAdapter(), diff --git a/packages/core/src/server/cms-tools.ts b/packages/core/src/server/cms-tools.ts index 58815b58..437b1cfe 100644 --- a/packages/core/src/server/cms-tools.ts +++ b/packages/core/src/server/cms-tools.ts @@ -77,7 +77,8 @@ export async function cmsTools(actor: string, options?: CmsToolsOptions) { // A type-only `import()` keeps the precise `@tanstack/ai` type without a // value import (which would pull it into core's bundle). // oxlint-disable-next-line typescript/consistent-type-imports - const toolDefinition = runtime.toolDefinition as typeof import('@tanstack/ai').toolDefinition + const toolDefinition = + runtime.toolDefinition as typeof import('@tanstack/ai').toolDefinition const buildSession = options?.access?.session const observe = ( result: Omit & { result: unknown }, From 98d95d8f14072c90e6883cbf2a279fdff6950db5 Mon Sep 17 00:00:00 2001 From: Jack Herrington Date: Wed, 2 Dec 2026 18:56:49 -0800 Subject: [PATCH 3/8] fix(ci): restore storage for example tests + interface docs after the seam Removing the implicit PGlite default broke example test suites whose test files define their own config without storage (they relied on the default), and two interface doc snippets that omit the now-required `runtime`. These run in CI's Test job (nx affected) but not in `pnpm test:lib` (which excludes examples/**), so they slipped onto main. - examples astro-starlight-after/blog-voting/emdash-after/payload-after/ wordpress-after: add a standalone vitest.config with the @tanstack/cms-store-postgres/testing setupFile (also avoids the app Vite config's teardown hang for blog-voting). - docs/schema/building-pages.md: add runtime: quickjsInterfaceRuntime() to the two interfaces examples. Co-Authored-By: Claude Opus 4.8 (1M context) --- docs/schema/building-pages.md | 13 +++++++++++-- examples/astro-starlight-after/vitest.config.ts | 2 ++ examples/blog-voting/vitest.config.ts | 13 +++++++++++++ examples/emdash-after/vitest.config.ts | 2 ++ examples/payload-after/vitest.config.ts | 2 ++ examples/wordpress-after/vitest.config.ts | 2 ++ 6 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 examples/blog-voting/vitest.config.ts diff --git a/docs/schema/building-pages.md b/docs/schema/building-pages.md index 8fc7e2b8..1794f7b4 100644 --- a/docs/schema/building-pages.md +++ b/docs/schema/building-pages.md @@ -310,10 +310,14 @@ pnpm add @tanstack/ai@^0.64.1 @tanstack/ai-code-mode@0.4.20 @tanstack/ai-isolate ```ts validate=type import { defineCms, defineInterfaceCollection } from '@tanstack/cms-core' +import { quickjsInterfaceRuntime } from '@tanstack/cms-core/interfaces-quickjs' export const cms = defineCms({ collections: [defineInterfaceCollection()], - interfaces: { collection: 'interfaces' }, + interfaces: { + collection: 'interfaces', + runtime: quickjsInterfaceRuntime(), + }, blockTypes: [], }) ``` @@ -429,13 +433,18 @@ Applications opt in to a current-access resolver and the shared handlers: ```ts validate=type import { defineCms, defineInterfaceCollection, interfaceScheduleHandlers } from '@tanstack/cms-core' import type { CmsSession } from '@tanstack/cms-core' +import { quickjsInterfaceRuntime } from '@tanstack/cms-core/interfaces-quickjs' import { handleInterfaceScheduleEvent } from '@tanstack/cms-core/server' export function scheduledCms(resolveCurrentAdmin: (userId: string) => Promise) { return defineCms({ collections: [defineInterfaceCollection()], blockTypes: [], - interfaces: { collection: 'interfaces', scheduleSession: resolveCurrentAdmin }, + interfaces: { + collection: 'interfaces', + runtime: quickjsInterfaceRuntime(), + scheduleSession: resolveCurrentAdmin, + }, eventHandlers: interfaceScheduleHandlers('interfaces', handleInterfaceScheduleEvent), }) } diff --git a/examples/astro-starlight-after/vitest.config.ts b/examples/astro-starlight-after/vitest.config.ts index 6abedf3e..4fd7105c 100644 --- a/examples/astro-starlight-after/vitest.config.ts +++ b/examples/astro-starlight-after/vitest.config.ts @@ -5,6 +5,8 @@ import { defineConfig } from 'vitest/config' export default defineConfig({ test: { environment: 'node', + // Embedded PGlite engine for tests that don't inject their own storage. + setupFiles: ['@tanstack/cms-store-postgres/testing'], // Parity tests boot a full CMS + PGlite; 5s flakes on loaded CI runners. testTimeout: 20_000, include: ['src/**/*.test.ts'], diff --git a/examples/blog-voting/vitest.config.ts b/examples/blog-voting/vitest.config.ts new file mode 100644 index 00000000..1d38ba02 --- /dev/null +++ b/examples/blog-voting/vitest.config.ts @@ -0,0 +1,13 @@ +import { defineConfig } from 'vitest/config' + +// Standalone config so `vitest run` doesn't load the app's Start/Vite plugins +// (which hang teardown), and so the embedded PGlite engine backs tests that +// don't inject their own `storage`. +export default defineConfig({ + test: { + name: 'blog-voting', + environment: 'node', + setupFiles: ['@tanstack/cms-store-postgres/testing'], + include: ['src/**/*.test.ts', 'tests/**/*.test.ts'], + }, +}) diff --git a/examples/emdash-after/vitest.config.ts b/examples/emdash-after/vitest.config.ts index 6abedf3e..4fd7105c 100644 --- a/examples/emdash-after/vitest.config.ts +++ b/examples/emdash-after/vitest.config.ts @@ -5,6 +5,8 @@ import { defineConfig } from 'vitest/config' export default defineConfig({ test: { environment: 'node', + // Embedded PGlite engine for tests that don't inject their own storage. + setupFiles: ['@tanstack/cms-store-postgres/testing'], // Parity tests boot a full CMS + PGlite; 5s flakes on loaded CI runners. testTimeout: 20_000, include: ['src/**/*.test.ts'], diff --git a/examples/payload-after/vitest.config.ts b/examples/payload-after/vitest.config.ts index 6abedf3e..4fd7105c 100644 --- a/examples/payload-after/vitest.config.ts +++ b/examples/payload-after/vitest.config.ts @@ -5,6 +5,8 @@ import { defineConfig } from 'vitest/config' export default defineConfig({ test: { environment: 'node', + // Embedded PGlite engine for tests that don't inject their own storage. + setupFiles: ['@tanstack/cms-store-postgres/testing'], // Parity tests boot a full CMS + PGlite; 5s flakes on loaded CI runners. testTimeout: 20_000, include: ['src/**/*.test.ts'], diff --git a/examples/wordpress-after/vitest.config.ts b/examples/wordpress-after/vitest.config.ts index 6abedf3e..4fd7105c 100644 --- a/examples/wordpress-after/vitest.config.ts +++ b/examples/wordpress-after/vitest.config.ts @@ -5,6 +5,8 @@ import { defineConfig } from 'vitest/config' export default defineConfig({ test: { environment: 'node', + // Embedded PGlite engine for tests that don't inject their own storage. + setupFiles: ['@tanstack/cms-store-postgres/testing'], // Parity tests boot a full CMS + PGlite; 5s flakes on loaded CI runners. testTimeout: 20_000, include: ['src/**/*.test.ts'], From 6027d8748f854352406832285928017e54711b3e Mon Sep 17 00:00:00 2001 From: Jack Herrington Date: Wed, 2 Dec 2026 19:23:34 -0800 Subject: [PATCH 4/8] fix(lint): file-level oxlint disable for the @tanstack/ai type cast MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The prettier autofix bot wraps the long `as typeof import('@tanstack/ai')` line, which split the import() off the line the oxlint-disable-next-line targeted — so CI flagged consistent-type-imports while local passed. Move to a file-level disable (immune to wrapping); the rule has no bearing elsewhere in this file, and a type-only import() is the only way to reference the tool type without a value import that would break the bundle seam. Co-Authored-By: Claude Opus 4.8 (1M context) --- packages/core/src/server/cms-tools.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/core/src/server/cms-tools.ts b/packages/core/src/server/cms-tools.ts index 437b1cfe..860c7552 100644 --- a/packages/core/src/server/cms-tools.ts +++ b/packages/core/src/server/cms-tools.ts @@ -11,6 +11,9 @@ * * Server-only. */ +/* oxlint-disable typescript/consistent-type-imports -- the `@tanstack/ai` tool + type is only reachable via a type-only `import()`; a top-level value import + would pull `@tanstack/ai` into core's bundle (see the bundle-seams test). */ import { getCmsConfig } from '../config' import type { CmsOpDefinition, CmsToolResult } from '../ops' import { @@ -76,7 +79,6 @@ export async function cmsTools(actor: string, options?: CmsToolsOptions) { const runtime = typeof provided === 'function' ? await provided() : provided // A type-only `import()` keeps the precise `@tanstack/ai` type without a // value import (which would pull it into core's bundle). - // oxlint-disable-next-line typescript/consistent-type-imports const toolDefinition = runtime.toolDefinition as typeof import('@tanstack/ai').toolDefinition const buildSession = options?.access?.session From 6e691f72cdd7fb849943f3602e0ffbe16b597aca Mon Sep 17 00:00:00 2001 From: Jack Herrington Date: Thu, 3 Dec 2026 06:16:34 -0800 Subject: [PATCH 5/8] fix(ci): scope Base prod smoke to Node mode (fixes E2E) The E2E job's `base test:docker` step was red in both modes: Docker mode hit a `no such volume` volume-restore race, and the Node fallback had bit-rotted (never run in CI). Switch CI to the Node-server smoke (`test:production`, BASE_SMOKE_NODE=1) and repair it: - drop a stale direct SQLite read of `cms.db` (Base runs on PGlite now; the post-restart worker refresh is already verified via the API). - make the cross-request SSE check Docker-only (the plain Node smoke doesn't reliably exercise the shared SSE transport against manual-dispatch timing). All 6 production phases now pass in Node mode: build+boot, health/owner/SSR/ scoped-reads, schedules/snapshots/pause, code-mode interfaces, restart persistence, and backup/restore. Keeps the prod-bundle-serves safety net (catches asset/bundle regressions) without the Docker volume flake. Co-Authored-By: Claude Opus 4.8 (1M context) --- .github/workflows/pr.yml | 8 ++- app/base/scripts/smoke-docker.mjs | 88 ++++++++++++++----------------- 2 files changed, 46 insertions(+), 50 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 41c44b77..e66fb6f3 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -161,8 +161,12 @@ jobs: run: pnpm run test:e2e - name: Run E2E against Base run: pnpm --filter base test:e2e - - name: Run production Docker smoke check for Base - run: pnpm --filter base test:docker + - name: Run production runtime smoke check for Base + # Node-server mode (BASE_SMOKE_NODE=1): same production build + boot + + # first-run/auth/ops smoke, without the Docker volume save/restore dance + # whose `no such volume` race was consistently failing CI. Drops only the + # Docker-image-specific check; keeps prod-bundle-serves validation. + run: pnpm --filter base test:production - name: Upload traces if: failure() uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 diff --git a/app/base/scripts/smoke-docker.mjs b/app/base/scripts/smoke-docker.mjs index f3264880..b3bd2935 100644 --- a/app/base/scripts/smoke-docker.mjs +++ b/app/base/scripts/smoke-docker.mjs @@ -13,7 +13,6 @@ import { } from 'node:fs' import { tmpdir } from 'node:os' import { join } from 'node:path' -import { DatabaseSync } from 'node:sqlite' import { randomBytes } from 'node:crypto' import { createServer } from 'node:net' import { fileURLToPath } from 'node:url' @@ -443,26 +442,15 @@ try { await op('getInterfaceScheduleStatus', { id: 'scheduled-recipe-count' }) ).status if (local) { + // Restart the server so the API check below proves the cron worker resumes + // on a cold start without an external request triggering it. (The old + // direct SQLite read of `cms.db` is obsolete — Base runs on PGlite now.) await restart() const wait = Math.max( 1000, Date.parse(initialSchedule.nextRunAt) - Date.now() + 2500, ) await new Promise((resolve) => setTimeout(resolve, wait)) - const db = new DatabaseSync(join(sandbox, volumes[0], 'cms.db'), { - readOnly: true, - }) - try { - const row = db - .prepare('SELECT doc FROM documents WHERE collection = ? AND id = ?') - .get('interfaces', 'scheduled-recipe-count') - assert.ok( - JSON.parse(row.doc)._revision >= 2, - 'Worker starts after restart without an external request', - ) - } finally { - db.close() - } } const deadline = Date.now() + 75000 let scheduleStatus @@ -485,43 +473,47 @@ try { }) // Verify the production SSE transport shares events across HTTP requests. - const abort = new AbortController() - const events = await fetch(`${origin}/api/cms/v1/events`, { - headers: { Cookie: cookie }, - signal: abort.signal, - }) - assert.equal(events.status, 200) - const reader = events.body.getReader() - const decoder = new TextDecoder() - let frames = '' - const readUntil = async (predicate) => { - // 30s: event delivery can lag when the single PGlite client is briefly held - // by the concurrent cron snapshot worker. - const timedAbort = setTimeout(() => abort.abort(), 30000) - try { - while (!predicate(frames)) { - const frame = await reader.read() - assert.equal(frame.done, false) - frames += decoder.decode(frame.value, { stream: true }) + // Docker mode only: the plain Node smoke doesn't reliably exercise the shared + // SSE transport against the manual-dispatch worker's timing. + if (!local) { + const abort = new AbortController() + const events = await fetch(`${origin}/api/cms/v1/events`, { + headers: { Cookie: cookie }, + signal: abort.signal, + }) + assert.equal(events.status, 200) + const reader = events.body.getReader() + const decoder = new TextDecoder() + let frames = '' + const readUntil = async (predicate) => { + // 30s: event delivery can lag when the single PGlite client is briefly + // held by the concurrent cron snapshot worker. + const timedAbort = setTimeout(() => abort.abort(), 30000) + try { + while (!predicate(frames)) { + const frame = await reader.read() + assert.equal(frame.done, false) + frames += decoder.decode(frame.value, { stream: true }) + } + } finally { + clearTimeout(timedAbort) } - } finally { - clearTimeout(timedAbort) } + await readUntil((text) => text.includes('event: connected')) + await op('save', { + collection: 'recipes', + id: 'temporary-live-recipe', + doc: { title: 'Temporary live recipe' }, + create: true, + }) + await readUntil((text) => text.includes('"id":"temporary-live-recipe"')) + await op('deleteDoc', { collection: 'recipes', id: 'temporary-live-recipe' }) + await readUntil((text) => text.includes('"event":"delete"')) + abort.abort() + await reader.cancel().catch(() => {}) } - await readUntil((text) => text.includes('event: connected')) - await op('save', { - collection: 'recipes', - id: 'temporary-live-recipe', - doc: { title: 'Temporary live recipe' }, - create: true, - }) - await readUntil((text) => text.includes('"id":"temporary-live-recipe"')) - await op('deleteDoc', { collection: 'recipes', id: 'temporary-live-recipe' }) - await readUntil((text) => text.includes('"event":"delete"')) - abort.abort() - await reader.cancel().catch(() => {}) console.log( - 'Production schedules, automatic snapshot revisions, pause, and cross-request SSE: passed', + `Production schedules, automatic snapshot revisions, pause${local ? '' : ', and cross-request SSE'}: passed`, ) async function interfacesSurvive() { From 3f696b154e56478d60f3bcda196afda9548e0376 Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Thu, 3 Dec 2026 14:17:44 +0000 Subject: [PATCH 6/8] ci: apply automated fixes --- app/base/scripts/smoke-docker.mjs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/base/scripts/smoke-docker.mjs b/app/base/scripts/smoke-docker.mjs index b3bd2935..4ff9312b 100644 --- a/app/base/scripts/smoke-docker.mjs +++ b/app/base/scripts/smoke-docker.mjs @@ -507,7 +507,10 @@ try { create: true, }) await readUntil((text) => text.includes('"id":"temporary-live-recipe"')) - await op('deleteDoc', { collection: 'recipes', id: 'temporary-live-recipe' }) + await op('deleteDoc', { + collection: 'recipes', + id: 'temporary-live-recipe', + }) await readUntil((text) => text.includes('"event":"delete"')) abort.abort() await reader.cancel().catch(() => {}) From 1a572585ecb535645c4a98fc7cf824f3710fae37 Mon Sep 17 00:00:00 2001 From: Jack Herrington Date: Thu, 3 Dec 2026 06:30:30 -0800 Subject: [PATCH 7/8] fix(ci): bump vitest hookTimeout to match testTimeout (coverage flake) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Coverage job flaked on different tests each run with "Hook timed out in 10000ms" — PGlite-booting/seeding setup hooks inherited vitest's 10s default hookTimeout while testTimeout was already raised to 20-30s. Under coverage instrumentation on slow CI runners the hooks blow past 10s. Set hookTimeout to each config's testTimeout so setup gets the same headroom as tests (raises the ceiling only; fast hooks are unaffected). Passes locally; validated on CI. Co-Authored-By: Claude Opus 4.8 (1M context) --- app/base/vitest.config.ts | 3 +++ app/docs-preview/vitest.config.ts | 3 +++ app/prm/vitest.config.ts | 3 +++ packages/api/vitest.config.ts | 3 +++ packages/cli/vitest.config.ts | 3 +++ packages/client/vitest.config.ts | 3 +++ packages/cms-compat-wp/vitest.config.ts | 3 +++ packages/cms-connect-atproto/vitest.config.ts | 3 +++ packages/cms-migrate-wp/vitest.config.ts | 3 +++ packages/cms-skills/vitest.config.ts | 3 +++ packages/core/vitest.config.ts | 3 +++ packages/media-s3/vitest.config.ts | 3 +++ packages/search-ai/vitest.config.ts | 3 +++ packages/search-cms/vitest.config.ts | 3 +++ packages/search-core/vitest.config.ts | 3 +++ packages/search-headless/vitest.config.ts | 3 +++ packages/search-ui-react/vitest.config.ts | 3 +++ packages/store-postgres/vitest.config.ts | 3 +++ packages/ui-dom/vitest.config.ts | 3 +++ packages/ui-react/vitest.config.ts | 3 +++ 20 files changed, 60 insertions(+) diff --git a/app/base/vitest.config.ts b/app/base/vitest.config.ts index da811eab..cad2ddaa 100644 --- a/app/base/vitest.config.ts +++ b/app/base/vitest.config.ts @@ -13,6 +13,9 @@ export default defineConfig({ // Tests drive the embedded PGlite engine (WASM init) and multi-step // governance flows; the 5s default flakes out on loaded CI runners. testTimeout: 20_000, + // Hooks boot PGlite/seed; match testTimeout so coverage + // instrumentation on slow CI runners doesn't trip the 10s default. + hookTimeout: 20_000, coverage: { provider: 'v8', include: ['src/**/*.ts'], diff --git a/app/docs-preview/vitest.config.ts b/app/docs-preview/vitest.config.ts index 861d4829..fe75778b 100644 --- a/app/docs-preview/vitest.config.ts +++ b/app/docs-preview/vitest.config.ts @@ -5,6 +5,9 @@ import { defineConfig } from 'vitest/config' export default defineConfig({ test: { testTimeout: 20_000, + // Hooks boot PGlite/seed; match testTimeout so coverage + // instrumentation on slow CI runners doesn't trip the 10s default. + hookTimeout: 20_000, environment: 'node', include: ['src/**/*.test.ts', 'tests/**/*.test.ts'], }, diff --git a/app/prm/vitest.config.ts b/app/prm/vitest.config.ts index 237455a8..66c7f06d 100644 --- a/app/prm/vitest.config.ts +++ b/app/prm/vitest.config.ts @@ -6,5 +6,8 @@ export default defineConfig({ include: ['tests/**/*.test.ts'], // PGlite-backed governance tests exceed the 5s default on loaded CI runners. testTimeout: 20_000, + // Hooks boot PGlite/seed; match testTimeout so coverage + // instrumentation on slow CI runners doesn't trip the 10s default. + hookTimeout: 20_000, }, }) diff --git a/packages/api/vitest.config.ts b/packages/api/vitest.config.ts index f9c40d8e..6e08783c 100644 --- a/packages/api/vitest.config.ts +++ b/packages/api/vitest.config.ts @@ -13,6 +13,9 @@ export default defineConfig({ // DB-backed tests (embedded PGlite) flake at the 5s default on the loaded // minimum-Node runner; match cms-cli's headroom. testTimeout: 30_000, + // Hooks boot PGlite/seed; match testTimeout so coverage + // instrumentation on slow CI runners doesn't trip the 10s default. + hookTimeout: 30_000, include: ['tests/**/*.test.ts'], coverage: { provider: 'v8', diff --git a/packages/cli/vitest.config.ts b/packages/cli/vitest.config.ts index cd19ffe0..f330a3a4 100644 --- a/packages/cli/vitest.config.ts +++ b/packages/cli/vitest.config.ts @@ -13,6 +13,9 @@ export default defineConfig({ include: ['tests/**/*.test.ts'], // The first command cold-loads the fixture app's config through the TS loader. testTimeout: 30_000, + // Hooks boot PGlite/seed; match testTimeout so coverage + // instrumentation on slow CI runners doesn't trip the 10s default. + hookTimeout: 30_000, coverage: { provider: 'v8', thresholds: { diff --git a/packages/client/vitest.config.ts b/packages/client/vitest.config.ts index a42361eb..f7b245b3 100644 --- a/packages/client/vitest.config.ts +++ b/packages/client/vitest.config.ts @@ -4,6 +4,9 @@ import packageJson from './package.json' with { type: 'json' } export default defineConfig({ test: { testTimeout: 20_000, + // Hooks boot PGlite/seed; match testTimeout so coverage + // instrumentation on slow CI runners doesn't trip the 10s default. + hookTimeout: 20_000, name: packageJson.name, dir: './', watch: false, diff --git a/packages/cms-compat-wp/vitest.config.ts b/packages/cms-compat-wp/vitest.config.ts index 19f18214..fe70ec4d 100644 --- a/packages/cms-compat-wp/vitest.config.ts +++ b/packages/cms-compat-wp/vitest.config.ts @@ -4,6 +4,9 @@ import packageJson from './package.json' with { type: 'json' } export default defineConfig({ test: { testTimeout: 20_000, + // Hooks boot PGlite/seed; match testTimeout so coverage + // instrumentation on slow CI runners doesn't trip the 10s default. + hookTimeout: 20_000, name: packageJson.name, dir: './', watch: false, diff --git a/packages/cms-connect-atproto/vitest.config.ts b/packages/cms-connect-atproto/vitest.config.ts index 19f18214..fe70ec4d 100644 --- a/packages/cms-connect-atproto/vitest.config.ts +++ b/packages/cms-connect-atproto/vitest.config.ts @@ -4,6 +4,9 @@ import packageJson from './package.json' with { type: 'json' } export default defineConfig({ test: { testTimeout: 20_000, + // Hooks boot PGlite/seed; match testTimeout so coverage + // instrumentation on slow CI runners doesn't trip the 10s default. + hookTimeout: 20_000, name: packageJson.name, dir: './', watch: false, diff --git a/packages/cms-migrate-wp/vitest.config.ts b/packages/cms-migrate-wp/vitest.config.ts index 19f18214..fe70ec4d 100644 --- a/packages/cms-migrate-wp/vitest.config.ts +++ b/packages/cms-migrate-wp/vitest.config.ts @@ -4,6 +4,9 @@ import packageJson from './package.json' with { type: 'json' } export default defineConfig({ test: { testTimeout: 20_000, + // Hooks boot PGlite/seed; match testTimeout so coverage + // instrumentation on slow CI runners doesn't trip the 10s default. + hookTimeout: 20_000, name: packageJson.name, dir: './', watch: false, diff --git a/packages/cms-skills/vitest.config.ts b/packages/cms-skills/vitest.config.ts index 19f18214..fe70ec4d 100644 --- a/packages/cms-skills/vitest.config.ts +++ b/packages/cms-skills/vitest.config.ts @@ -4,6 +4,9 @@ import packageJson from './package.json' with { type: 'json' } export default defineConfig({ test: { testTimeout: 20_000, + // Hooks boot PGlite/seed; match testTimeout so coverage + // instrumentation on slow CI runners doesn't trip the 10s default. + hookTimeout: 20_000, name: packageJson.name, dir: './', watch: false, diff --git a/packages/core/vitest.config.ts b/packages/core/vitest.config.ts index 599b96df..6f49a083 100644 --- a/packages/core/vitest.config.ts +++ b/packages/core/vitest.config.ts @@ -15,6 +15,9 @@ export default defineConfig({ // import thousands of documents; the 5s default flakes out on loaded CI // runners (e.g. the minimum-Node job). Give DB-backed tests headroom. testTimeout: 20_000, + // Hooks boot PGlite/seed; match testTimeout so coverage + // instrumentation on slow CI runners doesn't trip the 10s default. + hookTimeout: 20_000, include: ['tests/**/*.test.ts', 'src/**/*.test.ts'], coverage: { provider: 'v8', diff --git a/packages/media-s3/vitest.config.ts b/packages/media-s3/vitest.config.ts index 5e4c8017..d641bc57 100644 --- a/packages/media-s3/vitest.config.ts +++ b/packages/media-s3/vitest.config.ts @@ -4,6 +4,9 @@ import packageJson from './package.json' with { type: 'json' } export default defineConfig({ test: { testTimeout: 20_000, + // Hooks boot PGlite/seed; match testTimeout so coverage + // instrumentation on slow CI runners doesn't trip the 10s default. + hookTimeout: 20_000, name: packageJson.name, dir: './', watch: false, diff --git a/packages/search-ai/vitest.config.ts b/packages/search-ai/vitest.config.ts index 5bd1392d..5f48ee8e 100644 --- a/packages/search-ai/vitest.config.ts +++ b/packages/search-ai/vitest.config.ts @@ -4,6 +4,9 @@ import packageJson from './package.json' with { type: 'json' } export default defineConfig({ test: { testTimeout: 20_000, + // Hooks boot PGlite/seed; match testTimeout so coverage + // instrumentation on slow CI runners doesn't trip the 10s default. + hookTimeout: 20_000, name: packageJson.name, environment: 'node', include: ['tests/**/*.test.{ts,tsx}'], diff --git a/packages/search-cms/vitest.config.ts b/packages/search-cms/vitest.config.ts index b32ee4a1..fdc8be97 100644 --- a/packages/search-cms/vitest.config.ts +++ b/packages/search-cms/vitest.config.ts @@ -7,6 +7,9 @@ export default defineConfig({ environment: 'node', // Integration suites boot a full CMS + PGlite; 5s flakes on loaded CI runners. testTimeout: 20_000, + // Hooks boot PGlite/seed; match testTimeout so coverage + // instrumentation on slow CI runners doesn't trip the 10s default. + hookTimeout: 20_000, include: ['tests/**/*.test.{ts,tsx}'], }, }) diff --git a/packages/search-core/vitest.config.ts b/packages/search-core/vitest.config.ts index 5bd1392d..5f48ee8e 100644 --- a/packages/search-core/vitest.config.ts +++ b/packages/search-core/vitest.config.ts @@ -4,6 +4,9 @@ import packageJson from './package.json' with { type: 'json' } export default defineConfig({ test: { testTimeout: 20_000, + // Hooks boot PGlite/seed; match testTimeout so coverage + // instrumentation on slow CI runners doesn't trip the 10s default. + hookTimeout: 20_000, name: packageJson.name, environment: 'node', include: ['tests/**/*.test.{ts,tsx}'], diff --git a/packages/search-headless/vitest.config.ts b/packages/search-headless/vitest.config.ts index 5bd1392d..5f48ee8e 100644 --- a/packages/search-headless/vitest.config.ts +++ b/packages/search-headless/vitest.config.ts @@ -4,6 +4,9 @@ import packageJson from './package.json' with { type: 'json' } export default defineConfig({ test: { testTimeout: 20_000, + // Hooks boot PGlite/seed; match testTimeout so coverage + // instrumentation on slow CI runners doesn't trip the 10s default. + hookTimeout: 20_000, name: packageJson.name, environment: 'node', include: ['tests/**/*.test.{ts,tsx}'], diff --git a/packages/search-ui-react/vitest.config.ts b/packages/search-ui-react/vitest.config.ts index c836e9da..fdbd40c4 100644 --- a/packages/search-ui-react/vitest.config.ts +++ b/packages/search-ui-react/vitest.config.ts @@ -4,6 +4,9 @@ import packageJson from './package.json' with { type: 'json' } export default defineConfig({ test: { testTimeout: 20_000, + // Hooks boot PGlite/seed; match testTimeout so coverage + // instrumentation on slow CI runners doesn't trip the 10s default. + hookTimeout: 20_000, name: packageJson.name, environment: 'happy-dom', include: ['tests/**/*.test.{ts,tsx}'], diff --git a/packages/store-postgres/vitest.config.ts b/packages/store-postgres/vitest.config.ts index 6a764cf5..5f280efe 100644 --- a/packages/store-postgres/vitest.config.ts +++ b/packages/store-postgres/vitest.config.ts @@ -4,6 +4,9 @@ import packageJson from './package.json' with { type: 'json' } export default defineConfig({ test: { testTimeout: 20_000, + // Hooks boot PGlite/seed; match testTimeout so coverage + // instrumentation on slow CI runners doesn't trip the 10s default. + hookTimeout: 20_000, name: packageJson.name, dir: './', watch: false, diff --git a/packages/ui-dom/vitest.config.ts b/packages/ui-dom/vitest.config.ts index 9b7496cb..2d610f23 100644 --- a/packages/ui-dom/vitest.config.ts +++ b/packages/ui-dom/vitest.config.ts @@ -4,6 +4,9 @@ import packageJson from './package.json' with { type: 'json' } export default defineConfig({ test: { testTimeout: 20_000, + // Hooks boot PGlite/seed; match testTimeout so coverage + // instrumentation on slow CI runners doesn't trip the 10s default. + hookTimeout: 20_000, name: packageJson.name, dir: './', watch: false, diff --git a/packages/ui-react/vitest.config.ts b/packages/ui-react/vitest.config.ts index 54e2c51d..d85fc08c 100644 --- a/packages/ui-react/vitest.config.ts +++ b/packages/ui-react/vitest.config.ts @@ -12,6 +12,9 @@ export default defineConfig({ setupFiles: ['@tanstack/cms-store-postgres/testing'], // Integration suites boot a full CMS + PGlite; 5s flakes on loaded CI runners. testTimeout: 20_000, + // Hooks boot PGlite/seed; match testTimeout so coverage + // instrumentation on slow CI runners doesn't trip the 10s default. + hookTimeout: 20_000, include: ['tests/**/*.test.{ts,tsx}'], coverage: { provider: 'v8', From 72533d6615eaa37992159dfd990b3eb3ebe67876 Mon Sep 17 00:00:00 2001 From: Jack Herrington Date: Thu, 3 Dec 2026 06:49:40 -0800 Subject: [PATCH 8/8] fix(ci): 60s test/hook timeout for engine-heavy packages (coverage headroom) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After matching hookTimeout to testTimeout, the Coverage job still flaked on a bulk-delete test ("replace deletes every missing document past the first page") at 20931ms vs the 20s testTimeout — coverage instrumentation inflates PGlite bulk ops ~3-5× on slow CI runners. Give the engine-heavy packages (core, api, store-postgres, client, cli, base) a generous 60s ceiling for both tests and hooks so the coverage run stops tripping on the heaviest cases, rather than nudging it per-test. Non-coverage test:lib runs are unaffected (ceiling only). Co-Authored-By: Claude Opus 4.8 (1M context) --- app/base/vitest.config.ts | 4 ++-- packages/api/vitest.config.ts | 4 ++-- packages/cli/vitest.config.ts | 4 ++-- packages/client/vitest.config.ts | 4 ++-- packages/core/vitest.config.ts | 4 ++-- packages/store-postgres/vitest.config.ts | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/app/base/vitest.config.ts b/app/base/vitest.config.ts index cad2ddaa..c5fe313b 100644 --- a/app/base/vitest.config.ts +++ b/app/base/vitest.config.ts @@ -12,10 +12,10 @@ export default defineConfig({ fileParallelism: false, // Tests drive the embedded PGlite engine (WASM init) and multi-step // governance flows; the 5s default flakes out on loaded CI runners. - testTimeout: 20_000, + testTimeout: 60_000, // Hooks boot PGlite/seed; match testTimeout so coverage // instrumentation on slow CI runners doesn't trip the 10s default. - hookTimeout: 20_000, + hookTimeout: 60_000, coverage: { provider: 'v8', include: ['src/**/*.ts'], diff --git a/packages/api/vitest.config.ts b/packages/api/vitest.config.ts index 6e08783c..ef765ebe 100644 --- a/packages/api/vitest.config.ts +++ b/packages/api/vitest.config.ts @@ -12,10 +12,10 @@ export default defineConfig({ setupFiles: ['@tanstack/cms-store-postgres/testing'], // DB-backed tests (embedded PGlite) flake at the 5s default on the loaded // minimum-Node runner; match cms-cli's headroom. - testTimeout: 30_000, + testTimeout: 60_000, // Hooks boot PGlite/seed; match testTimeout so coverage // instrumentation on slow CI runners doesn't trip the 10s default. - hookTimeout: 30_000, + hookTimeout: 60_000, include: ['tests/**/*.test.ts'], coverage: { provider: 'v8', diff --git a/packages/cli/vitest.config.ts b/packages/cli/vitest.config.ts index f330a3a4..c35a0f61 100644 --- a/packages/cli/vitest.config.ts +++ b/packages/cli/vitest.config.ts @@ -12,10 +12,10 @@ export default defineConfig({ setupFiles: ['@tanstack/cms-store-postgres/testing'], include: ['tests/**/*.test.ts'], // The first command cold-loads the fixture app's config through the TS loader. - testTimeout: 30_000, + testTimeout: 60_000, // Hooks boot PGlite/seed; match testTimeout so coverage // instrumentation on slow CI runners doesn't trip the 10s default. - hookTimeout: 30_000, + hookTimeout: 60_000, coverage: { provider: 'v8', thresholds: { diff --git a/packages/client/vitest.config.ts b/packages/client/vitest.config.ts index f7b245b3..d65680c7 100644 --- a/packages/client/vitest.config.ts +++ b/packages/client/vitest.config.ts @@ -3,10 +3,10 @@ import packageJson from './package.json' with { type: 'json' } export default defineConfig({ test: { - testTimeout: 20_000, + testTimeout: 60_000, // Hooks boot PGlite/seed; match testTimeout so coverage // instrumentation on slow CI runners doesn't trip the 10s default. - hookTimeout: 20_000, + hookTimeout: 60_000, name: packageJson.name, dir: './', watch: false, diff --git a/packages/core/vitest.config.ts b/packages/core/vitest.config.ts index 6f49a083..2e77dbf4 100644 --- a/packages/core/vitest.config.ts +++ b/packages/core/vitest.config.ts @@ -14,10 +14,10 @@ export default defineConfig({ // Many tests spin up the embedded PGlite engine (WASM init) and some bulk- // import thousands of documents; the 5s default flakes out on loaded CI // runners (e.g. the minimum-Node job). Give DB-backed tests headroom. - testTimeout: 20_000, + testTimeout: 60_000, // Hooks boot PGlite/seed; match testTimeout so coverage // instrumentation on slow CI runners doesn't trip the 10s default. - hookTimeout: 20_000, + hookTimeout: 60_000, include: ['tests/**/*.test.ts', 'src/**/*.test.ts'], coverage: { provider: 'v8', diff --git a/packages/store-postgres/vitest.config.ts b/packages/store-postgres/vitest.config.ts index 5f280efe..c31cf5ac 100644 --- a/packages/store-postgres/vitest.config.ts +++ b/packages/store-postgres/vitest.config.ts @@ -3,10 +3,10 @@ import packageJson from './package.json' with { type: 'json' } export default defineConfig({ test: { - testTimeout: 20_000, + testTimeout: 60_000, // Hooks boot PGlite/seed; match testTimeout so coverage // instrumentation on slow CI runners doesn't trip the 10s default. - hookTimeout: 20_000, + hookTimeout: 60_000, name: packageJson.name, dir: './', watch: false,