Beautiful, AI-native markdown IDE and LLM wiki
TypeScript 2nd-brainagent-skillsclaudecodexcompany-braindocsknowledge-knowledge-baseknowledge-managementllmllm-wikillm-wiki-karpathymarkdownmarkdown-editormdmdxnotespkmsecond-brainskills
Move the light cross-package reader tests into the uncached tier (#5107)
Nick Gomez9b573873dcfe
diff --git a/lint-plugins/no-comments/__fixtures__/must-fire.fixture.ts b/lint-plugins/no-comments/__fixtures__/must-fire.fixture.tsindex d8ac1c3f3..d033ebb31 100644--- a/lint-plugins/no-comments/__fixtures__/must-fire.fixture.ts+++ b/lint-plugins/no-comments/__fixtures__/must-fire.fixture.ts@@ -36,7 +36,8 @@ export const unreasonedLintignore = 9;// we should add here somedayexport const launderedTagAppend = 10;-export const launderedTagInline = 11;+/** long prose about the module @remarks something */+export const proseWithUnsanctionedTag = 11;/*** Architectural floor: `entity-ref-preservation`diff --git a/lint-plugins/no-comments/scope.test.mjs b/lint-plugins/no-comments/scope.test.mjsindex fc8e4cfc6..f81bad4d5 100644--- a/lint-plugins/no-comments/scope.test.mjs+++ b/lint-plugins/no-comments/scope.test.mjs@@ -78,7 +78,7 @@ describe('scope membership', () => {'packages/desktop/scripts/afterPack.mjs','packages/app/src/build/app-version.ts','packages/app/src/build/rejection-loop-guard-script.js',- 'packages/desktop/tests/unit/packaged-report-path.test.mjs',+ 'packages/desktop/tests/unit/packaged-report-path.uncached.test.mjs','packages/app/tests/perf/fixtures/cache-regime-rotation/vault.ts','packages/core/src/markdown/fixtures/index.ts','test-support/vitest.base.ts',diff --git a/package.json b/package.jsonindex d4602b408..852f2047a 100644--- a/package.json+++ b/package.json@@ -15,7 +15,7 @@"build": "turbo run build","build:desktop": "turbo run build:desktop","build:desktop:dir": "turbo run build:desktop:dir",- "check:desktop": "turbo run lint typecheck test --filter=@inkeep/open-knowledge-desktop",+ "check:desktop": "turbo run lint typecheck test --filter=@inkeep/open-knowledge-desktop && pnpm run test:uncached","check:fast": "pnpm run typecheck","check:doc-links": "pnpm --dir docs run validate-link","check:server-test-inputs": "node scripts/check-server-test-inputs.mjs",diff --git a/packages/app/package.json b/packages/app/package.jsonindex a4cda49c7..78fe4fb5a 100644--- a/packages/app/package.json+++ b/packages/app/package.json@@ -25,7 +25,7 @@"format": "biome check --write .","test": "vitest run --config vitest.config.ts src/","test:dom": "vitest run --config vitest.dom.config.ts",- "check": "tsc --noEmit && biome check . && pnpm run test && pnpm run test:dom && pnpm run test:integration && pnpm run test:conversion",+ "check": "tsc --noEmit && biome check . && pnpm run test && pnpm run test:dom && pnpm run test:integration && pnpm run test:conversion && pnpm -w run test:uncached","test:integration": "vitest run --config vitest.integration.config.ts","test:integration:shard1": "vitest run --config vitest.integration.config.ts --shard=1/3","test:integration:shard2": "vitest run --config vitest.integration.config.ts --shard=2/3",diff --git a/packages/app/src/build/app-version.test.ts b/packages/app/src/build/app-version.test.tsindex f677c9e52..75a1a64b8 100644--- a/packages/app/src/build/app-version.test.ts+++ b/packages/app/src/build/app-version.test.ts@@ -48,16 +48,3 @@ describe('injectAppVersionEnv', () => {expect(process.env[APP_VERSION_ENV_VAR]).toBe(appPkgVersion);});});--describe('build-path wiring (R-3)', () => {- const repoConfigs = [- resolve(here, '..', '..', 'vite.config.ts'),- resolve(here, '..', '..', '..', 'desktop', 'electron.vite.config.ts'),- ];- for (const configPath of repoConfigs) {- test(`${configPath.split('/packages/')[1]} calls injectAppVersionEnv()`, () => {- const src = readFileSync(configPath, 'utf-8');- expect(src).toContain('injectAppVersionEnv()');- });- }-});diff --git a/packages/app/src/build/app-version.uncached.test.ts b/packages/app/src/build/app-version.uncached.test.tsnew file mode 100644index 000000000..60264021b--- /dev/null+++ b/packages/app/src/build/app-version.uncached.test.ts@@ -0,0 +1,19 @@+import { readFileSync } from 'node:fs';+import { dirname, resolve } from 'node:path';+import { fileURLToPath } from 'node:url';+import { describe, expect, test } from 'vitest';++const here = dirname(fileURLToPath(import.meta.url));++describe('build-path wiring (R-3)', () => {+ const repoConfigs = [+ resolve(here, '..', '..', 'vite.config.ts'),+ resolve(here, '..', '..', '..', 'desktop', 'electron.vite.config.ts'),+ ];+ for (const configPath of repoConfigs) {+ test(`${configPath.split('/packages/')[1]} calls injectAppVersionEnv()`, () => {+ const src = readFileSync(configPath, 'utf-8');+ expect(src).toContain('injectAppVersionEnv()');+ });+ }+});diff --git a/packages/app/src/globals.css b/packages/app/src/globals.cssindex bd765a9dc..cc8974fb6 100644--- a/packages/app/src/globals.css+++ b/packages/app/src/globals.css@@ -3399,7 +3399,7 @@ button:active:not(:disabled) {contrast-gated against the respective --background. These tokens areinjected into every preview iframe via the generated PREVIEW_THEME_TOKENSconstant; the .dark block below MUST stay in sync — drift between these- blocks and the constant is caught by preview-theme-tokens.test.ts. */+ blocks and the constant is caught by preview-theme-tokens.uncached.test.ts. */--chart-1: oklch(0.62 0.19 259);--chart-2: oklch(0.58 0.14 145);--chart-3: oklch(0.62 0.15 70);@@ -3523,7 +3523,7 @@ button:active:not(:disabled) {--ok-comment-hue: rgb(96 165 250);/* Dark-mode chart palette — same hue family as the :root block above,lightness lifted for legibility on the dark --background. Keep in sync- with :root --chart-* and PREVIEW_THEME_TOKENS (preview-theme-tokens.test.ts). */+ with :root --chart-* and PREVIEW_THEME_TOKENS (preview-theme-tokens.uncached.test.ts). */--chart-1: oklch(0.72 0.14 259);--chart-2: oklch(0.73 0.13 145);--chart-3: oklch(0.77 0.14 70);diff --git a/packages/app/src/lib/command-menu-parity.test.ts b/packages/app/src/lib/command-menu-parity.uncached.test.tssimilarity index 100%rename from packages/app/src/lib/command-menu-parity.test.tsrename to packages/app/src/lib/command-menu-parity.uncached.test.tsdiff --git a/packages/app/tests/integration/composition-sweep-index.test.ts b/packages/app/tests/integration/composition-sweep-index.test.tsindex 1f522d66d..17f259581 100644--- a/packages/app/tests/integration/composition-sweep-index.test.ts+++ b/packages/app/tests/integration/composition-sweep-index.test.ts@@ -1,280 +1,7 @@-import { readFileSync } from 'node:fs';-import { dirname, resolve } from 'node:path';-import { fileURLToPath } from 'node:url';-import { ConfigSchema } from '@inkeep/open-knowledge-core';import { describe, expect, test } from 'vitest';-const HERE = dirname(fileURLToPath(import.meta.url));-const PACKAGES = resolve(HERE, '../../..');--type Rung = 'booted-server' | 'real-drain-rig' | 'client-rig' | 'desktop-unit';--interface CompositionRow {- readonly mechanism: string;- readonly file: string;- readonly title: string;- readonly rung: Rung;- readonly residual?: string;-}--const SHIPPED_MECHANISMS = [- 'defer-guard',- 'defer-exhaustion',- 'loss-detector',- 'paired-intake-detect',- 'fixed-point-backstop',- 'loss-capture-ring',- 'checkpoint-restore-floor',- 'durable-replay-outbox',- 'flush-on-hide',- 'desktop-background-throttle',- 'pre-drain',-] as const;--const COMPOSITION_ROWS: readonly CompositionRow[] = [- {- mechanism: 'defer-guard',- file: 'app/tests/integration/derive-timing-guard-full-flow.test.ts',- title: 'the config-wired guard preserves an un-propagated keystroke on the real server',- rung: 'booted-server',- },- {- mechanism: 'defer-exhaustion',- file: 'server/src/derive-timing-exhaustion.test.ts',- title: 'sustained deferral preserves the keystroke until the guard force-resolves loudly',- rung: 'real-drain-rig',- residual:- '§9.5(1): the sustained-defer exhaustion trigger is not stageable through a pure public HTTP path.',- },- {- mechanism: 'loss-detector',- file: 'app/tests/integration/bridge-loss-injection.test.ts',- title: 'agent-write overwrite of un-propagated content trips the detector and checkpoints',- rung: 'booted-server',- },- {- mechanism: 'paired-intake-detect',- file: 'app/tests/integration/bridge-loss-injection.test.ts',- title: 'an out-of-band disk edit over un-propagated content trips the detector and checkpoints',- rung: 'booted-server',- },- {- mechanism: 'fixed-point-backstop',- file: 'server/src/derive-fixed-point-backstop.test.ts',- title:- 'typing during a freeze persists — the user-edit path and Y.Text stay live while the B loop is frozen',- rung: 'real-drain-rig',- residual:- '§9.5(1): the backstop echo/oscillation topology is not reachable at the public rung; the real production drain is its rung.',- },- {- mechanism: 'loss-capture-ring',- file: 'app/tests/integration/loss-capture-killswitch.test.ts',- title: 'ON (default): a defer lands a content-free guard-defer event in the ring',- rung: 'booted-server',- },- {- mechanism: 'checkpoint-restore-floor',- file: 'app/tests/integration/silent-checkpoint-restore.test.ts',- title: 'a silent extension-less checkpoint surfaces in history, reads back, and restores',- rung: 'booted-server',- },- {- mechanism: 'durable-replay-outbox',- file: 'app/tests/integration/replay-outbox-durable.test.ts',- title:- 'unsynced edit survives the same-tab recycle and its durable outbox is written then consumed',- rung: 'client-rig',- residual:- 'The client ProviderPool recycle path has no server-side public surface; the composition rung is the real client pool + a restartable server.',- },- {- mechanism: 'flush-on-hide',- file: 'app/tests/integration/editor-lifecycle-flush.test.ts',- title: 'force-sync flush lands a pending delta on the SERVER (IDB-only would not)',- rung: 'booted-server',- },- {- mechanism: 'desktop-background-throttle',- file: 'desktop/src/main/background-throttle.test.ts',- title: 'keeps timers alive (setBackgroundThrottling false) when work is pending and enabled',- rung: 'desktop-unit',- residual:- '§9.5(3): Electron main-process mechanism — the behavioral observable rides the required desktop-smoke CI tier, which contains no throttle test today; only the keying predicate is merge-gated here.',- },- {- mechanism: 'pre-drain',- file: 'app/tests/integration/pre-drain-composition.test.ts',- title: 'cross-block keystroke survives a paired derive while a client reconnects and resyncs',- rung: 'booted-server',- },-];--const KILL_SWITCH_MECHANISM: Readonly<Record<string, string>> = {- lossCapture: 'loss-capture-ring',- 'bridge.backgroundThrottle': 'desktop-background-throttle',- 'bridge.deferGuard': 'defer-guard',- 'bridge.lossDetector': 'loss-detector',- 'bridge.fixedPoint': 'fixed-point-backstop',- 'bridge.preDrain': 'pre-drain',- 'bridge.flushOnHide': 'flush-on-hide',-};--interface ZodLike {- shape?: Record<string, ZodLike>;- def?: { innerType?: ZodLike };-}--function objectShape(node: ZodLike | undefined): Record<string, ZodLike> | undefined {- let cur = node;- for (let i = 0; cur && i < 8; i++) {- if (cur.shape) return cur.shape;- cur = cur.def?.innerType;- }- return undefined;-}--function shippedKillSwitchPaths(): string[] {- const root = objectShape(ConfigSchema as unknown as ZodLike) ?? {};- const paths: string[] = [];- if (root.lossCapture) paths.push('lossCapture');- for (const key of Object.keys(objectShape(root.bridge) ?? {})) paths.push(`bridge.${key}`);- return paths.sort();-}--function uncoveredMechanisms(- shipped: readonly string[],- rows: readonly { readonly mechanism: string }[],-): string[] {- const covered = new Set(rows.map((r) => r.mechanism));- return shipped.filter((m) => !covered.has(m));-}--function staleRows(- shipped: readonly string[],- rows: readonly { readonly mechanism: string }[],-): string[] {- const live = new Set(shipped);- return rows.map((r) => r.mechanism).filter((m) => !live.has(m));-}--interface ResolvedCompositionTest {- declared: boolean;- disabled: boolean;- assertions: number;-}--function stripCommentLines(text: string): string {- return text- .split('\n')- .filter((line) => {- const t = line.trimStart();- return !(t.startsWith('*') || t.startsWith('//') || t.startsWith('/*') || t.startsWith('*/'));- })- .join('\n');-}--function resolveCompositionTest(pkgRelPath: string, title: string): ResolvedCompositionTest {- return resolveCompositionTestSource(readFileSync(resolve(PACKAGES, pkgRelPath), 'utf-8'), title);-}--function resolveCompositionTestSource(source: string, title: string): ResolvedCompositionTest {- const src = stripCommentLines(source);- const decl = /(?<![.\w])(?:test|it)((?:\.\w+)*)\s*\(\s*(['"`])([\s\S]*?)\2/g;- const declarations: Array<{ modifiers: string; title: string; end: number }> = [];- for (const m of src.matchAll(decl)) {- declarations.push({- modifiers: m[1] ?? '',- title: (m[3] ?? '').replace(/\s+/g, ' ').trim(),- end: (m.index ?? 0) + m[0].length,- });- }- const needle = title.replace(/\s+/g, ' ').trim();- const hitIndex = declarations.findIndex((d) => d.title.includes(needle));- if (hitIndex === -1) return { declared: false, disabled: false, assertions: 0 };- const hit = declarations[hitIndex] as (typeof declarations)[number];- const next = declarations[hitIndex + 1];- const body = src.slice(hit.end, next ? next.end : src.length);- return {- declared: true,- disabled: /\.(skip|todo|fails|skipIf)\b/.test(hit.modifiers),- assertions: (body.match(/\bexpect\s*\(/g) ?? []).length,- };-}-describe('composition sweep index (H13)', () => {- test('every shipped mechanism has a composition row (fail-closed) and no rows are stale', () => {- const shipped = [...SHIPPED_MECHANISMS].sort();- expect(uncoveredMechanisms(shipped, COMPOSITION_ROWS)).toEqual([]);- expect(staleRows(shipped, COMPOSITION_ROWS)).toEqual([]);- });-- test('every kill-switch in the production config schema maps to a covered mechanism', () => {- const paths = shippedKillSwitchPaths();- expect(paths.length).toBeGreaterThanOrEqual(7);-- const unregistered = paths.filter((p) => KILL_SWITCH_MECHANISM[p] === undefined);- expect(unregistered).toEqual([]);-- const mechanisms = paths.map((p) => KILL_SWITCH_MECHANISM[p] as string);- expect(mechanisms.filter((m) => !SHIPPED_MECHANISMS.includes(m as never))).toEqual([]);- expect(uncoveredMechanisms(mechanisms, COMPOSITION_ROWS)).toEqual([]);-- const live = new Set(paths);- expect(Object.keys(KILL_SWITCH_MECHANISM).filter((p) => !live.has(p))).toEqual([]);- });-- test.each(COMPOSITION_ROWS)('$mechanism ($rung) has a registered composition test', (row) => {- const resolved = resolveCompositionTest(row.file, row.title);- expect(resolved.declared).toBe(true);- expect(resolved.disabled).toBe(false);- expect(resolved.assertions).toBeGreaterThan(0);- if (row.rung !== 'booted-server') {- expect(row.residual && row.residual.length > 0).toBe(true);- }- });-- test('the typing-during-freeze-persists row is present', () => {- const freeze = COMPOSITION_ROWS.find((r) => r.mechanism === 'fixed-point-backstop');- expect(freeze).toBeDefined();- if (!freeze) return;- expect(freeze.title).toContain('typing during a freeze persists');- const resolved = resolveCompositionTest(freeze.file, freeze.title);- expect(resolved.declared).toBe(true);- expect(resolved.disabled).toBe(false);- expect(resolved.assertions).toBeGreaterThan(0);- });-- test('the sweep bites: an uncovered mechanism, a stale row, a bogus title, and a disabled test', () => {- const withNewMechanism = [...SHIPPED_MECHANISMS, '__planted_uncovered_mechanism__'];- expect(uncoveredMechanisms(withNewMechanism, COMPOSITION_ROWS)).toEqual([- '__planted_uncovered_mechanism__',- ]);- expect(- staleRows(SHIPPED_MECHANISMS, [...COMPOSITION_ROWS, { mechanism: '__planted_stale_row__' }]),- ).toEqual(['__planted_stale_row__']);-- const firstRow = COMPOSITION_ROWS[0] as (typeof COMPOSITION_ROWS)[number];- expect(- resolveCompositionTest(firstRow.file, '__this composition title does not exist__').declared,- ).toBe(false);-- const self = 'app/tests/integration/composition-sweep-index.test.ts';- expect(resolveCompositionTest(self, 'planted disabled composition fixture')).toMatchObject({- declared: true,- disabled: true,- });- });-test.skip('planted disabled composition fixture', () => {expect(true).toBe(true);});- test('planted assertion-free composition fixture', () => {- const source = 'test("assertion-free", () => {});';- expect(resolveCompositionTestSource(source, 'assertion-free')).toEqual({- declared: true,- disabled: false,- assertions: 0,- });- });});diff --git a/packages/app/tests/integration/composition-sweep-index.uncached.test.ts b/packages/app/tests/integration/composition-sweep-index.uncached.test.tsnew file mode 100644index 000000000..91df56c47--- /dev/null+++ b/packages/app/tests/integration/composition-sweep-index.uncached.test.ts@@ -0,0 +1,279 @@+import { readFileSync } from 'node:fs';+import { dirname, resolve } from 'node:path';+import { fileURLToPath } from 'node:url';+import { ConfigSchema } from '@inkeep/open-knowledge-core';+import { describe, expect, test } from 'vitest';++const HERE = dirname(fileURLToPath(import.meta.url));+const PACKAGES = resolve(HERE, '../../..');++type Rung = 'booted-server' | 'real-drain-rig' | 'client-rig' | 'desktop-unit';++interface CompositionRow {+ readonly mechanism: string;+ readonly file: string;+ readonly title: string;+ readonly rung: Rung;+ readonly residual?: string;+}++const SHIPPED_MECHANISMS = [+ 'defer-guard',+ 'defer-exhaustion',+ 'loss-detector',+ 'paired-intake-detect',+ 'fixed-point-backstop',+ 'loss-capture-ring',+ 'checkpoint-restore-floor',+ 'durable-replay-outbox',+ 'flush-on-hide',+ 'desktop-background-throttle',+ 'pre-drain',+] as const;++const COMPOSITION_ROWS: readonly CompositionRow[] = [+ {+ mechanism: 'defer-guard',+ file: 'app/tests/integration/derive-timing-guard-full-flow.test.ts',+ title: 'the config-wired guard preserves an un-propagated keystroke on the real server',+ rung: 'booted-server',+ },+ {+ mechanism: 'defer-exhaustion',+ file: 'server/src/derive-timing-exhaustion.test.ts',+ title: 'sustained deferral preserves the keystroke until the guard force-resolves loudly',+ rung: 'real-drain-rig',+ residual:+ '§9.5(1): the sustained-defer exhaustion trigger is not stageable through a pure public HTTP path.',+ },+ {+ mechanism: 'loss-detector',+ file: 'app/tests/integration/bridge-loss-injection.test.ts',+ title: 'agent-write overwrite of un-propagated content trips the detector and checkpoints',+ rung: 'booted-server',+ },+ {+ mechanism: 'paired-intake-detect',+ file: 'app/tests/integration/bridge-loss-injection.test.ts',+ title: 'an out-of-band disk edit over un-propagated content trips the detector and checkpoints',+ rung: 'booted-server',+ },+ {+ mechanism: 'fixed-point-backstop',+ file: 'server/src/derive-fixed-point-backstop.test.ts',+ title:+ 'typing during a freeze persists — the user-edit path and Y.Text stay live while the B loop is frozen',+ rung: 'real-drain-rig',+ residual:+ '§9.5(1): the backstop echo/oscillation topology is not reachable at the public rung; the real production drain is its rung.',+ },+ {+ mechanism: 'loss-capture-ring',+ file: 'app/tests/integration/loss-capture-killswitch.test.ts',+ title: 'ON (default): a defer lands a content-free guard-defer event in the ring',+ rung: 'booted-server',+ },+ {+ mechanism: 'checkpoint-restore-floor',+ file: 'app/tests/integration/silent-checkpoint-restore.test.ts',+ title: 'a silent extension-less checkpoint surfaces in history, reads back, and restores',+ rung: 'booted-server',+ },+ {+ mechanism: 'durable-replay-outbox',+ file: 'app/tests/integration/replay-outbox-durable.test.ts',+ title:+ 'unsynced edit survives the same-tab recycle and its durable outbox is written then consumed',+ rung: 'client-rig',+ residual:+ 'The client ProviderPool recycle path has no server-side public surface; the composition rung is the real client pool + a restartable server.',+ },+ {+ mechanism: 'flush-on-hide',+ file: 'app/tests/integration/editor-lifecycle-flush.test.ts',+ title: 'force-sync flush lands a pending delta on the SERVER (IDB-only would not)',+ rung: 'booted-server',+ },+ {+ mechanism: 'desktop-background-throttle',+ file: 'desktop/src/main/background-throttle.test.ts',+ title: 'keeps timers alive (setBackgroundThrottling false) when work is pending and enabled',+ rung: 'desktop-unit',+ residual:+ '§9.5(3): Electron main-process mechanism — the behavioral observable rides the required desktop-smoke CI tier, which contains no throttle test today; only the keying predicate is merge-gated here.',+ },+ {+ mechanism: 'pre-drain',+ file: 'app/tests/integration/pre-drain-composition.test.ts',+ title: 'cross-block keystroke survives a paired derive while a client reconnects and resyncs',+ rung: 'booted-server',+ },+];++const KILL_SWITCH_MECHANISM: Readonly<Record<string, string>> = {+ lossCapture: 'loss-capture-ring',+ 'bridge.backgroundThrottle': 'desktop-background-throttle',+ 'bridge.deferGuard': 'defer-guard',+ 'bridge.lossDetector': 'loss-detector',+ 'bridge.fixedPoint': 'fixed-point-backstop',+ 'bridge.preDrain': 'pre-drain',+ 'bridge.flushOnHide': 'flush-on-hide',+};++interface ZodLike {+ shape?: Record<string, ZodLike>;+ def?: { innerType?: ZodLike };+}++function objectShape(node: ZodLike | undefined): Record<string, ZodLike> | undefined {+ let cur = node;+ for (let i = 0; cur && i < 8; i++) {+ if (cur.shape) return cur.shape;+ cur = cur.def?.innerType;+ }+ return undefined;+}++function shippedKillSwitchPaths(): string[] {+ const root = objectShape(ConfigSchema as unknown as ZodLike) ?? {};+ const paths: string[] = [];+ if (root.lossCapture) paths.push('lossCapture');+ for (const key of Object.keys(objectShape(root.bridge) ?? {})) paths.push(`bridge.${key}`);+ return paths.sort();+}++function uncoveredMechanisms(+ shipped: readonly string[],+ rows: readonly { readonly mechanism: string }[],+): string[] {+ const covered = new Set(rows.map((r) => r.mechanism));+ return shipped.filter((m) => !covered.has(m));+}++function staleRows(+ shipped: readonly string[],+ rows: readonly { readonly mechanism: string }[],+): string[] {+ const live = new Set(shipped);+ return rows.map((r) => r.mechanism).filter((m) => !live.has(m));+}++interface ResolvedCompositionTest {+ declared: boolean;+ disabled: boolean;+ assertions: number;+}++function stripCommentLines(text: string): string {+ return text+ .split('\n')+ .filter((line) => {+ const t = line.trimStart();+ return !(t.startsWith('*') || t.startsWith('//') || t.startsWith('/*') || t.startsWith('*/'));+ })+ .join('\n');+}++function resolveCompositionTest(pkgRelPath: string, title: string): ResolvedCompositionTest {+ return resolveCompositionTestSource(readFileSync(resolve(PACKAGES, pkgRelPath), 'utf-8'), title);+}++function resolveCompositionTestSource(source: string, title: string): ResolvedCompositionTest {+ const src = stripCommentLines(source);+ const decl = /(?<![.\w])(?:test|it)((?:\.\w+)*)\s*\(\s*(['"`])([\s\S]*?)\2/g;+ const declarations: Array<{ modifiers: string; title: string; end: number }> = [];+ for (const m of src.matchAll(decl)) {+ declarations.push({+ modifiers: m[1] ?? '',+ title: (m[3] ?? '').replace(/\s+/g, ' ').trim(),+ end: (m.index ?? 0) + m[0].length,+ });+ }+ const needle = title.replace(/\s+/g, ' ').trim();+ const hitIndex = declarations.findIndex((d) => d.title.includes(needle));+ if (hitIndex === -1) return { declared: false, disabled: false, assertions: 0 };+ const hit = declarations[hitIndex] as (typeof declarations)[number];+ const next = declarations[hitIndex + 1];+ const body = src.slice(hit.end, next ? next.end : src.length);+ return {+ declared: true,+ disabled: /\.(skip|todo|fails|skipIf)\b/.test(hit.modifiers),+ assertions: (body.match(/\bexpect\s*\(/g) ?? []).length,+ };+}++describe('composition sweep index (H13)', () => {+ test('every shipped mechanism has a composition row (fail-closed) and no rows are stale', () => {+ const shipped = [...SHIPPED_MECHANISMS].sort();+ expect(uncoveredMechanisms(shipped, COMPOSITION_ROWS)).toEqual([]);+ expect(staleRows(shipped, COMPOSITION_ROWS)).toEqual([]);+ });++ test('every kill-switch in the production config schema maps to a covered mechanism', () => {+ const paths = shippedKillSwitchPaths();+ expect(paths.length).toBeGreaterThanOrEqual(7);++ const unregistered = paths.filter((p) => KILL_SWITCH_MECHANISM[p] === undefined);+ expect(unregistered).toEqual([]);++ const mechanisms = paths.map((p) => KILL_SWITCH_MECHANISM[p] as string);+ expect(mechanisms.filter((m) => !SHIPPED_MECHANISMS.includes(m as never))).toEqual([]);+ expect(uncoveredMechanisms(mechanisms, COMPOSITION_ROWS)).toEqual([]);++ const live = new Set(paths);+ expect(Object.keys(KILL_SWITCH_MECHANISM).filter((p) => !live.has(p))).toEqual([]);+ });++ test.each(COMPOSITION_ROWS)('$mechanism ($rung) has a registered composition test', (row) => {+ const resolved = resolveCompositionTest(row.file, row.title);+ expect(resolved.declared).toBe(true);+ expect(resolved.disabled).toBe(false);+ expect(resolved.assertions).toBeGreaterThan(0);+ if (row.rung !== 'booted-server') {+ expect(row.residual && row.residual.length > 0).toBe(true);+ }+ });++ test('the typing-during-freeze-persists row is present', () => {+ const freeze = COMPOSITION_ROWS.find((r) => r.mechanism === 'fixed-point-backstop');+ expect(freeze).toBeDefined();+ if (!freeze) return;+ expect(freeze.title).toContain('typing during a freeze persists');+ const resolved = resolveCompositionTest(freeze.file, freeze.title);+ expect(resolved.declared).toBe(true);+ expect(resolved.disabled).toBe(false);+ expect(resolved.assertions).toBeGreaterThan(0);+ });++ test('the sweep bites: an uncovered mechanism, a stale row, a bogus title, and a disabled test', () => {+ const withNewMechanism = [...SHIPPED_MECHANISMS, '__planted_uncovered_mechanism__'];+ expect(uncoveredMechanisms(withNewMechanism, COMPOSITION_ROWS)).toEqual([+ '__planted_uncovered_mechanism__',+ ]);+ expect(+ staleRows(SHIPPED_MECHANISMS, [...COMPOSITION_ROWS, { mechanism: '__planted_stale_row__' }]),+ ).toEqual(['__planted_stale_row__']);++ const firstRow = COMPOSITION_ROWS[0] as (typeof COMPOSITION_ROWS)[number];+ expect(+ resolveCompositionTest(firstRow.file, '__this composition title does not exist__').declared,+ ).toBe(false);++ const plantedFixtureFile = 'app/tests/integration/composition-sweep-index.test.ts';+ expect(+ resolveCompositionTest(plantedFixtureFile, 'planted disabled composition fixture'),+ ).toMatchObject({+ declared: true,+ disabled: true,+ });+ });++ test('planted assertion-free composition fixture', () => {+ const source = 'test("assertion-free", () => {});';+ expect(resolveCompositionTestSource(source, 'assertion-free')).toEqual({+ declared: true,+ disabled: false,+ assertions: 0,+ });+ });+});diff --git a/packages/app/tests/integration/ipc-log-coverage.test.ts b/packages/app/tests/integration/ipc-log-coverage.uncached.test.tssimilarity index 100%rename from packages/app/tests/integration/ipc-log-coverage.test.tsrename to packages/app/tests/integration/ipc-log-coverage.uncached.test.tsdiff --git a/packages/app/tests/integration/kill-switch-sweep.test.ts b/packages/app/tests/integration/kill-switch-sweep.uncached.test.tssimilarity index 100%rename from packages/app/tests/integration/kill-switch-sweep.test.tsrename to packages/app/tests/integration/kill-switch-sweep.uncached.test.tsdiff --git a/packages/app/tests/integration/origin-undoability-sweep.test.ts b/packages/app/tests/integration/origin-undoability-sweep.uncached.test.tssimilarity index 100%rename from packages/app/tests/integration/origin-undoability-sweep.test.tsrename to packages/app/tests/integration/origin-undoability-sweep.uncached.test.tsdiff --git a/packages/app/tests/integration/structural-freshness-real-docs.test.ts b/packages/app/tests/integration/structural-freshness-real-docs.uncached.test.tssimilarity index 100%rename from packages/app/tests/integration/structural-freshness-real-docs.test.tsrename to packages/app/tests/integration/structural-freshness-real-docs.uncached.test.tsdiff --git a/packages/app/tests/integration/vite-dedupe-parity.test.ts b/packages/app/tests/integration/vite-dedupe-parity.uncached.test.tssimilarity index 100%rename from packages/app/tests/integration/vite-dedupe-parity.test.tsrename to packages/app/tests/integration/vite-dedupe-parity.uncached.test.tsdiff --git a/packages/app/tests/lint-plugins/no-comments.test.ts b/packages/app/tests/lint-plugins/no-comments.uncached.test.tssimilarity index 100%rename from packages/app/tests/lint-plugins/no-comments.test.tsrename to packages/app/tests/lint-plugins/no-comments.uncached.test.tsdiff --git a/packages/app/tests/meta/i18n-freshness-gate-wiring.test.ts b/packages/app/tests/meta/i18n-freshness-gate-wiring.uncached.test.tssimilarity index 100%rename from packages/app/tests/meta/i18n-freshness-gate-wiring.test.tsrename to packages/app/tests/meta/i18n-freshness-gate-wiring.uncached.test.tsdiff --git a/packages/app/tests/meta/showok-caller-coverage.test.ts b/packages/app/tests/meta/showok-caller-coverage.uncached.test.tssimilarity index 100%rename from packages/app/tests/meta/showok-caller-coverage.test.tsrename to packages/app/tests/meta/showok-caller-coverage.uncached.test.tsdiff --git a/packages/app/tests/meta/substrate-vocabulary-drift.test.ts b/packages/app/tests/meta/substrate-vocabulary-drift.uncached.test.tssimilarity index 96%rename from packages/app/tests/meta/substrate-vocabulary-drift.test.tsrename to packages/app/tests/meta/substrate-vocabulary-drift.uncached.test.tsindex 27b00029b..262906395 100644--- a/packages/app/tests/meta/substrate-vocabulary-drift.test.ts+++ b/packages/app/tests/meta/substrate-vocabulary-drift.uncached.test.ts@@ -14,7 +14,7 @@ const ROOTS = [join(PACKAGES_ROOT, pkg, 'tests'),]),];-const SELF_FILE = resolve(import.meta.dirname, 'substrate-vocabulary-drift.test.ts');+const SELF_FILE = resolve(import.meta.dirname, 'substrate-vocabulary-drift.uncached.test.ts');const TEST_FIXTURE_KNOWN_NONREGISTERED: Record<string, string> = {mermaid:@@ -86,7 +86,7 @@ describe('substrate vocabulary drift — every test reference must resolve', ()` - ${v.file}:${v.line} references data-component-type="${v.name}" — not registered. ` +`Resolution: (a) update the test reference to a registered substrate name; ` +`(b) add "${v.name}" to TEST_FIXTURE_KNOWN_NONREGISTERED in ` +- `tests/meta/substrate-vocabulary-drift.test.ts with a comment naming the production source.`,+ `tests/meta/substrate-vocabulary-drift.uncached.test.ts with a comment naming the production source.`,);throw new Error(`Substrate-vocabulary drift detected (${violations.length} reference${diff --git a/packages/app/tests/meta/syncscope-caller-coverage.test.ts b/packages/app/tests/meta/syncscope-caller-coverage.uncached.test.tssimilarity index 100%rename from packages/app/tests/meta/syncscope-caller-coverage.test.tsrename to packages/app/tests/meta/syncscope-caller-coverage.uncached.test.tsdiff --git a/packages/cli/scripts/check-published-dts.test.ts b/packages/cli/scripts/check-published-dts.test.tsindex b4dea423a..a59661b25 100644--- a/packages/cli/scripts/check-published-dts.test.ts+++ b/packages/cli/scripts/check-published-dts.test.ts@@ -1,5 +1,5 @@import { spawnSync } from 'node:child_process';-import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';+import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs';import { tmpdir } from 'node:os';import { dirname, join } from 'node:path';import { fileURLToPath } from 'node:url';@@ -538,35 +538,6 @@ describe('the pass condition main() routes through', () => {});});-describe('the ceilings, the fingerprint and the token stream stay one number', () => {- const evidence = join(- import.meta.dirname,- '../../../specs/2026-09-02-typescript-7-toolchain-upgrade/evidence/dts-baseline-5.9.3',- );- const tokensPath = join(evidence, 'index.tokens.txt');- const specsRoot = join(import.meta.dirname, '../../../specs');-- it.skipIf(!existsSync(specsRoot))(- 'derives both ceilings from the committed 5.9.3 token stream',- () => {- expect(- existsSync(tokensPath),- `${tokensPath} is gone, so nothing ties anyCeiling/unknownCeiling to a capture`,- ).toBe(true);- const tokens = readFileSync(tokensPath, 'utf8').split('\n');- const count = (word: string) => tokens.filter((token) => token === word).length;- const fingerprint = JSON.parse(- readFileSync(join(evidence, 'index.fingerprint.json'), 'utf8'),- ) as Record<string, number>;-- expect(count('any')).toBe(BASELINE.anyCeiling);- expect(count('unknown')).toBe(BASELINE.unknownCeiling);- expect(fingerprint.any_tokens).toBe(BASELINE.anyCeiling);- expect(fingerprint.unknown_tokens).toBe(BASELINE.unknownCeiling);- },- );-});-describe('checkProjectFences', () => {const sound = {compilerOptions: { skipLibCheck: false, customConditions: [] },diff --git a/packages/cli/src/integrations/desktop-state.test.ts b/packages/cli/src/integrations/desktop-state.test.tsindex 5805d9dda..c4d4fb87e 100644--- a/packages/cli/src/integrations/desktop-state.test.ts+++ b/packages/cli/src/integrations/desktop-state.test.ts@@ -1,4 +1,4 @@-import { mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';+import { mkdtempSync, rmSync, writeFileSync } from 'node:fs';import { tmpdir } from 'node:os';import { join } from 'node:path';import { describe, expect, test } from 'vitest';@@ -58,15 +58,6 @@ describe('desktopUserDataDir', () => {});describe('desktopUpdaterCacheDir', () => {- test('keeps the cache basename derived from the desktop package name', () => {- const desktopPackage = JSON.parse(- readFileSync(new URL('../../../desktop/package.json', import.meta.url), 'utf8'),- ) as { name: string };- const generatedName = `${desktopPackage.name.replace(/[/?<>\\:*|"]/g, '').toLowerCase()}-updater`;-- expect(DESKTOP_UPDATER_CACHE_DIR_NAME).toBe(generatedName);- });-test('matches electron-updater cache paths per platform', () => {expect(desktopUpdaterCacheDir({ home: '/Users/x', platformName: 'darwin', env: {} })).toBe(`/Users/x/Library/Caches/${DESKTOP_UPDATER_CACHE_DIR_NAME}`,diff --git a/packages/cli/src/integrations/desktop-state.uncached.test.ts b/packages/cli/src/integrations/desktop-state.uncached.test.tsnew file mode 100644index 000000000..a68981909--- /dev/null+++ b/packages/cli/src/integrations/desktop-state.uncached.test.ts@@ -0,0 +1,14 @@+import { readFileSync } from 'node:fs';+import { describe, expect, test } from 'vitest';+import { DESKTOP_UPDATER_CACHE_DIR_NAME } from './desktop-state.ts';++describe('desktopUpdaterCacheDir', () => {+ test('keeps the cache basename derived from the desktop package name', () => {+ const desktopPackage = JSON.parse(+ readFileSync(new URL('../../../desktop/package.json', import.meta.url), 'utf8'),+ ) as { name: string };+ const generatedName = `${desktopPackage.name.replace(/[/?<>\\:*|"]/g, '').toLowerCase()}-updater`;++ expect(DESKTOP_UPDATER_CACHE_DIR_NAME).toBe(generatedName);+ });+});diff --git a/packages/core/scripts/chrome-resolver.ts b/packages/core/scripts/chrome-resolver.tsindex 64ded7751..f6f2a8911 100644--- a/packages/core/scripts/chrome-resolver.ts+++ b/packages/core/scripts/chrome-resolver.ts@@ -8,7 +8,7 @@* build time by `packages/app/src/build/chrome-tokens-vite-plugin.ts`)** Drift between the parsed CSS and the committed `chrome.ts` constants is- * caught by `packages/core/src/constants/chrome.test.ts`.+ * caught by `packages/core/src/constants/chrome.uncached.test.ts`.** Node-only — uses `node:fs` and the `culori` colorspace converter.*/@@ -122,7 +122,7 @@ export function renderChromeConstantsModule(tokens: ChromeTokens): string {* Chrome background sRGB hex constants. Regenerated by* \`packages/core/scripts/generate-chrome-tokens.ts\` from the* \`--sidebar\` Tailwind token in \`packages/app/src/globals.css\`. Drift- * between this file and the CSS is caught by \`chrome.test.ts\`.+ * between this file and the CSS is caught by \`chrome.uncached.test.ts\`.** Consumers:* - \`packages/app/index.html\` inline <style> (Vite plugin substitutesdiff --git a/packages/core/scripts/generate-chrome-tokens.ts b/packages/core/scripts/generate-chrome-tokens.tsindex f86a9e924..f7f444758 100644--- a/packages/core/scripts/generate-chrome-tokens.ts+++ b/packages/core/scripts/generate-chrome-tokens.ts@@ -7,7 +7,7 @@** After running, diff the output — landing it should only flip values when* `--sidebar` itself moved. The drift test in- * `packages/core/src/constants/chrome.test.ts` enforces parity at CI time.+ * `packages/core/src/constants/chrome.uncached.test.ts` enforces parity at CI time.*/import { writeFileSync } from 'node:fs';import { dirname, resolve } from 'node:path';diff --git a/packages/core/scripts/generate-preview-theme-tokens.ts b/packages/core/scripts/generate-preview-theme-tokens.tsindex 11e8d8cca..5e19b3fca 100644--- a/packages/core/scripts/generate-preview-theme-tokens.ts+++ b/packages/core/scripts/generate-preview-theme-tokens.ts@@ -7,7 +7,7 @@** After running, diff the output — landing it should only flip values when a* listed token in `globals.css` actually moved. The drift test in- * `packages/core/src/constants/preview-theme-tokens.test.ts` enforces parity+ * `packages/core/src/constants/preview-theme-tokens.uncached.test.ts` enforces parity* at CI time (no separate `--check` mode needed — the unit test is the gate).*/import { writeFileSync } from 'node:fs';diff --git a/packages/core/scripts/preview-theme-token-resolver.ts b/packages/core/scripts/preview-theme-token-resolver.tsindex 21ef6f28c..1e392b60f 100644--- a/packages/core/scripts/preview-theme-token-resolver.ts+++ b/packages/core/scripts/preview-theme-token-resolver.ts@@ -14,7 +14,7 @@* `scripts/generate-preview-theme-tokens.ts`)** Drift between the parsed CSS and the committed constant is caught by- * `packages/core/src/constants/preview-theme-tokens.test.ts`.+ * `packages/core/src/constants/preview-theme-tokens.uncached.test.ts`.** Node-only — uses `node:fs` and the `culori` colorspace library. Mirrors the* sibling `chrome-resolver.ts` and reuses its exact-match block scanner.@@ -183,7 +183,7 @@ export function renderPreviewThemeTokensModule(tokens: ResolvedPreviewToken[]):* pnpm exec tsx packages/core/scripts/generate-preview-theme-tokens.ts** Drift between this file and the CSS is caught by- * \`preview-theme-tokens.test.ts\` (re-resolves from globals.css).+ * \`preview-theme-tokens.uncached.test.ts\` (re-resolves from globals.css).*/export interface PreviewThemeToken {diff --git a/packages/core/src/config/auto-sync-mode-confinement.test.ts b/packages/core/src/config/auto-sync-mode-confinement.uncached.test.tssimilarity index 100%rename from packages/core/src/config/auto-sync-mode-confinement.test.tsrename to packages/core/src/config/auto-sync-mode-confinement.uncached.test.tsdiff --git a/packages/core/src/constants/chrome.test.ts b/packages/core/src/constants/chrome.uncached.test.tssimilarity index 100%rename from packages/core/src/constants/chrome.test.tsrename to packages/core/src/constants/chrome.uncached.test.tsdiff --git a/packages/core/src/constants/preview-theme-tokens.test.ts b/packages/core/src/constants/preview-theme-tokens.uncached.test.tssimilarity index 95%rename from packages/core/src/constants/preview-theme-tokens.test.tsrename to packages/core/src/constants/preview-theme-tokens.uncached.test.tsindex b5efeb6c1..cab49a594 100644--- a/packages/core/src/constants/preview-theme-tokens.test.ts+++ b/packages/core/src/constants/preview-theme-tokens.uncached.test.ts@@ -18,13 +18,13 @@ const MIN_HUE_SEPARATION_DEG = 25;function tokenByName(name: string): { name: string; light: string; dark: string } {const t = PREVIEW_THEME_TOKENS.find((x) => x.name === name);- if (!t) throw new Error(`preview-theme-tokens.test: missing token ${name}`);+ if (!t) throw new Error(`preview-theme-tokens.uncached.test: missing token ${name}`);return t;}function oklchHue(value: string): number {const m = value.match(/^oklch\(\s*[\d.]+\s+[\d.]+\s+([\d.]+)/);- if (!m) throw new Error(`preview-theme-tokens.test: not an oklch literal: ${value}`);+ if (!m) throw new Error(`preview-theme-tokens.uncached.test: not an oklch literal: ${value}`);return Number(m[1]);}diff --git a/packages/core/src/logging/renderer-capture-scrub-coverage.test.ts b/packages/core/src/logging/renderer-capture-scrub-coverage.uncached.test.tssimilarity index 100%rename from packages/core/src/logging/renderer-capture-scrub-coverage.test.tsrename to packages/core/src/logging/renderer-capture-scrub-coverage.uncached.test.tsdiff --git a/packages/desktop/electron-builder.yml b/packages/desktop/electron-builder.ymlindex e81e57e8f..7c962e21a 100644--- a/packages/desktop/electron-builder.yml+++ b/packages/desktop/electron-builder.yml@@ -88,7 +88,7 @@ extraResources:# expects `cli/package.json` adjacent. Without this rule the file is missing# in the shipped `.app` and every lock writes `runtimeVersion: "0.0.0-unknown"`,# which collapses cross-install drift diagnostics. Coverage:- # `tests/unit/electron-builder-cli-pkgjson.test.ts`.+ # `tests/unit/electron-builder-cli-pkgjson.uncached.test.ts`.- from: "../cli/package.json"to: "cli/package.json"# Top-level discoverable third-party attribution. The same file ships insidediff --git a/packages/desktop/tests/unit/electron-builder-cli-pkgjson.test.ts b/packages/desktop/tests/unit/electron-builder-cli-pkgjson.uncached.test.tssimilarity index 100%rename from packages/desktop/tests/unit/electron-builder-cli-pkgjson.test.tsrename to packages/desktop/tests/unit/electron-builder-cli-pkgjson.uncached.test.tsdiff --git a/packages/desktop/tests/unit/electron-builder-package-manager.test.mjs b/packages/desktop/tests/unit/electron-builder-package-manager.uncached.test.mjssimilarity index 100%rename from packages/desktop/tests/unit/electron-builder-package-manager.test.mjsrename to packages/desktop/tests/unit/electron-builder-package-manager.uncached.test.mjsdiff --git a/packages/desktop/tests/unit/packaged-report-path.test.mjs b/packages/desktop/tests/unit/packaged-report-path.uncached.test.mjssimilarity index 100%rename from packages/desktop/tests/unit/packaged-report-path.test.mjsrename to packages/desktop/tests/unit/packaged-report-path.uncached.test.mjsdiff --git a/test-support/uncached-tier-reconcile.test.ts b/test-support/uncached-tier-reconcile.test.tsindex e16ae5ac2..c6107d242 100644--- a/test-support/uncached-tier-reconcile.test.ts+++ b/test-support/uncached-tier-reconcile.test.ts@@ -1,9 +1,9 @@import { spawnSync } from 'node:child_process';-import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs';+import { existsSync, mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs';import { tmpdir } from 'node:os';import { dirname, join, resolve, win32 } from 'node:path';import { fileURLToPath } from 'node:url';-import { afterEach, describe, expect, onTestFinished, test, vi } from 'vitest';+import { afterEach, beforeAll, describe, expect, onTestFinished, test, vi } from 'vitest';import { createVitest, type TestProject } from 'vitest/node';import { gitCleanEnv } from '../scripts/git-clean-env.mjs';import tierConfig from '../vitest.uncached.config';@@ -41,6 +41,9 @@ function git(root: string, args: string[]): void {}const SERVER = 'packages/server/src/reads-app.uncached.test.ts';+const privateInfix = (stem: string, suffix: string) => `${stem}.private.${suffix}`;+const TRANSPOSED = privateInfix('packages/server/src/reads-app.uncached', 'test.ts');+const INFIXED = privateInfix('packages/server/src/reads-app', 'uncached.test.ts');const server = (collected: string[]) => ({name: 'packages/server/vitest.config.ts',dir: 'packages/server',@@ -99,6 +102,18 @@ describe('the uncached tier reconciles the suffixed files git lists against what]);});+ test('a test named for the tier with .uncached. short of its closing suffix fails, since no tier project collects it', () => {+ expect(+ uncachedTierProblems(packages(), [SERVER, TRANSPOSED], [server([SERVER]), scripts([])]),+ ).toEqual([expect.stringContaining(`${TRANSPOSED} names the uncached tier, but`)]);+ });++ test('the same infix ahead of the closing .uncached.test suffix passes', () => {+ expect(+ uncachedTierProblems(packages(), [SERVER, INFIXED], [server([SERVER, INFIXED]), scripts([])]),+ ).toEqual([]);+ });+test('an empty listing fails rather than passing having run nothing', () => {expect(uncachedTierProblems(packages(), [], [server([]), scripts([])])).toEqual(['git lists no file with the .uncached.test suffix, so the tier would pass having run nothing.',@@ -187,14 +202,30 @@ describe('reconcile() over the real tier config, as Vitest resolves it under a -}}+ let declared: string[] = [];++ beforeAll(async () => {+ const { resolved, failure } = await reconcileUnder(undefined);+ expect(failure).toBeUndefined();+ declared = resolved;+ });++ test('every declared project is a Vitest config on disk, the server and root scripts configs among them', () => {+ expect(declared).toEqual(expect.arrayContaining([SERVER_PROJECT, SCRIPTS_PROJECT]));+ expect(declared.filter((name) => !existsSync(join(root, name)))).toEqual([]);+ });+test.each([- { filter: [SCRIPTS_PROJECT], kept: [SCRIPTS_PROJECT] },- { filter: [`!${SCRIPTS_PROJECT}`], kept: [SERVER_PROJECT] },+ { filter: [SCRIPTS_PROJECT], kept: () => [SCRIPTS_PROJECT] },+ {+ filter: [`!${SCRIPTS_PROJECT}`],+ kept: () => declared.filter((name) => name !== SCRIPTS_PROJECT),+ },])('a run narrowed by --project=$filter refuses once, naming the filter rather than SOURCES',async ({ filter, kept }) => {const { resolved, failure } = await reconcileUnder(filter);- expect(resolved).toEqual(kept);+ expect(resolved).toEqual(kept());expect(failure).toBeInstanceOf(Error);const message = failure instanceof Error ? failure.message : '';expect(message).toContain('--project');@@ -204,14 +235,13 @@ describe('reconcile() over the real tier config, as Vitest resolves it under a -);test.each([- { filter: undefined },- { filter: ['*'] },- { filter: [SCRIPTS_PROJECT, SERVER_PROJECT] },+ { form: 'the * glob', filter: () => ['*'] },+ { form: 'every declared project by name', filter: () => declared },])(- 'a run whose filter ($filter) keeps every declared project reconciles cleanly',+ 'a run whose filter ($form) keeps every declared project reconciles cleanly',async ({ filter }) => {- const { resolved, failure } = await reconcileUnder(filter);- expect(resolved).toEqual([SERVER_PROJECT, SCRIPTS_PROJECT]);+ const { resolved, failure } = await reconcileUnder(filter());+ expect(resolved).toEqual(declared);expect(failure).toBeUndefined();},);@@ -236,6 +266,19 @@ describe("the tier's discovery domain: what git lists, and what every project ex]);});+ test('git lists a test that carries .uncached. short of its closing suffix, and no file that is not a test', () => {+ const root = workspace({+ [SERVER]: '',+ [TRANSPOSED]: '',+ 'packages/server/src/reads-app.uncached.test-helper.ts': '',+ 'packages/server/src/__snapshots__/reads-app.uncached.test.ts.snap': '',+ [`${SERVER}.orig`]: '',+ 'vitest.uncached.config.ts': '',+ });+ git(root, ['init', '-q']);+ expect(listUncachedTestFiles(root).sort()).toEqual([SERVER, TRANSPOSED].sort());+ });+test('every tier project excludes node_modules, so a vendored suffixed file is in neither view', () => {const projects = (tierConfig.test?.projects ?? []) as Array<{ test?: { exclude?: string[] } }>;expect(projects.length).toBeGreaterThan(0);diff --git a/test-support/uncached-tier-reconcile.ts b/test-support/uncached-tier-reconcile.tsindex d84a5b41d..699e66a2b 100644--- a/test-support/uncached-tier-reconcile.ts+++ b/test-support/uncached-tier-reconcile.ts@@ -4,10 +4,11 @@ import { dirname, join, relative, sep } from 'node:path';import { fileURLToPath } from 'node:url';import type { TestProject } from 'vitest/node';import { gitCleanEnv } from '../scripts/git-clean-env.mjs';-import { UNCACHED_TEST_GLOBS, UNCACHED_TIER_CONFIG } from './uncached-tier';+import { EXTENSIONS, isUncachedTestFile, UNCACHED_TIER_CONFIG } from './uncached-tier';const OK_ROOT = fileURLToPath(new URL('..', import.meta.url));const RECONCILED = Symbol.for('open-knowledge.uncached-tier.reconciled');+const TEST_NAME = new RegExp(`\\.(?:test|e2e)\\.(?:${EXTENSIONS.join('|')})$`);export type UncachedTierProject = { name: string; dir: string; collected: string[] };@@ -21,16 +22,18 @@ export function listUncachedTestFiles(root: string): string[] {'--others','--exclude-standard','--',- ...UNCACHED_TEST_GLOBS.map((glob) => `:(glob)${glob}`),+ ':(glob)**/*.uncached.*',],{ cwd: root, encoding: 'utf8', env: gitCleanEnv(), windowsHide: true },);if (listed.error || listed.status !== 0) {throw new Error(- `${UNCACHED_TIER_CONFIG}: git ls-files could not list the suffixed test files (${listed.error?.message ?? listed.stderr.trim()}), so the tier cannot show that it runs every one of them. Run it from a git work tree.`,+ `${UNCACHED_TIER_CONFIG}: git ls-files could not list the test files named for the uncached tier (${listed.error?.message ?? listed.stderr.trim()}), so the tier cannot show that it runs every one of them. Run it from a git work tree.`,);}- return listed.stdout.split('\0').filter((path) => path !== '' && existsSync(join(root, path)));+ return listed.stdout+ .split('\0')+ .filter((path) => TEST_NAME.test(path) && existsSync(join(root, path)));}function owningPackage(root: string, path: string): string {@@ -49,12 +52,18 @@ export function uncachedTierProblems(for (const path of collected) collectors.set(path, [...(collectors.get(path) ?? []), name]);}const problems: string[] = [];- if (listed.length === 0) {+ if (!listed.some(isUncachedTestFile)) {problems.push('git lists no file with the .uncached.test suffix, so the tier would pass having run nothing.',);}for (const path of listed) {+ if (!isUncachedTestFile(path)) {+ problems.push(+ `${path} names the uncached tier, but .uncached.test does not end its name, so no project here collects it and a cached tier may run it instead. Put .uncached.test last, with any other infix ahead of it, or drop .uncached. if the test reads only files inside its package's key.`,+ );+ continue;+ }const names = collectors.get(path) ?? [];if (names.length > 1) {problems.push(@@ -103,7 +112,7 @@ export default async function reconcile(project: TestProject): Promise<void> {);const problems = uncachedTierProblems(OK_ROOT, listed, projects);console.log(- `uncached tier: ${listed.length} suffixed test files listed by git, ${new Set(projects.flatMap(({ collected }) => collected)).size} collected (${projects+ `uncached tier: ${listed.filter(isUncachedTestFile).length} suffixed test files listed by git, ${new Set(projects.flatMap(({ collected }) => collected)).size} collected (${projects.map(({ name, collected }) => `${name}: ${collected.length}`).join(', ')})`,);diff --git a/test-support/uncached-tier.ts b/test-support/uncached-tier.tsindex 387ad165d..9cfda4561 100644--- a/test-support/uncached-tier.ts+++ b/test-support/uncached-tier.ts@@ -1,4 +1,4 @@-const EXTENSIONS = ['ts', 'tsx', 'mjs'];+export const EXTENSIONS = ['ts', 'tsx', 'mjs'];export const UNCACHED_TIER_CONFIG = 'vitest.uncached.config.ts';diff --git a/turbo.json b/turbo.jsonindex dc4b6dec5..e12c22eb5 100644--- a/turbo.json+++ b/turbo.json@@ -95,10 +95,7 @@"$TURBO_DEFAULT$","$TURBO_ROOT$/test-support/**","../../oxlint.config.ts",- "../../lint-plugins/**",- "$TURBO_ROOT$/packages/desktop/src/main/menu.ts",- "$TURBO_ROOT$/packages/desktop/src/main/dialog-helpers.ts",- "$TURBO_ROOT$/packages/desktop/src/main/menu-translator.ts"+ "../../lint-plugins/**"]},"@inkeep/open-knowledge-docs#test": {@@ -138,7 +135,6 @@"../../oxlint.config.ts","../../lint-plugins/**","$TURBO_ROOT$/test-support/**",- "../../.github/scripts/smoke-packaged-dmg.mjs","../../scripts/verify-native-config-in-packaged-dmg.mjs","../../scripts/verify-keyring-in-packaged-dmg.mjs","../../scripts/lume-bake/**",@@ -148,8 +144,7 @@"../app/postcss.config.ts","../app/*.html","../app/src/**",- "!../app/src/**/*.md",- "$TURBO_ROOT$/.github/scripts/dmg-mount.mjs"+ "!../app/src/**/*.md"]},"@inkeep/md-conformance#test": {diff --git a/vitest.uncached.config.ts b/vitest.uncached.config.tsindex dc2b70b69..e4a52827f 100644--- a/vitest.uncached.config.ts+++ b/vitest.uncached.config.ts@@ -1,11 +1,19 @@import { fileURLToPath } from 'node:url';import { defineConfig } from 'vitest/config';+import appConfig from './packages/app/vitest.config';+import cliConfig from './packages/cli/vitest.config';+import coreConfig from './packages/core/vitest.config';+import desktopConfig from './packages/desktop/vitest.config';import serverConfig from './packages/server/vitest.config';import { UNCACHED_TEST_GLOBS, UNCACHED_TIER_CONFIG } from './test-support/uncached-tier';import { uncachedTierFloor } from './test-support/uncached-tier-floor';import scriptsConfig from './vitest.scripts.config';const SOURCES = [+ { name: 'packages/app/vitest.config.ts', dir: 'packages/app', config: appConfig },+ { name: 'packages/cli/vitest.config.ts', dir: 'packages/cli', config: cliConfig },+ { name: 'packages/core/vitest.config.ts', dir: 'packages/core', config: coreConfig },+ { name: 'packages/desktop/vitest.config.ts', dir: 'packages/desktop', config: desktopConfig },{ name: 'packages/server/vitest.config.ts', dir: 'packages/server', config: serverConfig },{ name: 'vitest.scripts.config.ts', dir: '.', config: scriptsConfig },];