mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-26 01:39:51 +01:00
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:
1 parent
1c36d24d0c
commit
7563842165
16 files changed
+1098
-939
No files matched your search
+48
-24
@@ -323,74 +323,98 @@
|
||||
"e2e_shards": [
|
||||
{
|
||||
"shard_index": 0,
|
||||
"shard_count": 12,
|
||||
"shard_label": "1/12",
|
||||
"shard_count": 16,
|
||||
"shard_label": "1/16",
|
||||
"task": "ci:e2e"
|
||||
},
|
||||
{
|
||||
"shard_index": 1,
|
||||
"shard_count": 12,
|
||||
"shard_label": "2/12",
|
||||
"shard_count": 16,
|
||||
"shard_label": "2/16",
|
||||
"task": "ci:e2e"
|
||||
},
|
||||
{
|
||||
"shard_index": 2,
|
||||
"shard_count": 12,
|
||||
"shard_label": "3/12",
|
||||
"shard_count": 16,
|
||||
"shard_label": "3/16",
|
||||
"task": "ci:e2e"
|
||||
},
|
||||
{
|
||||
"shard_index": 3,
|
||||
"shard_count": 12,
|
||||
"shard_label": "4/12",
|
||||
"shard_count": 16,
|
||||
"shard_label": "4/16",
|
||||
"task": "ci:e2e"
|
||||
},
|
||||
{
|
||||
"shard_index": 4,
|
||||
"shard_count": 12,
|
||||
"shard_label": "5/12",
|
||||
"shard_count": 16,
|
||||
"shard_label": "5/16",
|
||||
"task": "ci:e2e"
|
||||
},
|
||||
{
|
||||
"shard_index": 5,
|
||||
"shard_count": 12,
|
||||
"shard_label": "6/12",
|
||||
"shard_count": 16,
|
||||
"shard_label": "6/16",
|
||||
"task": "ci:e2e"
|
||||
},
|
||||
{
|
||||
"shard_index": 6,
|
||||
"shard_count": 12,
|
||||
"shard_label": "7/12",
|
||||
"shard_count": 16,
|
||||
"shard_label": "7/16",
|
||||
"task": "ci:e2e"
|
||||
},
|
||||
{
|
||||
"shard_index": 7,
|
||||
"shard_count": 12,
|
||||
"shard_label": "8/12",
|
||||
"shard_count": 16,
|
||||
"shard_label": "8/16",
|
||||
"task": "ci:e2e"
|
||||
},
|
||||
{
|
||||
"shard_index": 8,
|
||||
"shard_count": 12,
|
||||
"shard_label": "9/12",
|
||||
"shard_count": 16,
|
||||
"shard_label": "9/16",
|
||||
"task": "ci:e2e"
|
||||
},
|
||||
{
|
||||
"shard_index": 9,
|
||||
"shard_count": 12,
|
||||
"shard_label": "10/12",
|
||||
"shard_count": 16,
|
||||
"shard_label": "10/16",
|
||||
"task": "ci:e2e"
|
||||
},
|
||||
{
|
||||
"shard_index": 10,
|
||||
"shard_count": 12,
|
||||
"shard_label": "11/12",
|
||||
"shard_count": 16,
|
||||
"shard_label": "11/16",
|
||||
"task": "ci:e2e"
|
||||
},
|
||||
{
|
||||
"shard_index": 11,
|
||||
"shard_count": 12,
|
||||
"shard_label": "12/12",
|
||||
"shard_count": 16,
|
||||
"shard_label": "12/16",
|
||||
"task": "ci:e2e"
|
||||
},
|
||||
{
|
||||
"shard_index": 12,
|
||||
"shard_count": 16,
|
||||
"shard_label": "13/16",
|
||||
"task": "ci:e2e"
|
||||
},
|
||||
{
|
||||
"shard_index": 13,
|
||||
"shard_count": 16,
|
||||
"shard_label": "14/16",
|
||||
"task": "ci:e2e"
|
||||
},
|
||||
{
|
||||
"shard_index": 14,
|
||||
"shard_count": 16,
|
||||
"shard_label": "15/16",
|
||||
"task": "ci:e2e"
|
||||
},
|
||||
{
|
||||
"shard_index": 15,
|
||||
"shard_count": 16,
|
||||
"shard_label": "16/16",
|
||||
"task": "ci:e2e"
|
||||
}
|
||||
],
|
||||
|
||||
@@ -49,7 +49,7 @@ test("compactHostedEntries halves ubuntu-latest fan-out while preserving 100% of
|
||||
const full = plan(["package.json"], { forceReason: "Full suite requested by label" });
|
||||
const awsJobs = Object.values(full.jobs).reduce((sum, lane) => sum + lane.total, 0);
|
||||
const hostedJobs = Object.values(full.jobs).reduce((sum, lane) => sum + (lane.hosted_total ?? lane.total), 0);
|
||||
assert.equal(awsJobs, 66);
|
||||
assert.equal(awsJobs, 70);
|
||||
assert.equal(hostedJobs, 33);
|
||||
assert.ok(Buffer.byteLength(JSON.stringify(full)) < 32_768, "dual-profile plan stays compact for GITHUB_OUTPUT/env");
|
||||
|
||||
@@ -93,7 +93,7 @@ test("compactHostedEntries halves ubuntu-latest fan-out while preserving 100% of
|
||||
assert.deepEqual(uiPr.jobs.general_tests.hosted_matrix.include, [
|
||||
{ group: "general-workspaces-a", group_label: "workspaces-a (1/1)", shard_index: 0, shard_count: 1, task: "ci:workspaces-a" },
|
||||
]);
|
||||
assert.equal(uiPr.jobs.e2e_shards.selected, 12);
|
||||
assert.equal(uiPr.jobs.e2e_shards.selected, 16);
|
||||
assert.equal(uiPr.jobs.e2e_shards.hosted_selected, 4);
|
||||
|
||||
const futureEntries = Array.from({ length: 10 }, (_, shard_index) => ({
|
||||
@@ -105,7 +105,7 @@ test("compactHostedEntries halves ubuntu-latest fan-out while preserving 100% of
|
||||
|
||||
const summary = planSummary(full);
|
||||
assert.match(summary, /27\/27 \(hosted: 12\/12\)/);
|
||||
assert.match(summary, /12\/12 \(hosted: 4\/4\)/);
|
||||
assert.match(summary, /16\/16 \(hosted: 4\/4\)/);
|
||||
});
|
||||
|
||||
test("a UI component retains browser and build coverage without unrelated server/Rust jobs", () => {
|
||||
@@ -213,7 +213,7 @@ test("PR workflow keeps Build fast and passes PR-mode context to typecheck and V
|
||||
const runnerSupport = workflow.split("\n verify_runner_e2e_support:\n")[1].split("\n verify:\n")[0];
|
||||
assert.match(runnerSupport, /--shard-index \$\{\{ matrix\.shard_index \}\} --shard-count \$\{\{ matrix\.shard_count \}\}/);
|
||||
assert.equal(lanes.verify_runner_e2e_support.length, 4, "Runner support suite should be 4-way sharded");
|
||||
assert.equal(lanes.e2e_shards.length, 12, "E2E should be 12-way sharded");
|
||||
assert.equal(lanes.e2e_shards.length, 16, "E2E should be 16-way sharded");
|
||||
const typecheck = workflow.split("\n typecheck_release_registry:\n")[1].split("\n general_tests:\n")[0];
|
||||
assert.match(typecheck, /fetch-depth: 2/);
|
||||
assert.match(typecheck, /CI_PLAN: \$\{\{ needs\.gate\.outputs\.plan \}\}/);
|
||||
|
||||
@@ -1831,7 +1831,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
max-parallel: ${{ needs.gate.outputs.runner == 'ubuntu-latest' && 4 || 256 }}
|
||||
matrix: ${{ fromJSON(needs.gate.outputs.plan != '' && toJSON((needs.gate.outputs.runner == 'ubuntu-latest' && fromJSON(needs.gate.outputs.plan).jobs.e2e_shards.hosted_matrix) || fromJSON(needs.gate.outputs.plan).jobs.e2e_shards.matrix) || (needs.gate.outputs.runner == 'ubuntu-latest' && '{"include":[{"shard_index":0,"shard_count":4,"shard_label":"1/4","task":"ci:e2e"},{"shard_index":1,"shard_count":4,"shard_label":"2/4","task":"ci:e2e"},{"shard_index":2,"shard_count":4,"shard_label":"3/4","task":"ci:e2e"},{"shard_index":3,"shard_count":4,"shard_label":"4/4","task":"ci:e2e"}]}' || '{"include":[{"shard_index":0,"shard_count":12,"shard_label":"1/12","task":"ci:e2e"},{"shard_index":1,"shard_count":12,"shard_label":"2/12","task":"ci:e2e"},{"shard_index":2,"shard_count":12,"shard_label":"3/12","task":"ci:e2e"},{"shard_index":3,"shard_count":12,"shard_label":"4/12","task":"ci:e2e"},{"shard_index":4,"shard_count":12,"shard_label":"5/12","task":"ci:e2e"},{"shard_index":5,"shard_count":12,"shard_label":"6/12","task":"ci:e2e"},{"shard_index":6,"shard_count":12,"shard_label":"7/12","task":"ci:e2e"},{"shard_index":7,"shard_count":12,"shard_label":"8/12","task":"ci:e2e"},{"shard_index":8,"shard_count":12,"shard_label":"9/12","task":"ci:e2e"},{"shard_index":9,"shard_count":12,"shard_label":"10/12","task":"ci:e2e"},{"shard_index":10,"shard_count":12,"shard_label":"11/12","task":"ci:e2e"},{"shard_index":11,"shard_count":12,"shard_label":"12/12","task":"ci:e2e"}]}')) }}
|
||||
matrix: ${{ fromJSON(needs.gate.outputs.plan != '' && toJSON((needs.gate.outputs.runner == 'ubuntu-latest' && fromJSON(needs.gate.outputs.plan).jobs.e2e_shards.hosted_matrix) || fromJSON(needs.gate.outputs.plan).jobs.e2e_shards.matrix) || (needs.gate.outputs.runner == 'ubuntu-latest' && '{"include":[{"shard_index":0,"shard_count":4,"shard_label":"1/4","task":"ci:e2e"},{"shard_index":1,"shard_count":4,"shard_label":"2/4","task":"ci:e2e"},{"shard_index":2,"shard_count":4,"shard_label":"3/4","task":"ci:e2e"},{"shard_index":3,"shard_count":4,"shard_label":"4/4","task":"ci:e2e"}]}' || '{"include":[{"shard_index":0,"shard_count":16,"shard_label":"1/16","task":"ci:e2e"},{"shard_index":1,"shard_count":16,"shard_label":"2/16","task":"ci:e2e"},{"shard_index":2,"shard_count":16,"shard_label":"3/16","task":"ci:e2e"},{"shard_index":3,"shard_count":16,"shard_label":"4/16","task":"ci:e2e"},{"shard_index":4,"shard_count":16,"shard_label":"5/16","task":"ci:e2e"},{"shard_index":5,"shard_count":16,"shard_label":"6/16","task":"ci:e2e"},{"shard_index":6,"shard_count":16,"shard_label":"7/16","task":"ci:e2e"},{"shard_index":7,"shard_count":16,"shard_label":"8/16","task":"ci:e2e"},{"shard_index":8,"shard_count":16,"shard_label":"9/16","task":"ci:e2e"},{"shard_index":9,"shard_count":16,"shard_label":"10/16","task":"ci:e2e"},{"shard_index":10,"shard_count":16,"shard_label":"11/16","task":"ci:e2e"},{"shard_index":11,"shard_count":16,"shard_label":"12/16","task":"ci:e2e"},{"shard_index":12,"shard_count":16,"shard_label":"13/16","task":"ci:e2e"},{"shard_index":13,"shard_count":16,"shard_label":"14/16","task":"ci:e2e"},{"shard_index":14,"shard_count":16,"shard_label":"15/16","task":"ci:e2e"},{"shard_index":15,"shard_count":16,"shard_label":"16/16","task":"ci:e2e"}]}')) }}
|
||||
|
||||
env:
|
||||
PAPERCLIP_CI_PROFILE: ${{ needs.gate.outputs.profile_ci }}
|
||||
|
||||
Reference in new issue
Block a user