commit 353e63942157d25a286c988201d2765a92aba668
parent b0f7dfabf4dde34838c3d10687a573f5609e80af
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Sat, 10 Oct 2026 19:02:51 -0400
e2e: the editor and export suites never run at once — they share export/public and export/out
The first `pnpm e2e:all` ran them side by side: e2e:2origin's hub build
composed into the checkout's export/public (and built export/out) under the
editor suite's export dev server; 20 export specs timed out in beforeEach and a
re-run could not boot. The editor suite now holds the e2e-export queue for its
whole run (`queue-lock.mjs --with e2e-export`, after its own), and e2e:all starts
export's lane after the editor's (`after`, naming the shared tree). Homepage
and umtool share no tree with either. WORKTREES.md and AGENTS.md say why.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
8 files changed, 144 insertions(+), 10 deletions(-)
diff --git a/AGENTS.md b/AGENTS.md
@@ -27,9 +27,11 @@ run waits. If `pnpm e2e` prints `waiting for the e2e queue — held by …` and
**that is working as intended, not a hung command** — the editor suite is ~20 minutes. A
run that wins the lock but finds its ports already bound aborts and names the offending
pid, instead of silently driving another session's server. Bypasses: `E2E_QUEUE=0`,
-`E2E_PORT_CHECK=0`, `E2E_QUEUE_TIMEOUT=<seconds>`. **`pnpm e2e:all` runs every suite at
-once** (one lane per package, each through its own script and lock) and prints one summary;
-per-suite logs land in `test-results-e2e-all/`.
+`E2E_PORT_CHECK=0`, `E2E_QUEUE_TIMEOUT=<seconds>`. **The editor and export suites never run
+at once**: they share the checkout's `export/public` and `export/out`, so the editor suite
+holds the `e2e-export` queue too. **`pnpm e2e:all` runs every suite** (one lane per package,
+each through its own script and lock; export's lane after the editor's) and prints one
+summary; per-suite logs land in `test-results-e2e-all/`.
**`pnpm e2e` at the root is the EDITOR suite**, whatever spec name you append to it: the
script is `pnpm --filter editor run e2e`, so `pnpm run e2e clip-bench.spec.ts` takes the
diff --git a/WORKTREES.md b/WORKTREES.md
@@ -84,14 +84,21 @@ queue-lock: still waiting (5m00s)
| Suite | Queue (`--name`) | Entry points |
|---|---|---|
-| editor | `e2e-editor` | `pnpm e2e` (root), `pnpm --filter editor run e2e` |
+| editor | `e2e-editor` **and** `e2e-export` | `pnpm e2e` (root), `pnpm --filter editor run e2e` |
| export | `e2e-export` | export's `e2e`, `e2e:hub`, `e2e:2origin`, `e2e:report` — one at a time among themselves |
| homepage | `e2e-homepage` | homepage's `e2e` |
| umtool | `e2e-umtool` | umtool's `e2e` |
| sharded | `e2e` | `pnpm e2e:sharded` (including its `docker build`) — the legacy one-for-all name, and it runs ALONE in the heavy slot |
Their ports (`common/lib/ports.mjs`) and fixture files are disjoint, which is what lets two
-different suites run at once. The editor suite's own export dev server builds into
+different suites run at once — **except the editor's and export's, which share the checkout's
+`export/public` and `export/out`**: the editor suite's export dev server serves
+`export/public` and its build specs point `export/out`, while export's suites rewrite both
+(`e2e:2origin`'s hub build composes into `export/public` and builds `export/out`; the default
+config writes `public/sw.js`). The first `pnpm e2e:all` ran them at once and the hub build
+replaced `export/public` under the editor suite. So the editor suite holds the `e2e-export`
+queue as well, for its whole run (`--with e2e-export`, taken after its own), and an export
+suite started meanwhile waits. Homepage and umtool share no tree with either. The editor suite's own export dev server builds into
`export/.next/e2e-editor` (`E2E_NEXT_DIST_DIR`), because Next allows one `next dev` per
dist dir and the export suite's server may be running beside it. Wrapping is at the
*package* level, so `pnpm --filter editor run e2e` is covered too, and a nested invocation
@@ -111,7 +118,8 @@ pnpm e2e:all --only editor,umtool # a package, or one suite id (export-hub, …
```
`scripts/e2e-all.mjs` starts one lane per package at once (export's four configs run in
-order in theirs), each suite through its own package script — the queue, the preflight, the
+order in theirs) — except that **export's lane starts after the editor's ends** (they share
+`export/public` and `export/out`, above) — each suite through its own package script — the queue, the preflight, the
build and every bypass behave exactly as when it runs alone. It prints a line as each suite
starts and ends, writes each suite's output to `test-results-e2e-all/<suite>.log`, and ends
with one summary: per suite passed / failed / flaky / skipped (from the suite's own json
diff --git a/editor/package.json b/editor/package.json
@@ -10,7 +10,7 @@
"build": "next build",
"start": "UV_THREADPOOL_SIZE=${UV_THREADPOOL_SIZE:-16} next start --port ${EDITOR_PORT:-3001}",
"test": "tsx --test \"app/**/*.test.ts\" \"e2e/*.unit.ts\"",
- "e2e": "node ../scripts/queue-lock.mjs --name e2e-editor --estimate 1500 --scale-by E2E_WORKERS --prebuild editor --ports PORT:3011,EXPORT_PORT:3010,OLLAMA_STUB_PORT:11435 -- playwright test",
+ "e2e": "node ../scripts/queue-lock.mjs --name e2e-editor --with e2e-export --estimate 1500 --scale-by E2E_WORKERS --prebuild editor --ports PORT:3011,EXPORT_PORT:3010,OLLAMA_STUB_PORT:11435 -- playwright test",
"e2e:ui": "playwright test --ui"
},
"dependencies": {
diff --git a/plans/e2e-speed.md b/plans/e2e-speed.md
@@ -281,6 +281,28 @@ cost. Verified against the real locks while release 23 gated: a new-style run wa
the suite then waited 3m40s behind an exclusive old-style build, and ran.
- `pnpm --filter umtool run e2e dashboard.spec.ts`: prebuild 25 s (`.next-e2e-start`), 7 passed, 14.2 s.
+**The first `pnpm e2e:all`** (orchestrator, `r24/integration` `0d3b1a47`) found a defect: **two suites shared a mutable
+tree.** The editor suite ran 663 passed / 23 failed in **45m29s** (21.6 min alone — beside the others it took roughly
+twice as long); 20 of the reds were `export-search.spec` and `export-player-platform-cache.spec`, every one a 30 s
+`beforeEach` timeout. At 18:24, mid-suite, an export config rewrote the worktree's `export/public` (`corpus.json`,
+`hub-sites.json`, `_headers` …, the fixture links gone): `e2e:2origin`'s hub build (`archilyzer build hub`) composes into
+`export/public` and builds `export/out`, and the default export config writes `public/sw.js` — while the editor suite's
+export dev server serves `export/public` and its build specs point `export/out`. A later editor re-run could not boot
+(ENOENT `export/public/summaries/manifest.json`, then a webServer timeout). The distDir split had covered `.next`
+only. Homepage, export, hub, 2-origin and report passed; umtool `browse.spec:342` red under load, 23/23 alone.
+
+Fixed: **the editor and export suites never run at once.** The editor suite holds the `e2e-export` queue for its whole
+run (`queue-lock.mjs --with e2e-export`, after its own — one order, no cycle), so a hand-run export suite waits; and
+`e2e:all` starts export's lane after the editor's (`after` in `LANES`, with the tree it shares). The other pairs were
+checked and share nothing: homepage writes nothing the others read (the editor's homepage specs only queue a build,
+never run one, so `homepage/out` is untouched); umtool's fixtures are its own (`umtool/e2e/.e2e-song`, an editor stub);
+`export/out` is the editor/export pair again. Not done (optional, ruled out): making the 2-origin hub build restore
+`export/public` — Next's static export reads `export/public` itself, so the build cannot be pointed elsewhere without
+staging the app outside `export/` the way `e2e-report/stage.ts` does; moving the tree aside and back is not safe
+under a kill. Unit: `e2e-all.test` (lane waits; a lane waits only for an earlier one; `--only` drops an unselected
+one; the editor script carries `--with e2e-export`), `queue-lock.test` (`--with`: export waits for the editor,
+umtool does not).
+
### S5a, as shipped (release 24, `r24/e2e-speed`)
Every spec's test-data paths come from `testPaths()` (`editor/e2e/testPaths.ts`, re-exported by `helpers.ts`):
diff --git a/scripts/e2e-all.mjs b/scripts/e2e-all.mjs
@@ -12,7 +12,9 @@
// configs, which share one queue). Every suite still goes through its own
// package script, so the queue, the port preflight, the start-mode build and
// every bypass (E2E_QUEUE=0, HEAVY=0, E2E_MODE=dev, …) behave exactly as when
-// it is run alone. The wall time becomes the longest lane, not the sum.
+// it is run alone. The wall time becomes the longest lane, not the sum — except
+// that a lane sharing a tree of the checkout with another starts after it
+// (`after`: export's after the editor's, both use export/public).
//
// Output: one line as each suite starts and ends; each suite's full output in
// `<logs>/<suite>.log` (default `test-results-e2e-all/`, gitignored); then one
@@ -35,6 +37,15 @@ export const LANES = Object.freeze([
{ pkg: "editor", suites: [{ id: "editor", script: "e2e", report: "editor/test-results/timings.json" }] },
{
pkg: "export",
+ // SHARED TREES: the editor suite's export dev server serves the checkout's
+ // `export/public` and its build specs point `export/out`; export's suites
+ // rewrite both (e2e:2origin's hub build composes into export/public and
+ // builds export/out; the default config writes public/sw.js). The first
+ // `pnpm e2e:all` (release 24) ran them at once: the hub build replaced
+ // export/public under the editor suite, 20 export specs timed out and the
+ // editor's next start could not boot. So this lane starts after the
+ // editor's ends (and the editor suite holds the e2e-export queue too).
+ after: [{ pkg: "editor", shares: "export/public, export/out" }],
suites: [
{ id: "export", script: "e2e", report: "export/test-results/timings.json" },
{ id: "export-hub", script: "e2e:hub", report: "export/test-results-hub/timings.json" },
@@ -46,6 +57,15 @@ export const LANES = Object.freeze([
{ pkg: "umtool", suites: [{ id: "umtool", script: "e2e", report: "umtool/test-results/timings.json" }] },
]);
+/**
+ * Which selected lanes each lane waits for: `pkg → [pkg…]`, from the lanes'
+ * `after` (a tree they share). A lane not selected is not waited for.
+ */
+export function laneWaits(lanes) {
+ const selected = new Set(lanes.map((l) => l.pkg));
+ return new Map(lanes.map((l) => [l.pkg, (l.after ?? []).map((a) => a.pkg).filter((p) => selected.has(p))]));
+}
+
/** The lanes `--only` names (a package, or a suite id); all of them by default. */
export function selectLanes(only, lanes = LANES) {
if (!only || !only.length) return lanes;
@@ -225,7 +245,24 @@ async function main(argv) {
}
process.on("SIGINT", () => process.stdout.write("\ne2e:all: SIGINT — waiting for the suites to stop\n"));
const t0 = Date.now();
- const results = (await Promise.all(lanes.map((lane) => runLane(lane, logDir)))).flat();
+ const waits = laneWaits(lanes);
+ const running = new Map();
+ for (const lane of lanes) {
+ const before = waits.get(lane.pkg).map((p) => running.get(p));
+ running.set(
+ lane.pkg,
+ Promise.all(before).then(() => {
+ if (before.length) {
+ const reasons = lane.after.filter((a) => waits.get(lane.pkg).includes(a.pkg));
+ process.stdout.write(
+ `e2e:all: ${lane.pkg} lane starts after ${reasons.map((a) => `${a.pkg} (they share ${a.shares})`).join(", ")}\n`,
+ );
+ }
+ return runLane(lane, logDir);
+ }),
+ );
+ }
+ const results = (await Promise.all(lanes.map((l) => running.get(l.pkg)))).flat();
process.stdout.write(`\n${renderSummary(results, { wallMs: Date.now() - t0 })}`);
for (const r of results.filter((x) => x.code !== 0 && !x.report)) {
const tail = fs.readFileSync(path.join(REPO_ROOT, r.log), "utf8").trimEnd().split("\n").slice(-12);
diff --git a/scripts/e2e-all.test.mjs b/scripts/e2e-all.test.mjs
@@ -4,7 +4,7 @@ import assert from "node:assert/strict";
import fs from "node:fs";
import path from "node:path";
import test from "node:test";
-import { LANES, REPO_ROOT, readReport, renderSummary, selectLanes } from "./e2e-all.mjs";
+import { LANES, REPO_ROOT, laneWaits, readReport, renderSummary, selectLanes } from "./e2e-all.mjs";
test("every lane names its package's real e2e scripts and their json reports", () => {
for (const lane of LANES) {
@@ -82,3 +82,25 @@ test("the summary: one row per suite, totals, the wall against the sum, and the
assert.match(out, /e2e:all FAILED — 20 passed, 1 failed, 1 flaky, 4 skipped; wall 5m00s \(the suites' own times add up to 4m30s\)/);
assert.match(out, /editor — failed:\n {2}a\.spec\.ts:9 breaks/);
});
+
+test("lanes that share a tree of the checkout never overlap: export's starts after the editor's", () => {
+ const waits = laneWaits(LANES);
+ assert.deepEqual(waits.get("export"), ["editor"]);
+ assert.deepEqual(waits.get("editor"), []);
+ assert.deepEqual(waits.get("homepage"), []);
+ assert.deepEqual(waits.get("umtool"), []);
+ // A lane waits only for an EARLIER lane (e2e:all starts them in order), and
+ // names what they share.
+ LANES.forEach((lane, i) => {
+ for (const a of lane.after ?? []) {
+ assert.ok(LANES.slice(0, i).some((l) => l.pkg === a.pkg), `${lane.pkg} waits for a later lane ${a.pkg}`);
+ assert.match(a.shares, /export\/public/);
+ }
+ });
+ // Not selected, not waited for.
+ assert.deepEqual(laneWaits(selectLanes(["export"])).get("export"), []);
+ assert.deepEqual(laneWaits(selectLanes(["editor", "export-hub"])).get("export"), ["editor"]);
+ // And outside e2e:all, the editor suite holds export's queue for its whole run.
+ const editorE2e = JSON.parse(fs.readFileSync(path.join(REPO_ROOT, "editor", "package.json"), "utf8")).scripts.e2e;
+ assert.match(editorE2e, /--with e2e-export /);
+});
diff --git a/scripts/queue-lock.mjs b/scripts/queue-lock.mjs
@@ -121,6 +121,9 @@ function parseArgv(argv) {
scaleBy: null,
build: undefined,
prebuild: null,
+ // `--with e2e-export`: more queues this suite holds for its whole run —
+ // the suites it shares a mutable tree with (see withQueue).
+ alsoQueues: [],
// Unset unless --timeout: the e2e queue defaults it from E2E_QUEUE_TIMEOUT,
// the heavy slot from HEAVY_TIMEOUT.
timeoutMs: undefined,
@@ -144,6 +147,7 @@ function parseArgv(argv) {
else if (f === "--build") opts.build = true;
else if (f === "--scale-by") opts.scaleBy = flags[++i];
else if (f === "--prebuild") opts.prebuild = flags[++i];
+ else if (f === "--with") opts.alsoQueues.push(...String(flags[++i] ?? "").split(",").filter(Boolean));
else {
process.stderr.write(`queue-lock: unknown flag '${f}'\n`);
process.exit(2);
@@ -1252,6 +1256,28 @@ export async function withQueue(opts, fn) {
}
const releaseQueue = await holdQueue();
+ // SHARED TREES. Two suites that write one tree of the checkout must not run
+ // at once, whatever their names: the editor suite's export dev server serves
+ // `export/public` and its build specs point `export/out`, and export's own
+ // suites rewrite both (e2e:2origin's hub build composes into export/public;
+ // the default config writes public/sw.js). So the editor suite holds the
+ // `e2e-export` queue as well (`--with e2e-export`), always after its own —
+ // one order, so no two holders wait on each other.
+ const alsoReleases = [];
+ try {
+ for (const other of [...new Set(opts.alsoQueues ?? [])].filter((n) => n !== name).sort()) {
+ alsoReleases.push(
+ await holdLock(lockFileFor(other), name, opts.cmd ?? [name], timeoutMs, {
+ ...E2E_LOCK,
+ label: `the ${other} queue (a tree this suite shares)`,
+ }),
+ );
+ }
+ } catch (err) {
+ for (const r of alsoReleases.reverse()) await r();
+ await releaseQueue();
+ throw err;
+ }
try {
await preflight(ports, graceMs);
if (opts.prebuild) {
@@ -1260,6 +1286,7 @@ export async function withQueue(opts, fn) {
}
return opts.heavySlot === false ? await fn() : await withHeavy(heavyOpts, fn);
} finally {
+ for (const r of alsoReleases.reverse()) await r();
await releaseQueue();
}
}
diff --git a/scripts/queue-lock.test.mjs b/scripts/queue-lock.test.mjs
@@ -788,3 +788,19 @@ test("--scale-by: an estimate per worker, times the editor suite's E2E_WORKERS",
assert.equal(ticket.estimateMb, 4500);
assert.equal((await run.done).code, 0);
});
+
+test("--with: a suite that shares a tree holds the other suite's queue too", async () => {
+ const dir = tmpDir();
+ const log = path.join(dir, "order.log");
+ const env = heavyEnv(dir, { E2E_QUEUE_LOCK_FILE: path.join(dir, "q.lock") });
+ const editor = startLock(["--name", "e2e-editor", "--with", "e2e-export", "--estimate", "100", "--", ...markerCmd(log, "e", 700)], env);
+ await until(() => fs.existsSync(path.join(dir, "q.lock.e2e-export.holder.json")));
+ const exp = startLock(["--name", "e2e-export", "--estimate", "100", "--", ...markerCmd(log, "x", 50)], env);
+ await exp.waitFor(/waiting for the e2e queue — held by .*pid \d+/);
+ const umtool = await runLock(["--name", "e2e-umtool", "--estimate", "100", "--", ...markerCmd(log, "u", 50)], env);
+ for (const r of [await editor.done, await exp.done, umtool]) assert.equal(r.code, 0, r.stderr);
+ const order = fs.readFileSync(log, "utf8");
+ assert.ok(order.indexOf("Sx") > order.indexOf("Ee"), `export ran beside the editor: ${order}`);
+ assert.ok(order.indexOf("Su") < order.indexOf("Ee"), `umtool waited for the editor: ${order}`);
+ assert.equal(fs.existsSync(path.join(dir, "q.lock.e2e-export.holder.json")), false);
+});