Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
address self-review: correct the lint rationale, cache client node_modules, and de-vacuum the budget guard
[._.]/ Adam Eivy6eb1bae966e3
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex 9efdbbe22b..1e0a89eebf 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -326,7 +326,7 @@ jobs:client:# Sharded like the server job; the build and the bundle budget run on shard 1.- # Lint is deliberately NOT here — it has its own job (see #7448).+ # Lint is deliberately NOT here — it has its own job.name: Client tests and build (${{ matrix.shard }}/${{ strategy.job-total }})needs: impactif: needs.impact.outputs.client_mode != 'skip' || needs.impact.outputs.build == 'true'@@ -355,7 +355,26 @@ jobs:cache: npmcache-dependency-path: client/package-lock.json+ # `setup-node`'s npm cache only preserves ~/.npm, the tarball cache, so+ # `npm ci` still wipes and repopulates client/node_modules (393 MB, 21k+ # files — MORE files than the server tree the sibling cache already+ # serves) on every one of the four jobs that install this workspace.+ # Same exact-key/no-restore-keys shape as `Cache server node_modules`, and+ # for the same reason: a near-miss tree is not safe to reuse.+ #+ # No rebuild half, unlike the server: client/.npmrc pins+ # ignore-scripts=true AND `scripts/trusted-rebuilds.js` deliberately lists+ # nothing for this workspace, so a restored tree is usable as-is and the+ # install can be skipped outright on a hit.+ - name: Cache client node_modules+ id: client-modules+ uses: actions/cache@v6+ with:+ path: client/node_modules+ key: client-modules-${{ runner.os }}-${{ runner.arch }}-node24-${{ hashFiles('client/package-lock.json', 'client/package.json', 'client/.npmrc') }}+- name: Install client dependencies+ if: steps.client-modules.outputs.cache-hit != 'true'run: npm ci --prefix client- name: Cache Vitest transform artifacts@@ -396,18 +415,21 @@ jobs:run: node scripts/cancel-current-ci-run.jslint:- # Its own job rather than a step on client shard 1. Lint is unrelated to the- # tests, and pinning it there made the largest client shard the heaviest job- # in the matrix — it paid for lint before it even started testing, on the one- # shard that also builds (issue #7448). Splitting it also stops a lint-only- # diff from spinning up a whole client test job to run Biome.+ # Its own job rather than a step on client shard 1, for cost and latency —+ # NOT as a flake fix. Steps within one job run sequentially, so the ~31s of+ # Biome finished before `Run client tests` began and never contended with+ # it; #7448's shard-1 failures came from the tests themselves, not from what+ # else that job ran. What the split does buy: lint runs in parallel instead+ # of in front of the slowest shard, and a lint-only diff no longer starts a+ # client test job at all.## It cannot instead move to a LATER shard: a scoped plan emits# `client_shards: [1]`, so a pin to the second shard would silently skip lint# on every impact-scoped pull request.## It installs `client/` because Biome and its GritQL plugins are client- # devDependencies; the npm cache makes that a few seconds.+ # devDependencies. That install is shared with the client job through+ # `Cache client node_modules` below, so on a hit it is skipped entirely.name: Lint clientneeds: impactif: needs.impact.outputs.lint_mode != 'skip'@@ -416,11 +438,12 @@ jobs:contents: readactions: writesteps:+ # No `fetch-depth` and no `Resolve the pull-request diff base`, unlike the+ # test jobs: the linter's file list arrives from the impact plan, so this+ # job never diffs and a single-commit checkout is everything it needs.- uses: actions/checkout@v7with:persist-credentials: false- # Same as every other leaf job: depth 2 is the whole PR merge ref.- fetch-depth: 2- name: Use Node.js 24.xuses: actions/setup-node@v7@@ -429,7 +452,26 @@ jobs:cache: npmcache-dependency-path: client/package-lock.json+ # `setup-node`'s npm cache only preserves ~/.npm, the tarball cache, so+ # `npm ci` still wipes and repopulates client/node_modules (393 MB, 21k+ # files — MORE files than the server tree the sibling cache already+ # serves) on every one of the four jobs that install this workspace.+ # Same exact-key/no-restore-keys shape as `Cache server node_modules`, and+ # for the same reason: a near-miss tree is not safe to reuse.+ #+ # No rebuild half, unlike the server: client/.npmrc pins+ # ignore-scripts=true AND `scripts/trusted-rebuilds.js` deliberately lists+ # nothing for this workspace, so a restored tree is usable as-is and the+ # install can be skipped outright on a hit.+ - name: Cache client node_modules+ id: client-modules+ uses: actions/cache@v6+ with:+ path: client/node_modules+ key: client-modules-${{ runner.os }}-${{ runner.arch }}-node24-${{ hashFiles('client/package-lock.json', 'client/package.json', 'client/.npmrc') }}+- name: Install client dependencies+ if: steps.client-modules.outputs.cache-hit != 'true'run: npm ci --prefix client- name: Lint clientdiff --git a/client/src/components/messages/BeeperTab.test.jsx b/client/src/components/messages/BeeperTab.test.jsxindex c1c9aafee2..6c4c3fd226 100644--- a/client/src/components/messages/BeeperTab.test.jsx+++ b/client/src/components/messages/BeeperTab.test.jsx@@ -1440,10 +1440,8 @@ describe('purging one conversation mirror', () => {it('names the conversation and the byte count, and demands the typed word first', async () => {await openThread();- // No inline timeout: an inline bound at or above the per-test budget can- // never be reached, so the 15000 that used to sit here read as a fix and was- // not one — the test died at vitest's 5s default naming nothing (#7448). The- // suite-wide async budget in src/test/timeouts.js is what governs this wait.+ // No inline bound — the suite-wide budget in src/test/timeouts.js governs this+ // wait, and the guard beside it rejects an inline one the test budget outlives.expect(await screen.findByText('Purge this mirror')).toBeInTheDocument();expect(screen.getByText(/4 MB of mirrored attachment bytes/)).toBeInTheDocument();expect(screen.getByText(/across 3 file\(s\)/)).toBeInTheDocument();diff --git a/client/src/pages/Media3DDetail.test.jsx b/client/src/pages/Media3DDetail.test.jsxindex e7bb1ff935..dbfb23e717 100644--- a/client/src/pages/Media3DDetail.test.jsx+++ b/client/src/pages/Media3DDetail.test.jsx@@ -92,18 +92,6 @@ function renderWithSwitcher(id = 'image3d-1') {);}-// `findByText` resolves on the DOM mutation, not on effects settling — and the-// page seeds its option fields from the record in an effect that commits AFTER-// the name renders. Proof: a record whose latest run carries `steps: 48` still-// reads back an EMPTY quality field the moment `findByText('Example Beacon')`-// resolves, which is why the seeding tests below wait for the value explicitly.-//-// A field touched inside that window is overwritten when the seed lands, so the-// re-render body carries the default instead of the choice (#7448). A record with-// no runs seeds to the same values the form starts at, so there is nothing in the-// DOM to wait for — flush the pending effect instead of waiting on its output.-const settleOptionSeed = () => act(async () => {});-function deferred() {let resolve;let reject;@@ -233,7 +221,15 @@ describe('Media3DDetail', () => {generateImageTo3dModel.mockResolvedValue(record({ status: 'generating' }));renderAt();await screen.findByText('Example Beacon');- await settleOptionSeed();+ // `findByText` resolves on the DOM mutation, not on effects settling, and the+ // page seeds its option fields from the record in an effect that has NOT run+ // at that point — probed directly: a run carrying `steps: 48` still reads back+ // an empty quality field there, which is why the seeding tests below wait for+ // the value explicitly. A field changed inside that window is overwritten when+ // the seed lands. Sub-paint, so no user can hit it; it is a test-ordering+ // hazard only (#7448). A record with no runs seeds to the values the form+ // already holds, so there is nothing in the DOM to wait for.+ await act(async () => {});fireEvent.change(screen.getByLabelText(/quality/i), { target: { value: '24' } });fireEvent.click(screen.getByRole('button', { name: /re-render/i }));diff --git a/client/src/pages/VideoTimelineEditor.keyboard.test.jsx b/client/src/pages/VideoTimelineEditor.keyboard.test.jsxindex 34d497e146..d4c457aea8 100644--- a/client/src/pages/VideoTimelineEditor.keyboard.test.jsx+++ b/client/src/pages/VideoTimelineEditor.keyboard.test.jsx@@ -1,5 +1,6 @@import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';-import { render, screen, waitFor, waitForElementToBeRemoved } from '@testing-library/react';+import { render, screen, waitFor } from '@testing-library/react';+import { awaitPageLoaded } from '../test/pageLoadBarrier';import { stubSequentialLayout, pressKey, dndAnnouncement } from '../test/dndKeyboardDrag';// Guards #7243. This lives in its own file rather than in VideoTimelineEditor.test.jsx@@ -68,15 +69,7 @@ afterEach(() => restoreLayout());const renderEditor = async () => {render(<VideoTimelineEditor />);- // Two-sided, and deliberately so. This used to wait for the ABSENCE of- // 'Loading project…' — a string this page never renders — so the `waitFor`- // passed on its very first poll and every test below ran against the loading- // skeleton whenever the mocked fetches had not resolved yet. On a fast machine- // they always had; on a loaded CI runner they had not, which is how one- // timing-sensitive test went red per run (#7448). Pinning the skeleton's- // PRESENCE first is what stops the absence from meaning nothing:- // `waitForElementToBeRemoved` throws outright if it was never there.- await waitForElementToBeRemoved(screen.getByLabelText('Loading timeline project'));+ await awaitPageLoaded('Loading timeline project');};// The block is the drag handle, so it is reached through its own removediff --git a/client/src/pages/VideoTimelineEditor.test.jsx b/client/src/pages/VideoTimelineEditor.test.jsxindex f9274829ee..17d45478bf 100644--- a/client/src/pages/VideoTimelineEditor.test.jsx+++ b/client/src/pages/VideoTimelineEditor.test.jsx@@ -1,5 +1,6 @@import { beforeEach, describe, expect, it, vi } from 'vitest';-import { render, screen, waitFor, waitForElementToBeRemoved, fireEvent, within, act } from '@testing-library/react';+import { render, screen, waitFor, fireEvent, within, act } from '@testing-library/react';+import { awaitPageLoaded } from '../test/pageLoadBarrier';// The editor's pure rules live in lib/videoTimelineModel.js and its blocks in// components/media/VideoTimelineLanes.jsx, both tested there. What only exists@@ -87,15 +88,7 @@ beforeEach(() => {const renderEditor = async () => {render(<VideoTimelineEditor />);- // Two-sided, and deliberately so. This used to wait for the ABSENCE of- // 'Loading project…' — a string this page never renders — so the `waitFor`- // passed on its very first poll and every test below ran against the loading- // skeleton whenever the mocked fetches had not resolved yet. On a fast machine- // they always had; on a loaded CI runner they had not, which is how one- // timing-sensitive test went red per run (#7448). Pinning the skeleton's- // PRESENCE first is what stops the absence from meaning nothing:- // `waitForElementToBeRemoved` throws outright if it was never there.- await waitForElementToBeRemoved(screen.getByLabelText('Loading timeline project'));+ await awaitPageLoaded('Loading timeline project');};describe('lane visibility', () => {diff --git a/client/src/test/pageLoadBarrier.js b/client/src/test/pageLoadBarrier.jsnew file mode 100644index 0000000000..5675a6a988--- /dev/null+++ b/client/src/test/pageLoadBarrier.js@@ -0,0 +1,22 @@+import { screen, waitForElementToBeRemoved } from '@testing-library/react';++/**+ * Wait for a page's loading skeleton to be replaced by the loaded page.+ *+ * Two-sided ON PURPOSE. The natural way to write this barrier —+ * `waitFor(() => expect(screen.queryByText('Loading…')).not.toBeInTheDocument())`+ * — passes on its FIRST poll whenever the string it names is not on screen,+ * including when it was never rendered at all. `VideoTimelineEditor`'s test+ * helpers waited on `'Loading project…'`, which that page does not render, so+ * every test in both files ran against the skeleton whenever the mocked fetches+ * had not resolved yet: green on a fast machine, a different timing-sensitive+ * test red per CI run on a loaded one (#7448).+ *+ * `waitForElementToBeRemoved` throws when the element was not there to begin+ * with, so a label that stops matching fails loudly instead of silently+ * becoming a no-op. Pass the `label` a page hands its `PageSkeleton`, which is+ * the skeleton's accessible name.+ *+ * @param {string} label the PageSkeleton `label` prop, e.g. 'Loading timeline project'+ */+export const awaitPageLoaded = (label) => waitForElementToBeRemoved(screen.getByLabelText(label));diff --git a/client/src/test/setup.js b/client/src/test/setup.jsindex 9705cbe10e..636faca45e 100644--- a/client/src/test/setup.js+++ b/client/src/test/setup.js@@ -5,12 +5,9 @@ import { installTestStorage } from './storagePolyfill.js';import { installFormValidityFix } from './formValidityPolyfill.js';import { ASYNC_UTIL_TIMEOUT_MS } from './timeouts.js';-// testing-library defaults asyncUtilTimeout to 1000ms, which is far too tight for-// this suite: several views debounce at 500ms and a couple wait on a debounce plus-// a retry, so under parallel-worker CPU contention that budget produces phantom-// failures unrelated to the component under test (#3474). The value and its-// relationship to the per-test budget in vitest.config.js live in timeouts.js —-// they are derived from one another on purpose, so read that before changing it.+// The suite-wide Testing Library async budget. The value, and why the per-test+// and hook budgets in vitest.config.js are derived from it rather than written+// alongside it, live in timeouts.js — read that before changing this.configure({ asyncUtilTimeout: ASYNC_UTIL_TIMEOUT_MS });// Guarantee a working localStorage/sessionStorage before any test runs, regardlessdiff --git a/client/src/test/timeouts.js b/client/src/test/timeouts.jsindex 4068de1621..36daaffebd 100644--- a/client/src/test/timeouts.js+++ b/client/src/test/timeouts.js@@ -1,35 +1,35 @@/**- * The client suite's two time budgets, defined in ONE place so they can never- * drift into equality.+ * The client suite's time budgets, defined in ONE place so the async bound and+ * the budgets enclosing it can never be edited apart.** `ASYNC_UTIL_TIMEOUT_MS` bounds every Testing Library async utility —* `waitFor`, `findBy*`, and the `settledInput.js` helpers built on them.- * `TEST_TIMEOUT_MS` bounds the whole test. The ORDER matters more than either- * value: an inner bound that meets or exceeds the per-test budget can never- * report its own failure, because the test dies first with a bare "test timed- * out" naming nothing. That trap has been hit twice here — `WordplayTrainer`'s- * 5s drill bound against vitest's 5s default, and `BeeperTab`'s `{ timeout:- * 15000 }` band-aid, which could never wait more than 5s and so never helped.+ * `TEST_TIMEOUT_MS` bounds the whole test, and the same value bounds a hook.+ * The ORDER matters more than any of the numbers: an inner bound that reaches+ * its enclosing budget can never report its own failure, because the test dies+ * first with a bare "test timed out" naming nothing. That trap has been hit+ * twice here — `WordplayTrainer`'s 5s drill bound against vitest's 5s default,+ * and `BeeperTab`'s `{ timeout: 15000 }`, which could never wait more than 5s+ * and so never helped anything.*- * Values, and why:- * - 5000ms async. Testing Library defaults to 1000ms; this suite ran at 3000- * (#3474) because several views debounce at 500ms and some wait on a- * debounce plus a retry. `client/vitest.config.js` already documented 3s as- * marginal on the 2-vCPU public runner — that comment is why the client- * worker cap is 2 — and shard 1 sat over the line: a different `await`-a-- * mock-call assertion went red on most CI runs while passing locally every- * time (#7448). A loaded runner should make a test SLOWER, not red.- * - 15000ms per test, derived as 3x. Large enough that the async bound above- * always gets to speak, small enough that a genuinely hung test still ends- * the job. A real hang still reports in ~5s, from the async utility, naming- * what it was waiting for; the extra 10s is headroom, not latency.+ * 5000ms async: Testing Library defaults to 1000ms; this suite ran at 3000+ * (#3474) because several views debounce at 500ms and some wait on a debounce+ * plus a retry. `vitest.config.js` already documented 3s as marginal on the+ * 2-vCPU public runner — that comment is why the client worker cap is 2 — and+ * the `await`-a-mock-call assertions that went red there passed locally every+ * time (#7448). A loaded runner should make a test SLOWER, not red.*- * Raising the async budget is NOT a substitute for fixing an ordering race. It- * buys a slow runner room; it cannot rescue an assertion that is waiting on a- * call which already happened with the wrong argument. See- * `client/src/test/settledInput.js` for that half.+ * 15000ms enclosing, as 3x: headroom, not latency. It is not a guarantee that+ * the async bound always gets to speak — three sequential near-budget waits+ * still exhaust it — but it is comfortably clear of the one-wait case that+ * actually bites, and a real hang still reports in ~5s from the async utility,+ * naming what it was waiting on.+ *+ * Raising the async budget is NOT a substitute for fixing an ordering race: it+ * buys a slow runner room, and cannot rescue an assertion waiting on a call+ * that already happened with the wrong argument. See `settledInput.js` and+ * `pageLoadBarrier.js` for that half.*/export const ASYNC_UTIL_TIMEOUT_MS = 5000;-/** Derived, never written as a literal — equality is the failure mode. */export const TEST_TIMEOUT_MS = ASYNC_UTIL_TIMEOUT_MS * 3;diff --git a/client/src/test/timeouts.test.js b/client/src/test/timeouts.test.jsindex 2802b9a57b..4b72069c1a 100644--- a/client/src/test/timeouts.test.js+++ b/client/src/test/timeouts.test.js@@ -1,56 +1,81 @@+// @vitest-environment nodeimport { readFileSync } from 'fs';import { dirname, join } from 'path';import { fileURLToPath } from 'url';import { describe, expect, it } from 'vitest';+import { getConfig } from '@testing-library/dom';import { trackedTestFiles } from './trackedFiles.js';import { ASYNC_UTIL_TIMEOUT_MS, TEST_TIMEOUT_MS } from './timeouts.js';+import vitestConfig from '../../vitest.config.js';const CLIENT_ROOT = join(dirname(fileURLToPath(import.meta.url)), '..', '..');/*** A lone-key `{ timeout: N }` — the shape `waitFor(fn, { timeout })` and* `findBy*(text, {}, { timeout })` take. Deliberately does NOT match a fixture- * object that carries a `timeout` field beside other keys (the provider records- * in `src/utils/providers.test.js` hold `{ id, timeout }`), which is data rather+ * object carrying a `timeout` field beside other keys (the provider records in+ * `src/utils/providers.test.js` hold `{ id, timeout }`), which is data rather* than an async bound.*/const LONE_TIMEOUT_OPTION = /\{\s*timeout:\s*([\d_]+)\s*\}/g;+/**+ * Inline async bounds in `source` that the enclosing budget would cut short —+ * the test dies first, so the extended wait never happens and the failure names+ * nothing. Exported so the bypass probe below can prove the detector still+ * fires; a guard whose detector has quietly stopped matching passes forever.+ *+ * Scope is deliberately one-sided. A bound TIGHTER than the suite-wide async+ * budget is a legitimate (if easy to forget) local choice — several tests assert+ * that something settles fast — while a bound at or above the enclosing budget+ * is inert in every case, which is the one that actually shipped.+ *+ * A file that raises its own budget with `vi.setConfig` is skipped: its real+ * ceiling is a per-file expression this cannot evaluate.+ */+export function inertTimeoutBounds(source, budgetMs = TEST_TIMEOUT_MS) {+ if (source.includes('vi.setConfig(')) return [];+ return [...source.matchAll(LONE_TIMEOUT_OPTION)]+ .map(([, digits]) => digits)+ .filter((digits) => Number(digits.replace(/_/g, '')) >= budgetMs);+}+describe('client suite time budgets', () => {- it('leaves the async bound strictly inside the per-test budget', () => {- // Equality is the failure mode, not just excess: a `waitFor` bounded at- // exactly the per-test budget loses the race to report its own failure, and- // the run shows a bare "test timed out" naming nothing.- expect(TEST_TIMEOUT_MS).toBeGreaterThan(ASYNC_UTIL_TIMEOUT_MS);+ it('applies the shared async budget inside the budgets that enclose it', () => {+ // The EFFECTIVE values, not the module's own constants: `TEST_TIMEOUT_MS >+ // ASYNC_UTIL_TIMEOUT_MS` is unfalsifiable given the `* 3` that derives one+ // from the other, which is the same vacuous shape this file exists to+ // police. What can actually drift is the wiring — setup.js failing to apply+ // the budget, or vitest.config.js growing a hardcoded timeout beside it.+ expect(getConfig().asyncUtilTimeout).toBe(ASYNC_UTIL_TIMEOUT_MS);+ expect(vitestConfig.test.testTimeout).toBeGreaterThan(getConfig().asyncUtilTimeout);+ expect(vitestConfig.test.hookTimeout).toBeGreaterThan(getConfig().asyncUtilTimeout);});- it("gives a slow runner real headroom over testing-library's default", () => {- // Pins the intent rather than the exact number: the whole point of #7448 is- // that 1000ms (the library default) and the 3000ms this suite ran at both- // sat under what a 2-vCPU public runner needs for an `await`-a-mock-call- // assertion, so shard 1 went red on most runs while passing locally.- expect(ASYNC_UTIL_TIMEOUT_MS).toBeGreaterThanOrEqual(5000);- });+ it('has no inline async bound the enclosing budget would cut short', () => {+ // `BeeperTab.test.jsx` carried `{ timeout: 15000 }` against a 5000ms budget+ // for exactly this reason (#7448) — it read as a fix and was not one.+ const files = trackedTestFiles(CLIENT_ROOT);+ // A broken `git ls-files` would otherwise make this guard pass by scanning+ // nothing at all.+ expect(files.length).toBeGreaterThan(500);- it('has no inline async bound that the per-test budget would cut short', () => {- // An inline `{ timeout: N }` at or above the per-test budget is inert: the- // test dies first, so the extended wait never happens and the failure names- // nothing. `BeeperTab.test.jsx` carried `{ timeout: 15000 }` against a- // 5000ms budget for exactly this reason (#7448) — it read as a fix and was- // not one. A file that genuinely needs longer raises BOTH, through- // `vi.setConfig({ testTimeout })`, so those files are skipped here.- const offenders = [];- for (const file of trackedTestFiles(CLIENT_ROOT)) {- const source = readFileSync(join(CLIENT_ROOT, file), 'utf8');- if (source.includes('vi.setConfig(')) continue;- for (const [, digits] of source.matchAll(LONE_TIMEOUT_OPTION)) {- if (Number(digits.replace(/_/g, '')) >= TEST_TIMEOUT_MS) {- offenders.push(`${file}: { timeout: ${digits} }`);- }- }- }+ const offenders = files.flatMap((file) => (+ inertTimeoutBounds(readFileSync(join(CLIENT_ROOT, file), 'utf8'))+ .map((digits) => `${file}: { timeout: ${digits} }`)+ ));expect(offenders).toEqual([]);});++ it('still detects an inert bound, a tight one, and an opted-out file', () => {+ // The bypass probe: without it, a detector that stopped matching anything+ // would report a clean tree forever.+ expect(inertTimeoutBounds('await waitFor(fn, { timeout: 15000 });')).toEqual(['15000']);+ expect(inertTimeoutBounds('await waitFor(fn, { timeout: 2000 });')).toEqual([]);+ expect(inertTimeoutBounds('vi.setConfig({ testTimeout: 60000 });\nwaitFor(fn, { timeout: 30000 });')).toEqual([]);+ // Fixture data that merely carries a `timeout` field is not an async bound.+ expect(inertTimeoutBounds("const p = { id: 'p1', timeout: 300000 };")).toEqual([]);+ });});diff --git a/client/src/test/trackedFiles.js b/client/src/test/trackedFiles.jsindex c40906cd52..35d1fd565b 100644--- a/client/src/test/trackedFiles.js+++ b/client/src/test/trackedFiles.js@@ -48,5 +48,5 @@ export function trackedSourceFiles(clientRoot) {* one definition.*/export function trackedTestFiles(clientRoot) {- return gitTracked(clientRoot).filter((f) => /\.test\.[jt]sx?$/.test(f));+ return gitTracked(clientRoot).filter(isTest);}diff --git a/client/vitest.config.js b/client/vitest.config.jsindex d1681681a6..c3e21b54c2 100644--- a/client/vitest.config.js+++ b/client/vitest.config.js@@ -15,10 +15,14 @@ export default defineConfig({// runner before ChiefOfStaff's config panel settled. Keep the proven// two-worker client cap; the Node/server runner uses all four CPUs....vitestCiPool({ maxWorkers: 2 }),- // Derived from the Testing Library async budget, never written as a literal:- // an inner `waitFor` bound that reaches the per-test budget can never report- // its own failure. See src/test/timeouts.js for the full reasoning.+ // Both derived from the Testing Library async budget rather than written as+ // literals — an inner `waitFor` bound that reaches its enclosing budget can+ // never report its own failure. `hookTimeout` is set for the same reason as+ // `testTimeout`: a beforeEach that renders and waits is bounded by it, and+ // leaving it at vitest's fixed 10s default would silently break the ordering+ // the moment the async budget moved. See src/test/timeouts.js.testTimeout: TEST_TIMEOUT_MS,+ hookTimeout: TEST_TIMEOUT_MS,// happy-dom, not jsdom (#6144): building the DOM was the client suite's// largest CI phase, and happy-dom cuts it by roughly two thirds for the same// 10k assertions. Files that need no DOM at all still opt out entirely with adiff --git a/docs/GITHUB_ACTIONS.md b/docs/GITHUB_ACTIONS.mdindex cd6ca2d6b4..762027c0e4 100644--- a/docs/GITHUB_ACTIONS.md+++ b/docs/GITHUB_ACTIONS.md@@ -225,6 +225,50 @@ Per-site idioms:label's text as its accessible name. Pair `htmlFor`/`id` and keep the button asibling, which is the convention anyway.+### Client suite time budgets++Two numbers, derived from one another in `client/src/test/timeouts.js` rather+than written side by side:++| Budget | Value | Applied by |+| --- | --- | --- |+| Testing Library `asyncUtilTimeout` (`waitFor`, `findBy*`) | 5000 ms | `client/src/test/setup.js` |+| Vitest `testTimeout` / `hookTimeout` | 15000 ms (3x) | `client/vitest.config.js` |++**The ordering is the point, not the values.** An inner bound that reaches the+budget enclosing it can never report its own failure: the test dies first with a+bare "test timed out" naming nothing it was waiting on. That has shipped twice —+`WordplayTrainer`'s 5 s drill bound against Vitest's 5 s default, and a+`{ timeout: 15000 }` in `BeeperTab.test.jsx` that could never wait past 5 s and+so never helped. `client/src/test/timeouts.test.js` fails CI on any inline+`{ timeout: N }` at or above the per-test budget, and asserts the EFFECTIVE+runtime values rather than the constants, so a `configure()` that stopped being+applied is caught too.++5000 ms because Testing Library's 1000 ms default, and the 3000 ms this suite+ran at before #7448, both sat under what a 2-vCPU public runner needs: shard 1+failed a different `await`-a-mock-call assertion on most runs while passing+locally every time. A loaded runner should make a test slower, not red. The cost+is that a genuinely hung assertion reports in 5 s instead of 3.++**A budget is not a race fix.** It buys a slow runner room; it cannot rescue an+assertion waiting on a call that already happened with the wrong argument. Those+need a settled precondition — see `client/src/test/settledInput.js` (type-then-+submit) and `client/src/test/pageLoadBarrier.js` (render-then-act, two-sided so+a barrier naming a string the page never renders fails loudly instead of passing+on its first poll).++### Reusing the client install++Four jobs install `client/` — the three client test shards and `lint`.+`setup-node`'s `cache: npm` only preserves the tarball cache, so `npm ci` still+wipes and repopulates a 393 MB `client/node_modules` on each. `Cache client+node_modules` keys exactly on `client/package-lock.json`, `client/package.json`+and `client/.npmrc`, with no restore-keys, and the install is skipped outright+on a hit. Unlike the server, there is no rebuild half to verify: `client/.npmrc`+pins `ignore-scripts=true` and `scripts/trusted-rebuilds.js` deliberately lists+nothing for this workspace, so a restored tree is usable as-is.+### Reusing the server installThree jobs install the server workspace — `server`, `database`, and@@ -376,14 +420,13 @@ The selected work is split across parallel jobs:whenever client source changed. Build and the Scalar-removal bundle pin run onshard 1 only.- **Lint client** — Biome over the changed client sources, in its own job. It used- to be a shard-1 step here, sharing the client install so Biome did not pay a- second `npm ci` — but that made the largest client shard also the only one- paying for lint AND the production build, the heaviest job in the matrix and the- only shard that failed a timing-sensitive test (#7448). It cannot move to a later- shard instead: a scoped plan emits `client_shards: [1]`, so a second-shard pin- would skip lint on every scoped pull request. The second `npm ci --prefix client`- is a few seconds off the npm cache, and a lint-only diff no longer starts a- client test job at all.+ to be a shard-1 step on the client job. Steps within a job run sequentially, so+ that put ~31 s of Biome in front of the slowest shard's tests rather than beside+ them, and it meant a lint-only diff started a whole client test job. It was+ **not** what made shard 1 flaky — see "Client suite time budgets" below. It+ cannot move to a later shard instead: a scoped plan emits `client_shards: [1]`,+ so a second-shard pin would skip lint on every scoped pull request. It shares+ `Cache client node_modules` with the client job, so on a hit it pays no install.- **DB tests** — provisions only the isolated `portos_test` database and runsthe serial DB suite when database-sensitive files changed.- **Windows server tests** — the same server selection, but only on full CI@@ -447,10 +490,11 @@ September 2026). A full run is **12 jobs / 28.7 runner-minutes**:| DB tests, impact, both gates | 4 | 1.7 | 1.7 || **Total** | **12** | **28.7** | **40.4** |-Measured before lint moved to its own job (#7448), so the client column still-carries the ~31 s of Biome that now runs beside it rather than inside it. The-totals barely move — lint is the same work in a different slot — but shard 1 no-longer runs it, and the matrix is 13 jobs rather than 12.+Measured before lint moved to its own job, so the client column still carries the+~31 s of Biome that now runs beside it rather than inside it. The matrix is 13+jobs rather than 12; the totals move less than that implies, because+`Cache client node_modules` now skips the 393 MB `npm ci` on all four jobs that+install this workspace.Windows is 41% of a full run's runner occupancy, and 58% once GitHub's 2x`windows-latest` multiplier is applied. **This repository is public, so thosediff --git a/scripts/ci-base-sha.test.js b/scripts/ci-base-sha.test.jsindex 4d57858625..8ff097d0a2 100644--- a/scripts/ci-base-sha.test.js+++ b/scripts/ci-base-sha.test.js@@ -91,14 +91,13 @@ describe('ci.yml required checks', () => {expect(jobs['full-gate']).toMatch(/needs\.impact\.outputs\.windows_mode == 'full'/);});- it('no longer carries the retired legacy check-name jobs', () => {+ it('publishes no job whose only purpose is a retired check name', () => {// The RETIRED `lint` job was a shim: a whole runner whose only step echoed// the client job's result, so a required check named `lint` kept reporting.- // A `lint` job exists again, but it is the real linter in its own job- // (#7448) — so this asserts the SHIM's shape is gone, not the name. The- // server job likewise no longer wears `test (24.x)`; the ruleset requires- // neither name, only `CI Gate`.- expect(jobs.lint).toContain('run: node scripts/run-ci-lint.js');+ // A `lint` job exists again and is the real linter — its wiring is pinned in+ // run-ci-tests.test.js — so what this owns is the shim's shape. The server+ // job likewise no longer wears `test (24.x)`; the ruleset requires neither+ // name, only `CI Gate`.expect(jobs.lint).not.toContain('CLIENT_RESULT');expect(WORKFLOW).not.toMatch(/name: test \(24\.x\)/);});diff --git a/scripts/ci-test-plan.js b/scripts/ci-test-plan.jsindex 4de3d95aeb..1bb26edb42 100644--- a/scripts/ci-test-plan.js+++ b/scripts/ci-test-plan.js@@ -427,6 +427,10 @@ const structuralTestsFor = (changedFiles, trackedSet) => {add('client/src/responsiveGridConventions.test.js');add('client/src/storageConventions.test.js');add('client/src/subNavConventions.test.js');+ // Same trigger, different subject: this one scans the TEST files for an+ // inline async bound the per-test budget would cut short, and a changed+ // `*.test.jsx` matches the `.jsx?` pattern above.+ add('client/src/test/timeouts.test.js');}return selected;diff --git a/scripts/repo-scan-guards.test.js b/scripts/repo-scan-guards.test.jsindex fc8c69d1ca..c693df3a21 100644--- a/scripts/repo-scan-guards.test.js+++ b/scripts/repo-scan-guards.test.js@@ -65,6 +65,9 @@ const STRUCTURALLY_SELECTED = new Map([['client/src/responsiveGridConventions.test.js', 'structuralTestsFor: client/src/**.js(x)'],['client/src/storageConventions.test.js', 'structuralTestsFor: client/src/**.js(x)'],['client/src/subNavConventions.test.js', 'structuralTestsFor: client/src/**.js(x)'],+ // Its subject is the TEST files, and `client/src/**.js(x)` matches those too+ // (`*.test.jsx` ends in `.jsx`), so the same selector reaches it.+ ['client/src/test/timeouts.test.js', 'structuralTestsFor: client/src/**.js(x)'],// `.ps1` is not in EXECUTABLE_RE, so touching one is an "unclassified changed// file" and forces the complete suite. The guard also rides the Windows// contract list.@@ -75,8 +78,13 @@ const STRUCTURALLY_SELECTED = new Map([const GIT_CALL = /execFileSync\(\s*['"]git['"]/;/** …carrying a tree-enumerating subcommand. */const GIT_ENUMERATION = /['"](?:ls-files|grep)['"]/;-/** The client's shared enumerator, which shells out to `git ls-files` for them. */-const TRACKED_HELPER = /from\s+['"][^'"]*test\/trackedFiles\.js['"]/;+/**+ * The client's shared enumerator, which shells out to `git ls-files` for them.+ * The `test/` segment is optional because a guard living INSIDE client/src/test/+ * imports it as './trackedFiles.js' — a scanner the narrower pattern missed+ * entirely, so it registered as a non-scanner and this whole file passed on it.+ */+const TRACKED_HELPER = /from\s+['"](?:[^'"]*\/)?trackedFiles\.js['"]/;/** True when `source` asserts over the tracked tree instead of over its imports. */export const scansTrackedTree = (source) => (diff --git a/scripts/run-ci-tests.test.js b/scripts/run-ci-tests.test.jsindex a7aff757f7..c360ea181f 100644--- a/scripts/run-ci-tests.test.js+++ b/scripts/run-ci-tests.test.js@@ -53,11 +53,11 @@ describe('ci.yml shard wiring', () => {});it('keeps client lint out of the sharded test jobs entirely', () => {- // Lint used to be a shard-1 step on the client job, which made the largest- // client shard also the only one paying for Biome AND the production build —- // the heaviest job in the matrix, and the only shard that failed a- // timing-sensitive test (#7448). Its own job is the fix, so this pins BOTH- // halves: no runner job invokes the linter, and the lint job is not a matrix.+ // Lint used to be a shard-1 step on the client job, running in front of the+ // slowest shard's tests. Its own job runs it in parallel and keeps a+ // lint-only diff from starting a test job; the `lint` job's own comment+ // says why it cannot simply move to a different shard. Both halves are+ // pinned here: no runner job invokes the linter, and lint is not a matrix.const jobs = workflowJobs(WORKFLOW);for (const [id, body] of runners) expect(body, id).not.toContain('run-ci-lint.js');expect(jobs.lint).toBeTruthy();