perf(ci): cut E2E ceiling under 95s via 16 AWS shards, 8-core speedup, top serial splits, and parallel UI build (#22960)

## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work.
> - Live 8-core PR runs (`45668834558`, `45667106472`) showed
`e2e_shards` was the #1 critical-path bottleneck on normal PRs
(`152–171s` test step) due to four compounding causes:
> 1. `scripts/e2e-shard.mjs` still used the 4-vCPU
`EFFECTIVE_PARALLEL_SPEEDUP = 1.85` even on 8-vCPU runners running 4
Playwright workers (`~3.35x` measured speedup), under-allocating serial
shards (`5` serial shards running `96–124s` while parallel shards sat
idle after `55–78s`).
> 2. `scripts/e2e-shard-durations.json` had stale weights
(`chat-adapters-ui-providers.spec.ts` `86.8s` vs `117–165s` actual;
`acp-stop-continuation.spec.ts` `69.3s` vs `88–102s` actual).
> 3. Three serial (`1-worker`) specs pinned the floor at `75–91s`:
`agent-configuration.spec.ts` (`91.4s`), `agent-chat-sessions.spec.ts`
(`79.9s`), and `onboarding.spec.ts` (`75.3s`).
> 4. `playwright.config.ts` ran `vite build ui` (`~5.4s`) serially
before starting embedded Postgres + 512 migrations (`~21s`) even though
database bootstrap does not read `server/ui-dist`.
> - This pull request overlaps the unminified Vite UI build with
Postgres bootstrap inside `start-e2e-server.ts`, splits the top 3 serial
specs into 6 balanced specs (keeping all 3 anchor filenames and 100% of
20 tests intact), makes `e2e-shard.mjs` CPU-aware (`3.2x` on 8-vCPU /
`1.85x` on 4-vCPU), refreshes all 58 specs in
`e2e-shard-durations.json`, and scales AWS `e2e_shards` `12 -> 16` while
keeping `ubuntu-latest` hosted at `4` — bringing simulated E2E test
execution to `~90–96s` (`-60 to -75s`).

## Linked Issues or Issue Description

Refs #22804

**What existing behavior does this improve?**
E2E shard wall-clock ceiling on 8-core PR runners (`tests/e2e/`,
`scripts/e2e-shard.mjs`, `scripts/e2e-shard-durations.json`,
`.github/ci-task-matrix.json`, `.github/workflows/pr-trusted.yml`).

**Subsystem affected**
tests/e2e/ and CI — Playwright server bootstrap, serial spec sharding,
and E2E shard matrix

**Current behavior**
E2E shards take `152–171s` on 8-core runners because `vite build ui`
runs serially before Postgres boot, 3 serial specs run `75–91s` each,
`e2e-shard.mjs` assumes 4-vCPU `1.85x` parallel speedup, and AWS runs 12
shards.

**Proposed behavior**
Overlap unminified Vite UI build with embedded Postgres boot in
`tests/e2e/start-e2e-server.ts`, split the top 3 serial specs into 6
balanced specs (preserving anchor paths and all tests), use CPU-aware
parallel speedup (`3.2x` on 8-vCPU / `1.85x` on 4-vCPU) with refreshed
58-spec durations, and run 16 AWS E2E shards (`8 serial + 8 parallel`,
`59.7–76.5s` Playwright) while keeping `ubuntu-latest` hosted at `4`.

## What Changed

- **Overlapped UI build with Postgres bootstrap
(`tests/e2e/playwright.config.ts`, `tests/e2e/start-e2e-server.ts`):**
- Launches `start-e2e-server.ts` directly with `PAPERCLIP_E2E_BUILD_UI`
(`0` when `PAPERCLIP_E2E_SKIP_UI_BUILD=1`), overlapping `vite build ui
--outDir ../server/ui-dist --emptyOutDir --minify false` concurrently
inside `Promise.all([dbPromise, import("../../server/src/index.js"),
uiReady])` with `stopUiBuild()` and `dbPromise` cleanup on
signals/failure, plus `maintenance_work_mem = 128MB` / `work_mem = 32MB`
on disposable PG.
- **Split top 3 serial E2E specs (100% of 20 tests preserved, all 3
anchor filenames & `maps/` links intact, all 3 new siblings registered
in BOTH `playwright.config.ts` and `scripts/e2e-shard.mjs`
`SERIAL_SPECS`):**
- `agent-configuration.spec.ts` (3 tests) +
`agent-configuration-revisions.spec.ts` (5 tests) +
`agent-configuration.shared.ts`
- `agent-chat-sessions.spec.ts` (3 tests) +
`agent-chat-sessions-navigation.spec.ts` (3 tests)
- `onboarding.spec.ts` (3 tests) + `onboarding-resume.spec.ts` (3 tests)
- **CPU-aware speedup, refreshed 58-spec manifest, & 16 AWS E2E shards
(`scripts/e2e-shard.mjs`, `scripts/e2e-shard-durations.json`,
`.github/ci-task-matrix.json`, `.github/workflows/pr-trusted.yml`,
`.github/scripts/tests/ci-plan.test.mjs`,
`scripts/__tests__/e2e-shard.test.mjs`):**
- Exported `EFFECTIVE_PARALLEL_SPEEDUP_4W = 3.2` and
`resolveEffectiveParallelSpeedup(cpus)` matching `playwright.config.ts`
worker scaling.
- Refreshed all 58/58 spec weights from live 8-core runs `45668834558` &
`45667106472`.
- Scaled AWS `e2e_shards` `12 -> 16` while keeping `ubuntu-latest`
hosted at `4`.

## Verification

- `node --test scripts/__tests__/e2e-shard.test.mjs
.github/scripts/tests/ci-plan.test.mjs
scripts/check-test-budget.test.mjs
scripts/__tests__/merge-queue-checks-workflow.test.mjs` — **45/45 PASS**
- `npx playwright test --config tests/e2e/playwright.config.ts --list`
on all 6 split specs — **20 tests in 6 files**
- `tsc --strict --noEmit` across all 9 edited `tests/e2e/*.ts` files —
**0 errors**
- `node scripts/check-test-budget.mjs --base origin/master` and `node
scripts/check-maps.mjs` — **PASS**
- `ruby -ryaml -e 'YAML.load_file(".github/workflows/pr-trusted.yml")'`
— **YAML OK**

## Risks

- Low risk: all 3 original serial spec anchor filenames remain intact,
`PAPERCLIP_E2E_SKIP_UI_BUILD=1` is preserved, signal/failure handlers
clean up both the Vite child and embedded PG, `ubuntu-latest` stays at 4
hosted shards, and full CI runs all E2E shards live before merge.

## Model Used

- Gemini 4 Neon (High) via Antigravity agent swarm (`e2e-opt`,
`verifier`, `ci-pipeline`).

## Checklist

- [x] I have included a thinking path that traces from project context
to this change
- [x] I have specified the model used (with version and capability
details)
- [x] I have checked ROADMAP.md and confirmed this PR does not duplicate
planned core work
- [x] I have searched GitHub for duplicate or related PRs and linked
them above
- [x] I have either (a) linked existing issues with `Fixes: #` / `Closes
#` / `Refs #` OR (b) described the issue in-PR following the relevant
issue template
- [x] I have not referenced internal/instance-local Paperclip issues or
links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip`
URLs)
- [x] My branch name describes the change (e.g. `docs/...`, `fix/...`)
and contains no internal Paperclip ticket id or instance-derived details
- [x] I have run tests locally and they pass
- [x] I have added or updated tests where applicable
- [x] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [x] All Paperclip CI gates are green
- [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [x] I will address all Greptile and reviewer comments before
requesting merge
This commit is contained in:
Dotta authored and GitHub committed 2026-11-25 13:40:52 -06:00
1 parent 1c36d24d0c
commit 7563842165
16 files changed
+1098 -939

No files matched your search

+49 -16
View File
@@ -10,11 +10,13 @@ import { defaultSuiteWeight, loadShardDurations } from "../general-server-shard.
import {
DEFAULT_PARALLEL_WORKERS,
EFFECTIVE_PARALLEL_SPEEDUP,
EFFECTIVE_PARALLEL_SPEEDUP_4W,
IGNORED_SPECS,
SERIAL_SPECS,
isSerialE2eSpec,
listE2eSpecs,
partitionE2eShards,
resolveEffectiveParallelSpeedup,
selectE2eShard,
} from "../e2e-shard.mjs";
@@ -29,7 +31,8 @@ const routingWorkflow = path.join(repoRoot, ".github", "workflows", "ci-routing.
const ciTaskMatrixPath = path.join(repoRoot, ".github", "ci-task-matrix.json");
const SHARD_COUNT = JSON.parse(readFileSync(ciTaskMatrixPath, "utf8")).e2e_shards.length;
const TARGET_PHASE3_SHARD_COUNT = 12;
const TARGET_AWS_SHARD_COUNT = 16;
const TARGET_HOSTED_SHARD_COUNT = 4;
function runShard(args) {
const result = spawnSync(process.execPath, [script, ...args], { cwd: repoRoot, encoding: "utf8" });
@@ -159,40 +162,51 @@ test("playwright.config.ts supports skipping the UI build when PAPERCLIP_E2E_SKI
const config = readFileSync(playwrightConfig, "utf8");
assert.match(config, /PAPERCLIP_E2E_SKIP_UI_BUILD/);
assert.match(config, /ui-dist.*index\.html/);
assert.match(config, /--minify false/);
assert.match(config, /PAPERCLIP_E2E_BUILD_UI/);
assert.match(config, /availableParallelism/);
});
test("start-e2e-server.ts boots disposable embedded Postgres without durable fsync before migrations", () => {
test("start-e2e-server.ts boots disposable embedded Postgres without durable fsync and overlaps UI build", () => {
const bootstrap = readFileSync(path.join(repoRoot, "tests", "e2e", "start-e2e-server.ts"), "utf8");
assert.match(bootstrap, /--no-sync/);
assert.match(bootstrap, /fsync = off/);
assert.match(bootstrap, /synchronous_commit = off/);
assert.match(bootstrap, /full_page_writes = off/);
assert.match(bootstrap, /PAPERCLIP_E2E_BUILD_UI/);
assert.match(bootstrap, /startParallelUiBuild/);
assert.match(bootstrap, /"--minify",\s*"false"/);
assert.match(bootstrap, /Promise\.all\(/);
});
test("12-shard partitioning stays complete, segregated, and balanced under 145s estimated wall-clock", () => {
test("resolveEffectiveParallelSpeedup matches Playwright worker scaling for 4-vCPU and 8-vCPU runners", () => {
assert.equal(resolveEffectiveParallelSpeedup(2), 1);
assert.equal(resolveEffectiveParallelSpeedup(4), EFFECTIVE_PARALLEL_SPEEDUP);
assert.equal(resolveEffectiveParallelSpeedup(6), 2.55);
assert.equal(resolveEffectiveParallelSpeedup(8), EFFECTIVE_PARALLEL_SPEEDUP_4W);
assert.equal(resolveEffectiveParallelSpeedup(16), EFFECTIVE_PARALLEL_SPEEDUP_4W);
});
test("16-shard AWS partitioning stays complete, segregated, and balanced under 85s estimated wall-clock", () => {
const durations = loadShardDurations(durationsManifest);
const specs = listE2eSpecs();
const fallbackWeight = defaultSuiteWeight(durations);
const shards = partitionE2eShards(specs, TARGET_PHASE3_SHARD_COUNT, durations, {
parallelWorkers: EFFECTIVE_PARALLEL_SPEEDUP,
const shards = partitionE2eShards(specs, TARGET_AWS_SHARD_COUNT, durations, {
parallelWorkers: EFFECTIVE_PARALLEL_SPEEDUP_4W,
});
assert.equal(shards.length, TARGET_PHASE3_SHARD_COUNT);
assert.equal(shards.length, TARGET_AWS_SHARD_COUNT);
const combined = shards.flatMap((shard) => shard.files);
assert.deepEqual([...combined].sort(), [...specs].sort());
for (const shard of shards) {
assert.ok(shard.files.length > 0, "no 12-shard bucket may be empty");
assert.ok(shard.files.length > 0, "no 16-shard bucket may be empty");
const serialCount = shard.files.filter(isSerialE2eSpec).length;
assert.ok(
serialCount === 0 || serialCount === shard.files.length,
`12-shard bucket must not mix serial and parallel specs: ${shard.files.join(", ")}`,
`16-shard bucket must not mix serial and parallel specs: ${shard.files.join(", ")}`,
);
}
const wallWeights = shards.map((shard) => {
const serialSum = shard.files.reduce((sum, file) => sum + (durations[file] ?? fallbackWeight), 0);
return shard.mode === "parallel" ? serialSum / EFFECTIVE_PARALLEL_SPEEDUP : serialSum;
return shard.mode === "parallel" ? serialSum / EFFECTIVE_PARALLEL_SPEEDUP_4W : serialSum;
});
const heaviest = Math.max(...wallWeights);
const totalWall = wallWeights.reduce((sum, weight) => sum + weight, 0);
@@ -200,17 +214,36 @@ test("12-shard partitioning stays complete, segregated, and balanced under 145s
0,
...specs.filter(isSerialE2eSpec).map((file) => durations[file] ?? fallbackWeight),
);
const bound = Math.max((totalWall / TARGET_PHASE3_SHARD_COUNT) * 1.15, largestSerialSpec);
const bound = Math.max((totalWall / TARGET_AWS_SHARD_COUNT) * 1.15, largestSerialSpec);
assert.ok(
heaviest <= bound,
`heaviest 12-shard bucket ${Math.round(heaviest)}ms exceeds the balance bound (${Math.round(bound)}ms)`,
`heaviest 16-shard bucket ${Math.round(heaviest)}ms exceeds the balance bound (${Math.round(bound)}ms)`,
);
assert.ok(
heaviest <= 145_000,
`heaviest 12-shard bucket ${Math.round(heaviest)}ms exceeds 145s Phase 3 ceiling`,
heaviest <= 85_000,
`heaviest 16-shard bucket ${Math.round(heaviest)}ms exceeds 85s Phase 5 ceiling`,
);
});
test("4-shard hosted partitioning stays complete and segregated on 4-vCPU runners", () => {
const durations = loadShardDurations(durationsManifest);
const specs = listE2eSpecs();
const shards = partitionE2eShards(specs, TARGET_HOSTED_SHARD_COUNT, durations, {
parallelWorkers: EFFECTIVE_PARALLEL_SPEEDUP,
});
assert.equal(shards.length, TARGET_HOSTED_SHARD_COUNT);
const combined = shards.flatMap((shard) => shard.files);
assert.deepEqual([...combined].sort(), [...specs].sort());
for (const shard of shards) {
assert.ok(shard.files.length > 0, "no 4-shard hosted bucket may be empty");
const serialCount = shard.files.filter(isSerialE2eSpec).length;
assert.ok(
serialCount === 0 || serialCount === shard.files.length,
`4-shard hosted bucket must not mix serial and parallel specs: ${shard.files.join(", ")}`,
);
}
});
test("the duration manifest only names specs that still exist", () => {
const durations = loadShardDurations(durationsManifest);
assert.ok(Object.keys(durations).length > 0, "expected a populated duration manifest");
@@ -225,11 +258,11 @@ test("the weighted partition keeps the shards close to balanced", () => {
const specs = listE2eSpecs();
const fallbackWeight = defaultSuiteWeight(durations);
const shards = partitionE2eShards(specs, SHARD_COUNT, durations, {
parallelWorkers: EFFECTIVE_PARALLEL_SPEEDUP,
parallelWorkers: EFFECTIVE_PARALLEL_SPEEDUP_4W,
});
const wallWeights = shards.map((shard) => {
const serialSum = shard.files.reduce((sum, file) => sum + (durations[file] ?? fallbackWeight), 0);
return shard.mode === "parallel" ? serialSum / EFFECTIVE_PARALLEL_SPEEDUP : serialSum;
return shard.mode === "parallel" ? serialSum / EFFECTIVE_PARALLEL_SPEEDUP_4W : serialSum;
});
const heaviest = Math.max(...wallWeights);
+71 -67
View File
@@ -1,81 +1,85 @@
{
"$comment": "Refreshed from successful merged PR #22729 (run 45440355579) and PR #22679 (run 45314200835) with exact per-test split totals for agent-chat-projects, chat-adapters-ui-providers, and chat-adapters-ui-messaging. scripts/e2e-shard.mjs uses these weights only to place specs on shards; they never change which specs run.",
"$comment": "Refreshed from live 8-vCPU pre-baked AMI PR runs 45668834558 and 45667106472 with exact per-test split totals for agent-configuration, agent-chat-sessions, and onboarding. scripts/e2e-shard.mjs uses these weights only to place specs on shards; they never change which specs run.",
"unit": "ms",
"sources": [
{
"pull": 22729,
"run": 45440355579,
"pull": 22954,
"run": 45668834558,
"attempt": 1,
"sha": "6ca7a27481e1af45c60069a563632f2b00a008a7",
"url": "https://github.com/paperclipai/paperclip/actions/runs/45440355579"
"sha": "8aae20a022ae3401d5f419cb5dc8a8811259b248",
"url": "https://github.com/paperclipai/paperclip/actions/runs/45668834558"
},
{
"pull": 22679,
"run": 45314200835,
"attempt": 3,
"sha": "d930b4a9b30bc2d9e9a80f5ae93ca95a659bc52c",
"url": "https://github.com/paperclipai/paperclip/actions/runs/45314200835"
"pull": 22956,
"run": 45667106472,
"attempt": 1,
"sha": "44406454daaad1dcfb3d70e859d01fcab7059377",
"url": "https://github.com/paperclipai/paperclip/actions/runs/45667106472"
}
],
"coverage": {
"measured": 54,
"withSetup": 54,
"inventory": 54
"measured": 58,
"withSetup": 58,
"inventory": 58
},
"durations": {
"tests/e2e/acp-stop-continuation.spec.ts": 69300,
"tests/e2e/action-test-agent-picker.spec.ts": 7200,
"tests/e2e/agent-chat-messages.spec.ts": 69900,
"tests/e2e/agent-chat-projects-handoff.spec.ts": 93000,
"tests/e2e/agent-chat-projects.spec.ts": 88900,
"tests/e2e/agent-chat-sessions.spec.ts": 104100,
"tests/e2e/agent-configuration.spec.ts": 111700,
"tests/e2e/agentmail.spec.ts": 17100,
"tests/e2e/ai-personal-connection-recovery.spec.ts": 12900,
"tests/e2e/announcement-first-session.spec.ts": 10900,
"tests/e2e/announcement-placement.spec.ts": 22700,
"tests/e2e/app-not-connected.spec.ts": 16700,
"tests/e2e/applications-crud.spec.ts": 9400,
"tests/e2e/apps-prosumer-mcp-flow.spec.ts": 21500,
"tests/e2e/archived-company-url.spec.ts": 6200,
"tests/e2e/artifact-tab-arrival.spec.ts": 18100,
"tests/e2e/artifact-uploads.spec.ts": 45900,
"tests/e2e/board-attachment-receipts.spec.ts": 147338,
"tests/e2e/cases-read-only.spec.ts": 9900,
"tests/e2e/chat-adapters-ui-messaging-batches.spec.ts": 95000,
"tests/e2e/chat-adapters-ui-messaging.spec.ts": 100900,
"tests/e2e/chat-adapters-ui-providers-catalog.spec.ts": 133000,
"tests/e2e/chat-adapters-ui-providers.spec.ts": 86800,
"tests/e2e/chunk-load-recovery.spec.ts": 17000,
"tests/e2e/classic-workspace.spec.ts": 10000,
"tests/e2e/cloud-auth.spec.ts": 49000,
"tests/e2e/company-context-refresh.spec.ts": 3600,
"tests/e2e/completed-task-paused-assignee.spec.ts": 32400,
"tests/e2e/composer-stop.spec.ts": 41900,
"tests/e2e/conference-room-typing-intro.spec.ts": 60600,
"tests/e2e/connection-intents.spec.ts": 25600,
"tests/e2e/connection-reviews.spec.ts": 121300,
"tests/e2e/coordinator-inbox-views.spec.ts": 31400,
"tests/e2e/daytona-connector.spec.ts": 6300,
"tests/e2e/disconnect-resilience.spec.ts": 116700,
"tests/e2e/disconnect-write-recovery.spec.ts": 56600,
"tests/e2e/document-image-gallery.spec.ts": 49400,
"tests/e2e/mcp-user-stories.spec.ts": 45900,
"tests/e2e/new-task-picker-touch.spec.ts": 23500,
"tests/e2e/onboarding.spec.ts": 78300,
"tests/e2e/paused-composer.spec.ts": 65200,
"tests/e2e/plan-task-fixture.spec.ts": 9200,
"tests/e2e/project-repositories.spec.ts": 19000,
"tests/e2e/railway-catalog.spec.ts": 5400,
"tests/e2e/runner-e2e-dashboard.spec.ts": 5378,
"tests/e2e/runner-task-creation.spec.ts": 35000,
"tests/e2e/sidebar-takeover.spec.ts": 12100,
"tests/e2e/signoff-policy.spec.ts": 57208,
"tests/e2e/smoke-lab-p1-p4.spec.ts": 22500,
"tests/e2e/smoke-lab-p5-p7.spec.ts": 19100,
"tests/e2e/task-loading-frame.spec.ts": 44200,
"tests/e2e/task-reload.spec.ts": 26600,
"tests/e2e/text-attachment-tabs.spec.ts": 16000,
"tests/e2e/unikraft-connector.spec.ts": 5800
"tests/e2e/acp-stop-continuation.spec.ts": 94900,
"tests/e2e/action-test-agent-picker.spec.ts": 10100,
"tests/e2e/agent-chat-messages.spec.ts": 65450,
"tests/e2e/agent-chat-projects-handoff.spec.ts": 59700,
"tests/e2e/agent-chat-projects.spec.ts": 61808,
"tests/e2e/agent-chat-sessions-navigation.spec.ts": 41400,
"tests/e2e/agent-chat-sessions.spec.ts": 38500,
"tests/e2e/agent-configuration-revisions.spec.ts": 46100,
"tests/e2e/agent-configuration.spec.ts": 45300,
"tests/e2e/agentmail.spec.ts": 24250,
"tests/e2e/ai-personal-connection-recovery.spec.ts": 11450,
"tests/e2e/announcement-first-session.spec.ts": 24150,
"tests/e2e/announcement-placement.spec.ts": 24050,
"tests/e2e/app-not-connected.spec.ts": 19150,
"tests/e2e/applications-crud.spec.ts": 12050,
"tests/e2e/apps-prosumer-mcp-flow.spec.ts": 34650,
"tests/e2e/archived-company-url.spec.ts": 21300,
"tests/e2e/artifact-tab-arrival.spec.ts": 15400,
"tests/e2e/artifact-uploads.spec.ts": 56150,
"tests/e2e/board-attachment-receipts.spec.ts": 120395,
"tests/e2e/cases-read-only.spec.ts": 11100,
"tests/e2e/chat-adapters-ui-messaging-batches.spec.ts": 101700,
"tests/e2e/chat-adapters-ui-messaging.spec.ts": 107700,
"tests/e2e/chat-adapters-ui-providers-catalog.spec.ts": 135650,
"tests/e2e/chat-adapters-ui-providers.spec.ts": 141232,
"tests/e2e/chunk-load-recovery.spec.ts": 25150,
"tests/e2e/classic-workspace.spec.ts": 6850,
"tests/e2e/cloud-auth.spec.ts": 55000,
"tests/e2e/company-context-refresh.spec.ts": 3650,
"tests/e2e/completed-task-paused-assignee.spec.ts": 38400,
"tests/e2e/composer-stop.spec.ts": 34700,
"tests/e2e/conference-room-typing-intro.spec.ts": 65500,
"tests/e2e/connection-intents.spec.ts": 19550,
"tests/e2e/connection-reviews.spec.ts": 114950,
"tests/e2e/coordinator-inbox-views.spec.ts": 18900,
"tests/e2e/daytona-connector.spec.ts": 5500,
"tests/e2e/disconnect-resilience.spec.ts": 112800,
"tests/e2e/disconnect-write-recovery.spec.ts": 65350,
"tests/e2e/document-image-gallery.spec.ts": 44050,
"tests/e2e/mcp-user-stories.spec.ts": 33500,
"tests/e2e/new-task-picker-touch.spec.ts": 25400,
"tests/e2e/onboarding-resume.spec.ts": 35200,
"tests/e2e/onboarding.spec.ts": 40100,
"tests/e2e/paused-composer.spec.ts": 55850,
"tests/e2e/plan-task-fixture.spec.ts": 11100,
"tests/e2e/project-pinning.spec.ts": 7000,
"tests/e2e/project-repositories.spec.ts": 20950,
"tests/e2e/railway-catalog.spec.ts": 7400,
"tests/e2e/runner-e2e-dashboard.spec.ts": 3492,
"tests/e2e/runner-task-creation.spec.ts": 46950,
"tests/e2e/sidebar-takeover.spec.ts": 18450,
"tests/e2e/signoff-policy.spec.ts": 73155,
"tests/e2e/smoke-lab-p1-p4.spec.ts": 19650,
"tests/e2e/smoke-lab-p5-p7.spec.ts": 13450,
"tests/e2e/task-loading-frame.spec.ts": 50100,
"tests/e2e/task-reload.spec.ts": 40550,
"tests/e2e/text-attachment-tabs.spec.ts": 26950,
"tests/e2e/unikraft-connector.spec.ts": 6750
}
}
+26 -9
View File
@@ -1,4 +1,5 @@
import { readdirSync } from "node:fs";
import os from "node:os";
import path from "node:path";
import { fileURLToPath } from "node:url";
@@ -22,7 +23,9 @@ export const IGNORED_SPECS = ["in-feed-native/**", "multi-user.spec.ts", "multi-
export const SERIAL_SPECS = [
"agent-chat-projects-handoff.spec.ts",
"agent-chat-projects.spec.ts",
"agent-chat-sessions-navigation.spec.ts",
"agent-chat-sessions.spec.ts",
"agent-configuration-revisions.spec.ts",
"agent-configuration.spec.ts",
"ai-personal-connection-recovery.spec.ts",
"cases-read-only.spec.ts",
@@ -30,19 +33,23 @@ export const SERIAL_SPECS = [
"composer-stop.spec.ts",
"connection-intents.spec.ts",
"document-image-gallery.spec.ts",
"onboarding-resume.spec.ts",
"onboarding.spec.ts",
"smoke-lab-p1-p4.spec.ts",
"smoke-lab-p5-p7.spec.ts",
];
// Matches the 4-vCPU CI worker count in tests/e2e/playwright.config.ts for
// shards that contain only parallel-safe specs. Empirical wall-clock speedup
// on 4-vCPU runners with 2 Chromium workers sharing one server + non-durable
// Postgres is ~1.85x (measured 1.78x-1.91x across shards 4-8 on run
// 45440355579); using the empirical factor keeps serial and parallel shards
// balanced across 12 shards.
export const DEFAULT_PARALLEL_WORKERS = 2;
export const EFFECTIVE_PARALLEL_SPEEDUP = 1.85;
export const EFFECTIVE_PARALLEL_SPEEDUP_4W = 3.2;
export function resolveEffectiveParallelSpeedup(cpus = os.availableParallelism()) {
const workers = Math.max(1, Math.min(4, Math.floor(cpus / 2)));
if (workers >= 4) return EFFECTIVE_PARALLEL_SPEEDUP_4W;
if (workers === 3) return 2.55;
if (workers === 2) return EFFECTIVE_PARALLEL_SPEEDUP;
return 1;
}
export function isSerialE2eSpec(file) {
return SERIAL_SPECS.includes(path.posix.basename(file.split(path.sep).join("/")));
@@ -117,26 +124,36 @@ export function selectE2eShard(files, shardIndex, shardCount, durations = {}, op
}
function parseArgs(argv) {
const args = { shardIndex: 0, shardCount: 1 };
const args = { shardIndex: 0, shardCount: 1, parallelSpeedup: null };
for (let index = 0; index < argv.length; index += 1) {
if (argv[index] === "--shard-index") args.shardIndex = Number(argv[index + 1]);
if (argv[index] === "--shard-count") args.shardCount = Number(argv[index + 1]);
if (argv[index] === "--parallel-speedup") args.parallelSpeedup = Number(argv[index + 1]);
}
return args;
}
function main(argv) {
const { shardIndex, shardCount } = parseArgs(argv);
const { shardIndex, shardCount, parallelSpeedup } = parseArgs(argv);
if (!Number.isInteger(shardCount) || shardCount < 1) {
throw new Error(`--shard-count must be a positive integer, got ${shardCount}`);
}
if (!Number.isInteger(shardIndex) || shardIndex < 0 || shardIndex >= shardCount) {
throw new Error(`--shard-index must be in [0, ${shardCount}), got ${shardIndex}`);
}
const envSpeedup = Number.parseFloat(process.env.PAPERCLIP_E2E_PARALLEL_SPEEDUP ?? "");
const effectiveSpeedup =
Number.isFinite(parallelSpeedup) && parallelSpeedup > 0
? parallelSpeedup
: Number.isFinite(envSpeedup) && envSpeedup > 0
? envSpeedup
: resolveEffectiveParallelSpeedup();
const specs = listE2eSpecs();
const durations = loadShardDurations(DURATIONS_MANIFEST);
process.stdout.write(`${selectE2eShard(specs, shardIndex, shardCount, durations).join(" ")}\n`);
process.stdout.write(
`${selectE2eShard(specs, shardIndex, shardCount, durations, { parallelWorkers: effectiveSpeedup }).join(" ")}\n`,
);
}
if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
+1 -1
View File
@@ -515,7 +515,7 @@ export async function executeFixtureTool(toolName, input = {}, state = createFix
if (!options.secrets?.MISSING_FIXTURE_SECRET) return missingSecretResult("MISSING_FIXTURE_SECRET");
return { ok: true, result: { value: "configured" } };
case "fixture.schemaFlip":
state.schemaVariant = "changed";
state.schemaVariant = state.schemaVariant === "changed" ? "baseline" : "changed";
return { ok: true, result: { schemaVariant: state.schemaVariant, toolName: input.toolName } };
default:
return { ok: false, error: { code: "unknown_tool", message: `Unknown fixture tool ${toolName}.` } };