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
test: raise the suite-wide testing-library async timeout to 3000ms (#3474)
[._.]/ Adam Eivy4843ab894a56
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 3ecf77d37c..ed1d2f7825 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -57,3 +57,5 @@- **The MeatSpace life-progress bar was the one part of that panel that didn't follow the theme.** Its fill color was three inline hex literals (`#ef4444`/`#f59e0b`/`#3b82f6`) while the surrounding card already used `border-port-border` and `text-port-error` — so switching themes re-colored everything around the bar but not the bar. It now reads `rgb(var(--port-error))` / `rgb(var(--port-warning))` / `rgb(var(--port-accent))`. Separately, the `#3b82f6` default swatch was independently hardcoded at five places across the agents and calendar config UIs; a native `<input type="color">` genuinely needs a literal hex, so the literal stays — but there is now one `DEFAULT_AVATAR_COLOR` derived from the default theme's accent that all five import, instead of five edits to change the fallback (#3453).- **The CoS week id paired the ISO week number with the calendar year, which both split and reused week ids around New Year.** `getWeekId()` was duplicated in `productivity.js` and `weeklyDigest.js` and built as `${date.getFullYear()}-W${isoWeek}` — so Mon 2025-12-29 and Thu 2026-01-01, one and the same ISO week, stamped `2025-W01` and `2026-W01` (breaking the weekly streak and mis-ordering the `longestWeekly` scan), while the *January* week of that same year stamped `2025-W01` too, so the late-December digest overwrote the early-January one on disk. The helper now lives once in `server/lib/isoWeek.js` and keys on the ISO week-numbering year — the calendar year of that week's Thursday — so one ISO week has one id and no id is ever reused. `isConsecutiveWeek` moved with it and now bridges a rollover only when the earlier week is genuinely its year's last, which a bare `week >= 52` check got wrong for the 53-week years (2026 is one). Migration 224 renames existing digest files and rewrites `streaks.lastActiveWeek`, resolving each record from its own stored `weekStart` / `lastActiveDate` and leaving anything it cannot resolve untouched rather than guessing a digest onto the wrong week.++- **The 1-second async-assertion timeout that flaked the QuotaBurn retry-budget test is now raised suite-wide, not per call site.** `QuotaBurn.test.jsx`'s "stops claiming it is saving once the retry budget is spent" failed roughly 1 run in 3 in isolation: it waits on a 500ms debounced save *plus* its retry — two sequential windows — against testing-library's uncustomized 1000ms `waitFor` default, which parallel-worker CPU contention pushes past. The same diagnosis had already been made once and fixed in one place (`settledInput.js`'s local `{ timeout: 3000 }`), leaving every other debounce-sensitive test exposed and the diagnosis waiting to be rediscovered. `client/src/test/setup.js` now calls `configure({ asyncUtilTimeout: 3000 })` once, carrying the rationale, and the five now-redundant local overrides in `settledInput.js`, `MediaCollections.test.jsx` and `ReferenceAnalysis.test.jsx` are gone. The cost is that a genuinely hung assertion takes 3s instead of 1s to fail; the full client suite still runs in ~26s.diff --git a/client/src/components/songs/ReferenceAnalysis.test.jsx b/client/src/components/songs/ReferenceAnalysis.test.jsxindex a58ef5da21..2b8fb309c1 100644--- a/client/src/components/songs/ReferenceAnalysis.test.jsx+++ b/client/src/components/songs/ReferenceAnalysis.test.jsx@@ -198,7 +198,7 @@ describe('ReferenceAnalysis — extract → review → apply (solo segment)', ()fireEvent.click(extract);// The proposal renders the transcribed score (220 Hz → A3) once the// deferred DSP tick runs.- await waitFor(() => expect(screen.getAllByTestId('scoresheet').length).toBeGreaterThan(0), { timeout: 3000 });+ await waitFor(() => expect(screen.getAllByTestId('scoresheet').length).toBeGreaterThan(0));const sheets = screen.getAllByTestId('scoresheet');expect(sheets[0].textContent).toMatch(/A3/);expect(sheets[0].textContent).toContain('key: C');@@ -231,7 +231,7 @@ describe('ReferenceAnalysis — extract → review → apply (solo segment)', ()const extract = screen.getByRole('button', { name: /extract part/i });await waitFor(() => expect(extract.disabled).toBe(false));fireEvent.click(extract);- await waitFor(() => expect(screen.getAllByTestId('scoresheet').length).toBeGreaterThan(0), { timeout: 3000 });+ await waitFor(() => expect(screen.getAllByTestId('scoresheet').length).toBeGreaterThan(0));// Comparison select defaulted to the matching stored part → diff chips render.expect(screen.getByLabelText(/compare \/ apply to/i).value).toBe('part-bass');@@ -263,7 +263,7 @@ describe('ReferenceAnalysis — extract → review → apply (solo segment)', ()const extract = screen.getByRole('button', { name: /extract part/i });await waitFor(() => expect(extract.disabled).toBe(false));fireEvent.click(extract);- await waitFor(() => expect(screen.getAllByTestId('scoresheet').length).toBeGreaterThan(0), { timeout: 3000 });+ await waitFor(() => expect(screen.getAllByTestId('scoresheet').length).toBeGreaterThan(0));// Melody defaults to the base-score target and applies as { base: true }.expect(screen.getByLabelText(/compare \/ apply to/i).value).toBe('__base__');@@ -395,7 +395,7 @@ describe('ReferenceAnalysis — stacked-mix extraction (#2121)', () => {fireEvent.click(extractFromMix);// The spectral diff subtracts the C4 backing and transcribes the new A4.- await waitFor(() => expect(screen.getAllByTestId('scoresheet').length).toBeGreaterThan(0), { timeout: 3000 });+ await waitFor(() => expect(screen.getAllByTestId('scoresheet').length).toBeGreaterThan(0));expect(screen.getAllByTestId('scoresheet')[0].textContent).toMatch(/A4/);expect(toastError).not.toHaveBeenCalled();});diff --git a/client/src/pages/MediaCollections.test.jsx b/client/src/pages/MediaCollections.test.jsxindex 0cf8bcfe1c..d6a4b49709 100644--- a/client/src/pages/MediaCollections.test.jsx+++ b/client/src/pages/MediaCollections.test.jsx@@ -176,10 +176,7 @@ describe('MediaCollections', () => {renderPage();await waitFor(() => screen.getByText('Alpha'));await user.type(screen.getByLabelText('Search collections'), 'beta');- await waitFor(- () => expect(screen.getByTestId('search-string')).toHaveTextContent('q=beta'),- { timeout: 3000 },- );+ await waitFor(() => expect(screen.getByTestId('search-string')).toHaveTextContent('q=beta'));});it('writes the sort to the URL and drops the param at the default', async () => {diff --git a/client/src/test/settledInput.js b/client/src/test/settledInput.jsindex 3253b7ef4b..7d8ca62275 100644--- a/client/src/test/settledInput.js+++ b/client/src/test/settledInput.js@@ -12,13 +12,10 @@ import { expect } from 'vitest';// Pinning the settled input value in between turns a load-dependent flake into// either a pass or an honest, immediately-legible failure.-// `waitFor` defaults to a 1000ms timeout (testing-library/dom, uncustomized here —-// see setup.js). Under parallel test-worker CPU contention that's tight for a-// `user.type()`/`user.clear()` + React re-render to settle, producing phantom-// failures that have nothing to do with the component under test. Raise it-// explicitly rather than relying on the tight default.-const settled = (input, value) =>- waitFor(() => expect(input).toHaveValue(value), { timeout: 3000 });+// The timeout `waitFor` uses here comes from the suite-wide+// `configure({ asyncUtilTimeout: 3000 })` in setup.js — testing-library's 1000ms+// default is too tight for these under parallel-worker CPU contention.+const settled = (input, value) => waitFor(() => expect(input).toHaveValue(value));// A `type="number"` input reads its value back coerced, and empty as `null`.const readBack = (input, text) => (input.type === 'number' ? Number(text) : text);diff --git a/client/src/test/setup.js b/client/src/test/setup.jsindex bfb630df56..d67a8b61be 100644--- a/client/src/test/setup.js+++ b/client/src/test/setup.js@@ -1,8 +1,16 @@import '@testing-library/jest-dom/vitest';import { afterEach } from 'vitest';-import { cleanup } from '@testing-library/react';+import { cleanup, configure } from '@testing-library/react';import { installTestStorage } from './storagePolyfill.js';+// testing-library defaults asyncUtilTimeout to 1000ms. 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; settledInput.js hit this first for `user.type()`/`user.clear()`+// + re-render settling). Raising it suite-wide beats patching one call site per+// flake — the cost is that a genuinely hung assertion takes 3s instead of 1s.+configure({ asyncUtilTimeout: 3000 });+// Guarantee a working localStorage/sessionStorage before any test runs, regardless// of how jsdom exposes Storage in this environment. See storagePolyfill.js / #1438.installTestStorage();