Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

fix(tests): stop test:core serializing the suite into a half-hour run

nirholase7719f580989
diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md
index b316207f9..b16a91616 100644
--- a/ARCHITECTURE.md
+++ b/ARCHITECTURE.md
@@ -2837,7 +2837,8 @@ There is **no GitHub Actions CI**: the project deliberately does not use `.githu
| Script | Stack | Scope |
|--------|-------|-------|
| `test` | Vitest + Playwright | `vitest run && playwright test` — full suite |
-| `test:core` | Vitest (1 worker) | Deterministic unit runs |
+| `test:core` | Vitest | Full unit suite, no browser e2e (~90s warm) |
+| `test:serial` | Vitest (1 worker) | Diagnostic only: rules out cross-worker interference |
| `test:e2e` | Playwright | Browser end-to-end |
| `test:gate` | `test-gate.mjs` | Build-gate subset |
| `test:pages` | `test-pages.mjs` | Per-page smoke |
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 68ad6a691..52fdb40f3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -58,6 +58,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr
- **The Examples Gallery came back, and seven docs pages stopped describing code that had changed**: The Examples Gallery doc had been reduced to three lines of placeholder text by an interrupted test run, so a page advertised as copy-paste-ready code for the most common use cases opened to nothing at all; the full guide is restored, from the one-tag minimal embed through the React wrapper, the multi-agent scene, and the complete Coach Leo manifest, and its index of every runnable example in the repo is regenerated from what is actually on disk. Alongside it: the JavaScript API reference described a validator toggle, a scene-graph printer, and an alert-based error handler that no longer exist, and missed the load-progress callback and the model-loaded event that do; the Introduction listed five embeddable widgets when ten ship; two pages named older chat models than the brain router now offers; the Internationalization page called its lint command a build gate when nothing runs it for you; and the IRL page linked its retention cron at a live endpoint that answers with an authorization error instead of at the source file. (`/docs/examples`) `[docs, fix]`
- **The extra views behind a 3D generation stop being rejected for the wrong file type**: Before a prompt becomes a 3D model, the forge draws a reference picture, then draws two more views of it so the reconstruction can see the sides and back instead of guessing them. Those extra views sent the reference picture to the image model labelled as a PNG no matter what it actually was, so a JPEG or WebP reference could be refused outright and you would quietly get fewer views and a rougher model. The real format is now read from the picture and sent with it. A reference that is unreachable, oversized, or not actually an image is now refused with a clear reason instead of being forwarded as-is and failing further down. And every image this step fetches, including the optional edit mask, now goes through the same address safety check the rest of the platform uses, so a supplied link cannot be aimed at an internal address. (`/create`) `[fix, security]`
- **The free inference-receipt verifier is now in the public x402 catalog**: /api/x402/inference-verify audits a metered-inference receipt from a paid llm-proxy call: it re-checks the issuer signature, the node's response signature, the prompt and response hashes against the raw text you supply, whether the settlement transaction actually confirmed on-chain, and whether the issuer is one of the platform's published signers. It is free and keyless, but it was missing from docs/x402-endpoints.md, so buyers and node operators had no way to find it. It now has a row in the free read surfaces table alongside the other verifier tools. (`/docs/x402-endpoints`) `[docs]`
+- **The full test suite runs again instead of timing out**: npm run test:core was pinned to a single worker, which turned the 22,000-test suite into a roughly half-hour serial run that nobody waited for, so in practice the full suite stopped being run at all. Measured on the same machine, the suite finishes in 1.5 to 5 minutes at the default worker count. The single-worker mode was blamed on flaky tests under CPU contention, but back-to-back runs showed the moving failures were all tests that scan the working tree, shell out to git, or reach the network, and each passes on its own at full parallelism: serializing made the exposure window longer, not shorter. That mode is still available as npm run test:serial for diagnosing genuine cross-worker interference. Any single test slower than five seconds is now called out by the reporter so the total cannot quietly creep back up. The test docs also stated that a GitHub Actions workflow ran lint, typecheck and the suite on every push; that file does not exist and this repository has no CI, so the docs now name the local checks that really do run. `[improvement, docs]`
- **The GLB optimizer no longer hands back a bigger file than you gave it**: Asking /api/avatar/optimize for Draco compression could return a model up to 19% LARGER than the source, with nothing in the response to warn you. Stored three.ws avatars are already quantized and meshopt-packed, and the optimizer was stacking Draco on top of that instead of choosing one scheme, then re-quantizing data that was already quantized. It now drops the competing compression, restores full-precision attributes before encoding, and keeps whichever result is genuinely smaller. If nothing beats the original it returns the original bytes untouched. Every response now says what you got: x-three-ws-optimize reports draco, meshopt, none or source, and x-three-ws-optimize-refused appears when Draco was asked for and dropped for making the file worse. Those headers plus the byte counts are readable from browser code for the first time. Measured on the two production sample avatars: Draco went from +19.0% to 0.0% on one and from +14.6% to a real -4.4% saving on the other. (`/docs/media-api`) `[fix, improvement]`
- **The Granite forecast tool now ships a copy-and-run example**: The IBM Granite forecasting tool on our x402 MCP endpoint advertised a two-point sample series, but the tool needs at least 64 points of history to forecast anything. Any agent that copied the published example got a validation error back instead of a forecast. The example is now a real 64-day daily series you can paste straight into a call, and it is identical on the hosted endpoint and in the @three-ws/ibm-x402-mcp package. A test now dials every published example through the server the way a client would, so a sample that does not actually work cannot ship again. (`/docs/ibm-x402-mcp`) `[fix, sdk]`
- **The image step behind 3D generation now times out, checks its inputs, and stops mislabelling them**: Before a prompt becomes a 3D model, the forge draws a reference picture, then draws two extra views of it so the reconstruction can see the sides and back instead of guessing them. Three problems sat in that step. The calls to the image service had no time limit, so a connection that opened and then stalled held a generation open indefinitely rather than falling back to the free image lane; they now give up after ninety seconds and hand off. The extra views sent the reference picture to the model labelled as a PNG no matter what it actually was, so a JPEG or WebP reference could be rejected and you would quietly get fewer views; the real format is now read from the picture and sent with it. And a reference that is unreachable or oversized is refused with a clear reason instead of being forwarded as-is. Alongside that, every image this step fetches, including the optional mask, now goes through the same address safety check the rest of the platform uses, so a supplied URL cannot be aimed at an internal address. (`/create`) `[fix, security]`
diff --git a/data/changelog.json b/data/changelog.json
index 82afa60b7..1d799be45 100644
--- a/data/changelog.json
+++ b/data/changelog.json
@@ -20915,6 +20915,15 @@
"improvement"
],
"link": "/docs/media-api"
+ },
+ {
+ "date": "2026-08-13",
+ "title": "The full test suite runs again instead of timing out",
+ "summary": "npm run test:core was pinned to a single worker, which turned the 22,000-test suite into a roughly half-hour serial run that nobody waited for, so in practice the full suite stopped being run at all. Measured on the same machine, the suite finishes in 1.5 to 5 minutes at the default worker count. The single-worker mode was blamed on flaky tests under CPU contention, but back-to-back runs showed the moving failures were all tests that scan the working tree, shell out to git, or reach the network, and each passes on its own at full parallelism: serializing made the exposure window longer, not shorter. That mode is still available as npm run test:serial for diagnosing genuine cross-worker interference. Any single test slower than five seconds is now called out by the reporter so the total cannot quietly creep back up. The test docs also stated that a GitHub Actions workflow ran lint, typecheck and the suite on every push; that file does not exist and this repository has no CI, so the docs now name the local checks that really do run.",
+ "tags": [
+ "improvement",
+ "docs"
+ ]
}
]
}
diff --git a/package.json b/package.json
index 9d8c00b27..40b779bcb 100644
--- a/package.json
+++ b/package.json
@@ -282,7 +282,8 @@
"mixamo:all": "node scripts/mixamo-all.mjs",
"mixamo:upload": "node scripts/mixamo-all.mjs --upload",
"test": "vitest run && playwright test",
- "test:core": "vitest run --maxWorkers=1",
+ "test:core": "vitest run",
+ "test:serial": "vitest run --maxWorkers=1",
"test:gate": "node scripts/test-gate.mjs",
"test:e2e": "playwright test",
"audit:a11y": "playwright test tests/e2e/a11y-top-pages.spec.js",
diff --git a/public/changelog.json b/public/changelog.json
index 9a1a0303f..2c3797615 100644
--- a/public/changelog.json
+++ b/public/changelog.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-08-13T16:43:11.555Z",
+ "generated_at": "2026-08-13T16:57:58.199Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json",
"site": {
"name": "three.ws",
@@ -559,6 +559,17 @@
"docs"
]
},
+ {
+ "date": "2026-08-13",
+ "type": "update",
+ "title": "The full test suite runs again instead of timing out",
+ "summary": "npm run test:core was pinned to a single worker, which turned the 22,000-test suite into a roughly half-hour serial run that nobody waited for, so in practice the full suite stopped being run at all. Measured on the same machine, the suite finishes in 1.5 to 5 minutes at the default worker count. The single-worker mode was blamed on flaky tests under CPU contention, but back-to-back runs showed the moving failures were all tests that scan the working tree, shell out to git, or reach the network, and each passes on its own at full parallelism: serializing made the exposure window longer, not shorter. That mode is still available as npm run test:serial for diagnosing genuine cross-worker interference. Any single test slower than five seconds is now called out by the reporter so the total cannot quietly creep back up. The test docs also stated that a GitHub Actions workflow ran lint, typecheck and the suite on every push; that file does not exist and this repository has no CI, so the docs now name the local checks that really do run.",
+ "link": null,
+ "tags": [
+ "improvement",
+ "docs"
+ ]
+ },
{
"date": "2026-08-13",
"type": "update",
diff --git a/public/changelog.xml b/public/changelog.xml
index 5959bfa69..55e2b1959 100644
--- a/public/changelog.xml
+++ b/public/changelog.xml
@@ -422,6 +422,14 @@
<category>docs</category>
<description>/api/x402/inference-verify audits a metered-inference receipt from a paid llm-proxy call: it re-checks the issuer signature, the node's response signature, the prompt and response hashes against the raw text you supply, whether the settlement transaction actually confirmed on-chain, and whether the issuer is one of the platform's published signers. It is free and keyless, but it was missing from docs/x402-endpoints.md, so buyers and node operators had no way to find it. It now has a row in the free read surfaces table alongside the other verifier tools.</description>
</item>
+ <item>
+ <title>The full test suite runs again instead of timing out</title>
+ <link>https://three.ws/changelog</link>
+ <guid isPermaLink="false">2026-08-13:The full test suite runs again instead of timing out</guid>
+ <pubDate>Thu, 13 Aug 2026 12:00:00 GMT</pubDate>
+ <category>improvement</category>
+ <description>npm run test:core was pinned to a single worker, which turned the 22,000-test suite into a roughly half-hour serial run that nobody waited for, so in practice the full suite stopped being run at all. Measured on the same machine, the suite finishes in 1.5 to 5 minutes at the default worker count. The single-worker mode was blamed on flaky tests under CPU contention, but back-to-back runs showed the moving failures were all tests that scan the working tree, shell out to git, or reach the network, and each passes on its own at full parallelism: serializing made the exposure window longer, not shorter. That mode is still available as npm run test:serial for diagnosing genuine cross-worker interference. Any single test slower than five seconds is now called out by the reporter so the total cannot quietly creep back up. The test docs also stated that a GitHub Actions workflow ran lint, typecheck and the suite on every push; that file does not exist and this repository has no CI, so the docs now name the local checks that really do run.</description>
+ </item>
<item>
<title>The GLB optimizer no longer hands back a bigger file than you gave it</title>
<link>https://three.ws/docs/media-api</link>
diff --git a/public/features.json b/public/features.json
index 1db7cc9be..6194f1874 100644
--- a/public/features.json
+++ b/public/features.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-08-13T16:39:43.920Z",
+ "generated_at": "2026-08-13T16:57:58.188Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json",
"site": {
"name": "three.ws",
diff --git a/tests/README.md b/tests/README.md
index bedb44e33..b1f8c882e 100644
--- a/tests/README.md
+++ b/tests/README.md
@@ -6,10 +6,10 @@ need credentials. Real money rides on this code — green has to mean green.
## TL;DR
```bash
-npm run test:core # full vitest suite, single worker — the reliable local run
+npm run test:core # full vitest suite (1.5 to 5 min depending on host load)
npm run test:gate # 7 critical money/auth files — fast, offline, mock-backed
npm run lint # eslint . (0 errors is the bar; warnings are a backlog)
-npm run typecheck # tsc -p jsconfig.json — must stay clean (hard CI gate)
+npm run typecheck # tsc -p jsconfig.json (must stay clean; it gates deploys)
```
## Suites
@@ -17,7 +17,8 @@ npm run typecheck # tsc -p jsconfig.json — must stay clean (hard CI gate)
| Command | Runner | What it covers | Needs creds? |
| --- | --- | --- | --- |
| `npm test` | vitest + playwright | Unit suite then the browser e2e specs | Some unit specs are creds-gated (skip cleanly); e2e needs Chromium |
-| `npm run test:core` | vitest `--maxWorkers=1` | Same unit suite, serialized | No (creds-gated specs skip) |
+| `npm run test:core` | vitest | Same unit suite, without the browser e2e specs | No (creds-gated specs skip) |
+| `npm run test:serial` | vitest `--maxWorkers=1` | Same unit suite forced onto one worker. Diagnostic only, see Concurrency below | No (creds-gated specs skip) |
| `npm run test:gate` | node `scripts/test-gate.mjs` | 7 highest-consequence files: money-path confirm, HTTP cache boundary, custody/spend guards, vanity flow, x402 verify, holder snapshot, healthz | No — offline + mock-backed |
| `npm run test:e2e` | playwright | `tests/**/*.spec.js` — boots `npm run dev` as its web server | Chromium (`npx playwright install chromium`) |
| `npm run test:pages` | node `scripts/test-pages.mjs` | Chromium health pass over every public route (thrown errors, console errors, dead requests, broken hero images) | Chromium; spawns its own vite |
@@ -54,17 +55,53 @@ worker startup memory-hungry. `vitest.config.js` already caps forks
On a loaded box (e.g. a Codespace shared by several agents) the default
fork count can still starve and surface as `Timeout waiting for worker to
-respond` — that's the host, not the test. When in doubt, run **`npm run
-test:core`** (single worker): it's slower but does not flake on CPU contention.
-Treat any failure that only appears under heavy load and disappears at
-`--maxWorkers=1` as an environment artifact, not a regression.
-
-## CI
-
-`.github/workflows/ci.yml` runs **lint**, **typecheck**, **unit tests**
-(`vitest run`), **source guards** (`check-api-not-bundled`, `check:images`,
-`build:pages`), **page health** (`test:pages`), and **e2e** (`playwright test`)
-on every push to `main` and every PR, and blocks merge on failure. Typecheck is
-a hard gate (the JSDoc backlog is cleared). Lint blocks on errors only; the
-~5.5k pre-existing warnings are a tracked backlog — tighten to
-`--max-warnings 0` once burned down.
+respond`, which is the host, not the test.
+
+**Do not reach for `--maxWorkers=1` as the cure.** `test:core` carried it from
+2026-06-05 to 2026-08-13 and it was measured to be the wrong trade:
+
+| Mode | Wall clock |
+| --- | --- |
+| default forks (`MAX_FORKS`) | 88s, 182s and 308s over three runs on this host |
+| `--maxWorkers=1` | ~30 min (imports alone serialize to ~470s, tests to ~440s) |
+
+Serializing does not remove the flake class it was blamed for. Back-to-back
+full runs on the same commit failed 10 files and then 2; the 8 that moved were
+`branding`, `thumbnail-url-guard`, `no-nul-bytes`, `asset-host-liveness`,
+`setup-git-hooks`, `skill-royalty`, `node-operator` and `play-gate`, all of
+which either scan the tracked working tree, shell out to real `git`, or reach
+the network. In a worktree shared with other agents those inputs change *during
+the run*, and a single worker makes that window ten times longer, not shorter.
+Each of them passes in isolation at full parallelism.
+
+So: a failure that appears only in a full run and passes on its own is an
+environment artifact, and the thing to check is whether another agent was
+writing to the worktree, not the worker count. `npm run test:serial` still
+exists for the rare case where you genuinely need to rule out cross-worker
+interference, and it is a diagnostic, not the reliable run.
+
+`vitest.config.js` sets `slowTestThreshold: 5_000`, so any single test over five
+seconds is called out in the reporter. That list is the early warning that the
+total is creeping back up; there is deliberately no hard wall-clock gate,
+because failing a build for a busy host would be the same mistake in a new
+shape.
+
+## Where the checks actually run
+
+**There is no CI on this repository.** This section used to describe a
+`.github/workflows/ci.yml` that runs lint, typecheck, tests and guards on every
+push; that file does not exist, and `CLAUDE.md` bans GitHub Actions outright.
+Believing it is how a red suite reaches `main`. Every protection is local:
+
+| Stage | What runs it | Covers |
+| --- | --- | --- |
+| Pre-push hook | `scripts/setup-git-hooks.mjs` installs it; `postinstall` runs that on every `npm install` | `check:rules` over exactly the commits being pushed, plus the commit-subject lint |
+| `npm run gate` | you, before shipping | the offline audit set (docs, pages, handlers, guards, x402 catalog, tour atlas, …) |
+| `npm run build:gcp` | the deploy runbook in `CLAUDE.md` | the build-time guards, in a load-bearing order |
+| `npm run test:core` / `npm test` | you | this suite; `npm test` then runs Playwright |
+
+`data/guards.json` is the registry of which guard belongs to which stage, and
+`npm run audit:guards` fails when a claim there stops matching reality. Nothing
+runs the unit suite for you, so run it before you ask for a push.
+
+Lint blocks on errors only; the pre-existing warnings are a tracked backlog.
diff --git a/vitest.config.js b/vitest.config.js
index 454cbf027..36beb51f2 100644
--- a/vitest.config.js
+++ b/vitest.config.js
@@ -81,5 +81,11 @@ export default defineConfig({
pool: 'forks',
maxForks: MAX_FORKS,
minForks: 1,
+ // The suite is ~22k tests across ~1570 files and runs in 88-182s here
+ // (warm vs cold), so no single test has any business taking five seconds.
+ // The default 300ms threshold flags most of the file list and therefore
+ // flags nothing; at 5s the reporter prints a short, honest list of the
+ // files worth looking at, which is what stops the total creeping back up.
+ slowTestThreshold: 5_000,
},
});