mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-25 16:14:26 +01:00
perf(ci): cut PR CI under 5 minutes (shared PG, E2E parallelism, routing, test pruning) (#22679)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - Pull request CI verifies every change before merge across typecheck, build, server/DB/UI unit tests, and Playwright E2E shards. > - Today PR CI takes 15–30+ minutes wall-clock on ordinary feature and fix PRs (such as #22626) because every PR runs release/packaging/runner-support bloat, boots 800+ separate embedded Postgres clusters, runs Vitest serialized shards and E2E shards at 1 worker, builds the UI 8 separate times for E2E, emits 52 MB of React `act(...)` stderr spam in UI tests, and runs 61 real-clock soak suites plus hundreds of historical one-time SQL migration and mocked component wiring tests. > - Slow PR CI delays developer feedback, wastes runner capacity, and encourages batching changes instead of shipping small, safe PRs. > - This pull request cuts PR CI across all 6 bottlenecks (pipeline routing/Build bloat, PR-scoped parallel typecheck, shared embedded Postgres + batched/parallel Vitest runner, parallel E2E shards + prebuilt UI cache, historical/soak DB+server pruning with a checked-in nightly manifest, and UI stderr cleanup + low-value test pruning) while preserving all core control-plane invariants and full post-merge/release coverage. > - The benefit is projected PR CI wall-clock drops from 15–30+ minutes to ~3.8–4.4 minutes on ordinary PRs while keeping `master`, `release-verify`, `cloud-readiness`, local `pnpm test:run`, and `full-ci` runs at full coverage. ## Linked Issues or Issue Description Refs #22626. **What existing behavior does this improve?** Trusted pull-request CI wall-clock duration and runner efficiency across `.github/workflows/pr-trusted.yml`, `turbo.json`, `scripts/ci-typecheck-lane.mjs`, `scripts/run-vitest-stable.mjs`, `tests/e2e/`, `packages/db`, `server`, and `ui` test suites. **Subsystem affected** Cross-cutting (multiple of the above) **Current behavior** Ordinary PRs take 15–30+ minutes wall-clock in PR CI: - `Build` (~7.5–8.0m) runs a 231s clean public npm Grok install verifier and a 57s embedded-Postgres boot smoke on every PR. - `Canary Dry Run` (6.2m), `Runner support suite` (7.9m), `Docker context integrity`, `General tests (chat 1–3/3)`, and `Verify Paperclip Runner (vitest package 1–3/3)` fan out on ordinary app PRs due to broad `turbo.json` inputs. - `Typecheck + Release Registry` (7.1m) runs `test:release-registry` (193s), all standalone sandbox provider installs/checks, all untouched `tests/*` projects, and `--singleThreaded` `tsc` on every PR. - `General tests` and `Verify serialized server suites` boot 800+ separate embedded Postgres clusters instead of using `packages/db/src/test-postgres-command.ts`, run 17 serial Vitest invocations in `workspaces-b`, and run `verify_serialized_server` with `--no-file-parallelism --maxWorkers=1`. - `e2e_shards` (8.6m slowest shard) rebuilds the UI 8 separate times and forces `workers: 1` across all 56 specs because 7 specs mutate instance-level flags. - `workspaces-a` (8.3m × 2 shards) emits ~52 MB of React `act(...)` / `IS_REACT_ACT_ENVIRONMENT` stderr spam and executes 992 UI test files (including hundreds of brittle mocked wiring / `renderToStaticMarkup` suites). - `packages/db` and `server` run 43 historical one-time SQL migration replay tests, 12 static prose-grep tests, and 61 real-clock soak/crash/lease-expiry suites (~108.5 CPU-min) on every PR. **Proposed behavior** Ordinary PRs complete in under 5 minutes wall-clock while preserving full control-plane invariant coverage and full `master`/`release-verify`/`cloud-readiness`/`full-ci` verification: - PR `Build` removes the 231s Grok clean-npm verifier (already covered in `release-smoke.yml` and `docker-runner-check.yml`) and gates the 53s boot smoke on `PAPERCLIP_CI_FULL=1` (keeping fast `build:runtime` on every PR). - `turbo.json` and `.github/ci-task-matrix.json` path-gate `Canary Dry Run`, `Runner support suite`, `Docker context integrity`, `general-chat`, `ci:runner-package`, `ci:workspaces-a`, and `ci:db`, and narrow `tests/**` out of `globalDependencies`. - `Typecheck + Release Registry` uses fail-closed PR-mode scoping (`CI_PLAN`, `PAPERCLIP_CI_BASE_SHA`, `PAPERCLIP_CI_FULL`), parallel `typecheck-test-programs.mjs`, and `--checkers` / `GOMAXPROCS=2` within the 15.7 GiB RAM budget. - `run-vitest-stable.mjs` automatically wraps Postgres-backed lanes with one shared embedded Postgres template server (`test-postgres-command.ts`), batches `workspaces-b` and `workspaces-a` into single multi-project Vitest invocations, parallelizes isolated `serialized` shards, and filters `scripts/ci/nightly-only-suites.json` in PR mode (respecting `PAPERCLIP_CI_FULL=1`). - `e2e_shards` restores a read-only exact-key `server/ui-dist` cache written on canonical `master` pushes (`PAPERCLIP_E2E_SKIP_UI_BUILD=1`, inline fallback on UI PRs), isolates the 7 flag-mutating specs onto 2 serial shards while running the other 6 shards at `workers: 3` + `fullyParallel: true`, prunes 5 legacy/screenshot specs, and replaces fixed 20s/30s sleeps with deterministic waits. - `ui/vitest.setup.ts` eliminates >99.9% of stderr spam (`IS_REACT_ACT_ENVIRONMENT = true`, clean localStorage/DOM stubs, targeted `act(...)`/`No queryFn` suppression) and prunes 445 low-value mocked/presentational/screenshot UI tests + slims 2 giant mocked suites (keeping all `ui/src/lib`, `api`, `hooks`, `context`, `adapters`, `features`, `plugins`, and privacy/authz tests). - `packages/db` and `server` prune 43 historical one-time SQL migration tests, 12 static prose-grep tests, and 28 redundant `it.each` cases in `chat-channels.integration.test.ts`, and classify 61 real-clock soak/restart/lease-expiry/workspace-recovery suites (6,510.2s / 108.5 CPU-min) into `scripts/ci/nightly-only-suites.json`. **Reason and benefit** Cuts ordinary PR CI wall-clock from 15–30+ minutes to a projected ~3.8–4.4 minutes and removes ~156,353 LOC of redundant/brittle test code without dropping any core Paperclip invariant (company isolation, authz, atomic checkout, single-assignee, approval gates, budget hard-stop, activity logging). **Breaking changes** None for product runtime behavior. In PR CI, 61 real-clock soak suites listed in `scripts/ci/nightly-only-suites.json` run on `master`, `release-verify`, `cloud-readiness`, local `pnpm test:run`, and PRs with the `full-ci` label (`PAPERCLIP_CI_FULL=1`) instead of every ordinary PR. ## What Changed - **Pipeline & routing (`ci-fast/pipeline`):** - `.github/workflows/pr-trusted.yml`, `.github/workflows/release-verify.yml`, `.github/ci-task-matrix.json`, `turbo.json`: removed Grok clean-npm verifier from PR `Build`, gated `server-boot-smoke.sh` on `PAPERCLIP_CI_FULL=1`, path-gated `canary_dry_run`, `verify_runner_e2e_support`, `docker_context_integrity`, `general-chat`, `ci:runner-package`, `ci:workspaces-a`, and `ci:db`, forwarded `CI_PLAN` / `PAPERCLIP_CI_BASE_SHA` / `PAPERCLIP_CI_FULL` (keeping `profile-ci` in PR mode), and added exact-key read-only `server/ui-dist` cache restore in `e2e_shards` with a master-only writer in `release-verify.yml`. - Updated `.github/scripts/tests/ci-plan.test.mjs`, `scripts/__tests__/public-install-closure.test.mjs`, and `scripts/__tests__/runner-release-crate-cache.test.mjs`. - **Typecheck lane (`ci-fast/typecheck`):** - `scripts/ci-typecheck-lane.mjs`, `scripts/typecheck-test-programs.mjs`, `scripts/typecheck-test-projects.mjs`, `server/scripts/typecheck-layers.mjs`: added fail-closed PR-mode diff scoping (skipping `test:release-registry`, standalone sandbox providers, demo plugins, and untouched test projects/workspaces on unrelated PRs), concurrent `typecheckTestProgramsAsync`, and `--checkers` / `GOMAXPROCS=2` parallelism within 15.7 GiB RAM. - Updated `scripts/__tests__/ci-typecheck-lane.test.mjs`, `scripts/typecheck-test-programs.test.mjs`, and `server/scripts/typecheck-layers.test.mjs`. - **Vitest runner (`ci-fast/vitest-runner`):** - `scripts/run-vitest-stable.mjs`, `packages/db/src/test-postgres-command.ts`, `scripts/__tests__/run-vitest-stable-shard.test.mjs`: wired automatic shared embedded Postgres template DB (`test-postgres-command.ts` with `fsync=off`), batched `workspaces-b` and `workspaces-a` into single multi-project Vitest runs, parallelized isolated `serialized` shards (`maxWorkers=3`), and added PR-mode filtering for `scripts/ci/nightly-only-suites.json` (honoring `PAPERCLIP_CI_FULL=1`). - **Playwright E2E (`ci-fast/e2e`):** - `tests/e2e/playwright.config.ts`, `scripts/e2e-shard.mjs`, `scripts/e2e-shard-durations.json`, `scripts/__tests__/e2e-shard.test.mjs`, `maps/feature-map/recovery.md`: added `PAPERCLIP_E2E_SKIP_UI_BUILD=1`, isolated the 7 instance-mutating `SERIAL_SPECS` onto dedicated serial shards while running the remaining 44 specs across 6 shards at `workers: 3` + `fullyParallel: true`, pruned 5 legacy/screenshot specs (`-743 LOC`), and replaced fixed 20s/30s sleeps in `disconnect-resilience.spec.ts` and `composer-stop.spec.ts`. - **Server & DB test pruning + nightly soak manifest (`ci-fast/server-prune`):** - Deleted 41 historical one-time SQL migration tests + 5 obsolete fixture SQLs in `packages/db/src`, 2 historical server SQL migration tests, and 12 brittle static prose-guidance tests; trimmed `packages/db/src/client.test.ts` (2,328 → 219 LOC), `packages/db/src/better-auth-account-issuer-migration.test.ts` (167 → 19 LOC), and 2 redundant `it.each` matrices in `server/src/__tests__/chat-channels.integration.test.ts`. - Added `scripts/ci/nightly-only-suites.json` classifying 61 real-clock soak/restart/lease-expiry/workspace-recovery suites (6,510.2s / 108.5 CPU-min). - **UI test log spam fix & pruning (`ci-fast/ui-prune`):** - `ui/vitest.setup.ts`, `ui/vitest.config.ts`: eliminated >99.9% stderr spam (22–52 MB → 3.6 KB) by enabling `IS_REACT_ACT_ENVIRONMENT = true`, adding clean DOM/localStorage stubs, and filtering React `act(...)` / TanStack Query `No queryFn` noise. - Pruned 445 low-value mocked/presentational/screenshot UI test files, slimmed `AgentConfigForm.render.test.tsx` and `Browse.test.tsx` to their privacy/access checks, updated 34 `maps/` files to remove dead test links, and removed the stale `ui/src/pages/NewAgent.test-support.tsx` allowlist entry in `scripts/check-query-error-rendering.mjs`. ## Verification - Combined CI contract & shard test suite (`node --test .github/scripts/tests/ci-plan.test.mjs scripts/__tests__/run-vitest-stable-shard.test.mjs scripts/__tests__/ci-typecheck-lane.test.mjs scripts/typecheck-test-programs.test.mjs scripts/__tests__/e2e-shard.test.mjs scripts/__tests__/public-install-closure.test.mjs scripts/__tests__/runner-release-crate-cache.test.mjs scripts/__tests__/merge-queue-checks-workflow.test.mjs`): **136/136 PASS** (23.13s). - Full `.github/scripts/tests/*.test.mjs` suite on `ci-fast/pipeline`: **850/850 PASS** + Turbo cached-lane check **1/1 PASS**. - `node scripts/check-query-error-rendering.mjs --enforce --summary` and `node --test scripts/check-query-error-rendering.test.mjs`: **0 findings, 7/7 PASS**. - `node scripts/check-maps.mjs`: **PASS** (`35 areas, 192 capability IDs`). - `pnpm --filter @paperclipai/db typecheck`: **PASS** (`check:migrations` + `tsc --noEmit`). - `pnpm --filter @paperclipai/ui typecheck`: **PASS** (`369 files, 3454 stories` + `run-tsc.mjs -b`). - Component-level benchmarks verified on individual branches prior to merge (`ci-typecheck-lane.mjs` 63.4s simulated PR run; real Playwright 3-worker parallel specs passing; UI suite full run reduced to 3.6 KB stderr). - Live GitHub PR CI run triggered on this draft PR to verify real runner execution and measure before/after timings. ## Risks - **Two-phase CI effect:** Because `.github/workflows/pr.yml` invokes `pr-trusted.yml@master`, the workflow-level changes (removing Grok clean-npm install from PR `Build`, path-gating `Canary Dry Run`/`Runner support suite`/`general-chat`/`ci:runner-package`, passing `CI_PLAN`/`PAPERCLIP_CI_BASE_SHA`/`PAPERCLIP_CI_FULL`, and restoring `e2e-ui-dist`) take full effect only after merging to `master` (and `e2e-ui-dist` warms on the first `master` push; until then `e2e_shards` cleanly falls back to inline UI build). Furthermore, this PR modifies global CI inputs (`turbo.json`, `scripts/**`, `.github/**`), so its own PR CI runs the full matrix. - **Nightly soak demotion:** The 61 real-clock soak suites in `scripts/ci/nightly-only-suites.json` still run on every `master` push (`release-verify.yml`), `cloud-readiness.yml`, local `pnpm test:run`, and `full-ci`-labeled PRs, so regressions are caught post-merge rather than blocking ordinary PRs. - **Duration manifest rebalance:** Post-merge, the weekly `ci-test-durations.yml` refresh will recalibrate shard weights to reflect shared-Postgres timings for optimal LPT balance. - **No product runtime or DB schema changes:** All changes are confined to CI workflows, build/test orchestration scripts, test setup, test suites, and feature-map references. ## Model Used - Google Gemini 4 Neon (`Gemini 4 Neon (High)`), Google DeepMind, with repository tools, code execution, and multi-agent swarm coordination. ## 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 - [ ] All Paperclip CI gates are green - [ ] 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
3cd1370141
commit
9a04538391
602 files changed
+7679
-162213
No files matched your search
@@ -243,7 +243,10 @@ jobs:
|
||||
run: node "$CI_NODE_TEST" '.github/scripts/tests/*.test.mjs'
|
||||
|
||||
- name: Test general-server shard partition
|
||||
run: node "$CI_NODE_TEST" ./scripts/__tests__/run-vitest-stable-shard.test.mjs
|
||||
run: |
|
||||
tests=(./scripts/__tests__/run-vitest-stable-shard.test.mjs)
|
||||
if [[ -f ./scripts/__tests__/run-vitest-stable-pr-mode.test.mjs ]]; then tests+=(./scripts/__tests__/run-vitest-stable-pr-mode.test.mjs); fi
|
||||
node "$CI_NODE_TEST" "${tests[@]}"
|
||||
|
||||
- name: Test e2e shard partition
|
||||
run: node "$CI_NODE_TEST" ./scripts/__tests__/e2e-shard.test.mjs
|
||||
@@ -303,6 +306,9 @@ jobs:
|
||||
timeout-minutes: 20
|
||||
|
||||
env:
|
||||
CI_PLAN: ${{ needs.gate.outputs.plan }}
|
||||
PAPERCLIP_CI_BASE_SHA: ${{ needs.gate.outputs.plan != '' && fromJSON(needs.gate.outputs.plan).diff.base || github.event.pull_request.base.sha }}
|
||||
PAPERCLIP_CI_FULL: ${{ (contains(github.event.pull_request.labels.*.name, 'full-ci') || vars.CI_INCREMENTAL_MODE == 'full') && '1' || '' }}
|
||||
PAPERCLIP_CI_PROFILE: ${{ needs.gate.outputs.profile_ci }}
|
||||
PAPERCLIP_CI_PROFILE_JOB: Typecheck + Release Registry
|
||||
|
||||
@@ -311,6 +317,7 @@ jobs:
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
|
||||
with:
|
||||
persist-credentials: false
|
||||
fetch-depth: 2
|
||||
|
||||
- name: Initialize CI profile
|
||||
continue-on-error: true
|
||||
@@ -514,9 +521,10 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
max-parallel: ${{ needs.gate.outputs.runner == 'ubuntu-latest' && 4 || 256 }}
|
||||
matrix: ${{ fromJSON((needs.test_selection.outputs.plan || needs.gate.outputs.plan) != '' && toJSON(fromJSON((needs.test_selection.outputs.plan || needs.gate.outputs.plan)).jobs.general_tests.matrix) || '{"include":[{"group":"general-server-without-chat","group_label":"server (1/12)","shard_index":0,"shard_count":12,"task":"ci:server"},{"group":"general-server-without-chat","group_label":"server (2/12)","shard_index":1,"shard_count":12,"task":"ci:server"},{"group":"general-server-without-chat","group_label":"server (3/12)","shard_index":2,"shard_count":12,"task":"ci:server"},{"group":"general-server-without-chat","group_label":"server (4/12)","shard_index":3,"shard_count":12,"task":"ci:server"},{"group":"general-server-without-chat","group_label":"server (5/12)","shard_index":4,"shard_count":12,"task":"ci:server"},{"group":"general-server-without-chat","group_label":"server (6/12)","shard_index":5,"shard_count":12,"task":"ci:server"},{"group":"general-server-without-chat","group_label":"server (7/12)","shard_index":6,"shard_count":12,"task":"ci:server"},{"group":"general-server-without-chat","group_label":"server (8/12)","shard_index":7,"shard_count":12,"task":"ci:server"},{"group":"general-server-without-chat","group_label":"server (9/12)","shard_index":8,"shard_count":12,"task":"ci:server"},{"group":"general-server-without-chat","group_label":"server (10/12)","shard_index":9,"shard_count":12,"task":"ci:server"},{"group":"general-server-without-chat","group_label":"server (11/12)","shard_index":10,"shard_count":12,"task":"ci:server"},{"group":"general-server-without-chat","group_label":"server (12/12)","shard_index":11,"shard_count":12,"task":"ci:server"},{"group":"general-chat","group_label":"chat (1/3)","shard_index":0,"shard_count":3,"task":"ci:chat"},{"group":"general-chat","group_label":"chat (2/3)","shard_index":1,"shard_count":3,"task":"ci:chat"},{"group":"general-chat","group_label":"chat (3/3)","shard_index":2,"shard_count":3,"task":"ci:chat"},{"group":"general-workspaces-a","group_label":"workspaces-a (1/2)","shard_index":0,"shard_count":2,"task":"ci:workspaces-a"},{"group":"general-workspaces-a","group_label":"workspaces-a (2/2)","shard_index":1,"shard_count":2,"task":"ci:workspaces-a"},{"group":"general-workspaces-b","group_label":"workspaces-b","task":"ci:workspaces-b"},{"group":"general-workspaces-c","group_label":"workspaces-c","task":"ci:db"}]}') }}
|
||||
matrix: ${{ fromJSON((needs.test_selection.outputs.plan || needs.gate.outputs.plan) != '' && toJSON(fromJSON((needs.test_selection.outputs.plan || needs.gate.outputs.plan)).jobs.general_tests.matrix) || '{"include":[{"group":"general-server-without-chat","group_label":"server (1/20)","shard_index":0,"shard_count":20,"task":"ci:server"},{"group":"general-server-without-chat","group_label":"server (2/20)","shard_index":1,"shard_count":20,"task":"ci:server"},{"group":"general-server-without-chat","group_label":"server (3/20)","shard_index":2,"shard_count":20,"task":"ci:server"},{"group":"general-server-without-chat","group_label":"server (4/20)","shard_index":3,"shard_count":20,"task":"ci:server"},{"group":"general-server-without-chat","group_label":"server (5/20)","shard_index":4,"shard_count":20,"task":"ci:server"},{"group":"general-server-without-chat","group_label":"server (6/20)","shard_index":5,"shard_count":20,"task":"ci:server"},{"group":"general-server-without-chat","group_label":"server (7/20)","shard_index":6,"shard_count":20,"task":"ci:server"},{"group":"general-server-without-chat","group_label":"server (8/20)","shard_index":7,"shard_count":20,"task":"ci:server"},{"group":"general-server-without-chat","group_label":"server (9/20)","shard_index":8,"shard_count":20,"task":"ci:server"},{"group":"general-server-without-chat","group_label":"server (10/20)","shard_index":9,"shard_count":20,"task":"ci:server"},{"group":"general-server-without-chat","group_label":"server (11/20)","shard_index":10,"shard_count":20,"task":"ci:server"},{"group":"general-server-without-chat","group_label":"server (12/20)","shard_index":11,"shard_count":20,"task":"ci:server"},{"group":"general-server-without-chat","group_label":"server (13/20)","shard_index":12,"shard_count":20,"task":"ci:server"},{"group":"general-server-without-chat","group_label":"server (14/20)","shard_index":13,"shard_count":20,"task":"ci:server"},{"group":"general-server-without-chat","group_label":"server (15/20)","shard_index":14,"shard_count":20,"task":"ci:server"},{"group":"general-server-without-chat","group_label":"server (16/20)","shard_index":15,"shard_count":20,"task":"ci:server"},{"group":"general-server-without-chat","group_label":"server (17/20)","shard_index":16,"shard_count":20,"task":"ci:server"},{"group":"general-server-without-chat","group_label":"server (18/20)","shard_index":17,"shard_count":20,"task":"ci:server"},{"group":"general-server-without-chat","group_label":"server (19/20)","shard_index":18,"shard_count":20,"task":"ci:server"},{"group":"general-server-without-chat","group_label":"server (20/20)","shard_index":19,"shard_count":20,"task":"ci:server"},{"group":"general-chat","group_label":"chat (1/5)","shard_index":0,"shard_count":5,"task":"ci:chat"},{"group":"general-chat","group_label":"chat (2/5)","shard_index":1,"shard_count":5,"task":"ci:chat"},{"group":"general-chat","group_label":"chat (3/5)","shard_index":2,"shard_count":5,"task":"ci:chat"},{"group":"general-chat","group_label":"chat (4/5)","shard_index":3,"shard_count":5,"task":"ci:chat"},{"group":"general-chat","group_label":"chat (5/5)","shard_index":4,"shard_count":5,"task":"ci:chat"},{"group":"general-workspaces-a","group_label":"workspaces-a (1/2)","shard_index":0,"shard_count":2,"task":"ci:workspaces-a"},{"group":"general-workspaces-a","group_label":"workspaces-a (2/2)","shard_index":1,"shard_count":2,"task":"ci:workspaces-a"},{"group":"general-workspaces-b","group_label":"workspaces-b","task":"ci:workspaces-b"},{"group":"general-workspaces-c","group_label":"workspaces-c","task":"ci:db"}]}') }}
|
||||
|
||||
env:
|
||||
PAPERCLIP_CI_FULL: ${{ (contains(github.event.pull_request.labels.*.name, 'full-ci') || vars.CI_INCREMENTAL_MODE == 'full') && '1' || '' }}
|
||||
PAPERCLIP_CI_TEST_SELECTION: ${{ matrix.selection && '.ci-test-selection/manifest.json' || '' }}
|
||||
PAPERCLIP_CI_SELECTION_HASH: ${{ matrix.selection && fromJSON(needs.test_selection.outputs.plan).testSelection.hash || '' }}
|
||||
PAPERCLIP_CI_PROFILE: ${{ needs.gate.outputs.profile_ci }}
|
||||
@@ -849,9 +857,10 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
max-parallel: ${{ needs.gate.outputs.runner == 'ubuntu-latest' && 4 || 256 }}
|
||||
matrix: ${{ fromJSON(needs.gate.outputs.plan != '' && toJSON(fromJSON(needs.gate.outputs.plan).jobs.verify_paperclip_runner.matrix) || '{"include":[{"lane_label":"static checks","command":"check:static","task":"ci:runner-static"},{"lane_label":"rust","command":"check:runner","release_crate":true,"task":"ci:runner-rust"},{"lane_label":"vitest package (1/3)","command":"test:typescript:vitest --package-lane=1/3","task":"ci:runner-vitest"},{"lane_label":"vitest package (2/3)","command":"test:typescript:vitest --package-lane=2/3","task":"ci:runner-vitest"},{"lane_label":"vitest package (3/3)","command":"test:typescript:vitest --package-lane=3/3","task":"ci:runner-vitest"},{"lane_label":"vitest native server","command":"test:typescript:vitest --native-server","release_crate":true,"task":"ci:runner-vitest"}]}') }}
|
||||
matrix: ${{ fromJSON(needs.gate.outputs.plan != '' && toJSON(fromJSON(needs.gate.outputs.plan).jobs.verify_paperclip_runner.matrix) || '{"include":[{"lane_label":"static checks","command":"check:static","release_crate":true,"task":"ci:runner-static"},{"lane_label":"rust","command":"check:runner","release_crate":true,"task":"ci:runner-rust"},{"lane_label":"vitest package (1/6)","command":"test:typescript:vitest --package-lane=1/6","task":"ci:runner-package"},{"lane_label":"vitest package (2/6)","command":"test:typescript:vitest --package-lane=2/6","task":"ci:runner-package"},{"lane_label":"vitest package (3/6)","command":"test:typescript:vitest --package-lane=3/6","task":"ci:runner-package"},{"lane_label":"vitest package (4/6)","command":"test:typescript:vitest --package-lane=4/6","task":"ci:runner-package"},{"lane_label":"vitest package (5/6)","command":"test:typescript:vitest --package-lane=5/6","task":"ci:runner-package"},{"lane_label":"vitest package (6/6)","command":"test:typescript:vitest --package-lane=6/6","task":"ci:runner-package"},{"lane_label":"vitest native server","command":"test:typescript:vitest --native-server","release_crate":true,"task":"ci:runner-vitest"}]}') }}
|
||||
|
||||
env:
|
||||
PAPERCLIP_CI_FULL: ${{ (contains(github.event.pull_request.labels.*.name, 'full-ci') || vars.CI_INCREMENTAL_MODE == 'full') && '1' || '' }}
|
||||
PAPERCLIP_CI_PROFILE: ${{ needs.gate.outputs.profile_ci }}
|
||||
PAPERCLIP_CI_PROFILE_JOB: Verify Paperclip Runner (${{ matrix.lane_label }})
|
||||
|
||||
@@ -1007,10 +1016,11 @@ jobs:
|
||||
# path list and the key live in scripts/runner-release-crate-cache.mjs
|
||||
# and must match the writer's; a guard test holds them together.
|
||||
#
|
||||
# Only the lanes that build the release crate restore it: the Rust
|
||||
# lane's release tests link the lib, and the final vitest shard hosts
|
||||
# the server's native-runner suite, which builds the binary in its
|
||||
# beforeAll. The static and first vitest lanes run no cargo at all.
|
||||
# Only the lanes that build the release crate restore it: `static checks`
|
||||
# runs `check:api-authority` (which builds `paperclip-runnerd` in release
|
||||
# mode), the Rust lane's release tests link the lib, and `vitest native
|
||||
# server` builds the binary in its beforeAll. The package vitest lanes
|
||||
# only use the debug crate cache.
|
||||
- name: Compute the Runner release crate cache key
|
||||
id: runner_release_crate_key
|
||||
if: ${{ matrix.release_crate == true }}
|
||||
@@ -1090,6 +1100,7 @@ jobs:
|
||||
timeout-minutes: 20
|
||||
|
||||
env:
|
||||
PAPERCLIP_CI_FULL: ${{ (contains(github.event.pull_request.labels.*.name, 'full-ci') || vars.CI_INCREMENTAL_MODE == 'full') && '1' || '' }}
|
||||
PAPERCLIP_CI_PROFILE: ${{ needs.gate.outputs.profile_ci }}
|
||||
PAPERCLIP_CI_PROFILE_JOB: Build
|
||||
|
||||
@@ -1154,25 +1165,6 @@ jobs:
|
||||
pnpm install --frozen-lockfile
|
||||
fi
|
||||
|
||||
# The public-install verifier at the end of this lane downloads the whole
|
||||
# public registry graph into an empty npm cache: its consumer install
|
||||
# took 119-129s of the 226-241s step, more than half of this ~415-446s
|
||||
# lane, in runs 38426120144, 38432086560 and 38423713537 (2026-10-13).
|
||||
# That graph is fixed by source manifests, so this fetches it in the
|
||||
# background while the Rust restore, Evalbook and `pnpm build` run, about
|
||||
# 150s before the verifier installs anything. Only the cache is handed
|
||||
# over, and the verify step waits for this first. A failed or partial
|
||||
# warm-up leaves the verifier to fetch what is missing as before.
|
||||
- name: Start warming the public-install npm cache
|
||||
if: ${{ hashFiles('scripts/warm-public-install-npm-cache.mjs') != '' }}
|
||||
run: |
|
||||
(
|
||||
# The default `bash -e` would skip the status line on a failure.
|
||||
set +e
|
||||
PAPERCLIP_PUBLIC_INSTALL_NPM_CACHE="$RUNNER_TEMP/public-install-npm-cache" node scripts/warm-public-install-npm-cache.mjs
|
||||
echo $? > "$RUNNER_TEMP/public-install-npm-cache.status"
|
||||
) > "$RUNNER_TEMP/public-install-npm-cache.log" 2>&1 &
|
||||
|
||||
# pnpm build reaches the Runner package's build:binary step; without the
|
||||
# shared Rust cache that is a ~3m40s cold compile of all third-party
|
||||
# crates (run 35036001734, 2026-09-15). Same restore-only contract as
|
||||
@@ -1290,41 +1282,19 @@ jobs:
|
||||
- name: Build
|
||||
run: pnpm build
|
||||
|
||||
# The production image starts the server from this bundle with plain
|
||||
# node (Dockerfile CMD), so prove it boots before the image is built:
|
||||
# bundle the `pnpm build` output, start it against a throwaway embedded
|
||||
# instance, and wait for /api/health to report ok.
|
||||
- name: Boot the production runtime bundle
|
||||
# Always verify the production runtime bundle builds cleanly (~4s).
|
||||
# Full embedded-Postgres boot smoke (~53s) runs on full-ci / release
|
||||
# verification; ordinary PRs already boot the server in e2e_shards.
|
||||
- name: Build production runtime bundle
|
||||
run: |
|
||||
pnpm --filter @paperclipai/server build:runtime
|
||||
scripts/server-boot-smoke.sh node server/dist-runtime/index.mjs
|
||||
|
||||
# This verification only needs `pnpm build` output (the verifier stages
|
||||
# the public packages' dist and reuses ui/dist itself), yet it ran at the
|
||||
# end of Canary Dry Run, serially after the ~210-295s release.sh dry run.
|
||||
# That made Canary Dry Run the slowest check in every green PR run:
|
||||
# 484s, 572s and 483s in runs 37310951026, 37309272947 and 37308895471
|
||||
# (2026-10-05), with this step alone at 210-223s of each. The Build lane
|
||||
# finished its `pnpm build` in ~206s total in those same runs, so it
|
||||
# absorbs the step at ~416s while Canary Dry Run drops to ~275-350s and
|
||||
# neither remains the critical path (server 2/12 at ~437-467s is).
|
||||
# docker-runner-check.yml runs the same verifier after `pnpm build`.
|
||||
- name: Verify built-in Grok from a clean public npm install
|
||||
if: ${{ hashFiles('scripts/verify-grok-npm-install.mjs') != '' }}
|
||||
run: |
|
||||
status="$RUNNER_TEMP/public-install-npm-cache.status"
|
||||
if [ -f "$RUNNER_TEMP/public-install-npm-cache.log" ]; then
|
||||
# Normally finished long before this; never let it hold the lane.
|
||||
for _ in $(seq 180); do [ -f "$status" ] && break; sleep 1; done
|
||||
if [ "$(cat "$status" 2>/dev/null)" = 0 ]; then
|
||||
tail -n 1 "$RUNNER_TEMP/public-install-npm-cache.log"
|
||||
else
|
||||
echo '::notice title=Public-install npm cache::warm-up did not finish cleanly; the verifier fetches what is missing'
|
||||
tail -n 20 "$RUNNER_TEMP/public-install-npm-cache.log"
|
||||
fi
|
||||
export PAPERCLIP_PUBLIC_INSTALL_NPM_CACHE="$RUNNER_TEMP/public-install-npm-cache"
|
||||
if [ "${PAPERCLIP_CI_FULL:-}" = "1" ]; then
|
||||
scripts/server-boot-smoke.sh node server/dist-runtime/index.mjs
|
||||
fi
|
||||
node scripts/verify-grok-npm-install.mjs
|
||||
|
||||
# Clean public npm install verification (`verify-grok-npm-install.mjs`,
|
||||
# ~231s) is covered by release-smoke.yml and docker-runner-check.yml
|
||||
# rather than running on every pull request Build job.
|
||||
|
||||
- name: Upload CI profile timings
|
||||
continue-on-error: true
|
||||
@@ -1349,6 +1319,7 @@ jobs:
|
||||
matrix: ${{ fromJSON((needs.test_selection.outputs.plan || needs.gate.outputs.plan) != '' && toJSON(fromJSON((needs.test_selection.outputs.plan || needs.gate.outputs.plan)).jobs.verify_serialized_server.matrix) || '{"include":[{"shard_index":0,"shard_count":9,"shard_label":"1/9","task":"ci:serialized"},{"shard_index":1,"shard_count":9,"shard_label":"2/9","task":"ci:serialized"},{"shard_index":2,"shard_count":9,"shard_label":"3/9","task":"ci:serialized"},{"shard_index":3,"shard_count":9,"shard_label":"4/9","task":"ci:serialized"},{"shard_index":4,"shard_count":9,"shard_label":"5/9","task":"ci:serialized"},{"shard_index":5,"shard_count":9,"shard_label":"6/9","task":"ci:serialized"},{"shard_index":6,"shard_count":9,"shard_label":"7/9","task":"ci:serialized"},{"shard_index":7,"shard_count":9,"shard_label":"8/9","task":"ci:serialized"},{"shard_index":8,"shard_count":9,"shard_label":"9/9","task":"ci:serialized"}]}') }}
|
||||
|
||||
env:
|
||||
PAPERCLIP_CI_FULL: ${{ (contains(github.event.pull_request.labels.*.name, 'full-ci') || vars.CI_INCREMENTAL_MODE == 'full') && '1' || '' }}
|
||||
PAPERCLIP_CI_TEST_SELECTION: ${{ matrix.selection && '.ci-test-selection/manifest.json' || '' }}
|
||||
PAPERCLIP_CI_SELECTION_HASH: ${{ matrix.selection && fromJSON(needs.test_selection.outputs.plan).testSelection.hash || '' }}
|
||||
PAPERCLIP_CI_PROFILE: ${{ needs.gate.outputs.profile_ci }}
|
||||
@@ -1761,10 +1732,21 @@ jobs:
|
||||
}
|
||||
CONF
|
||||
|
||||
# Reuse master's exact UI build on non-UI PRs so all 8 E2E shards skip
|
||||
# rebuilding Vite (~35s each). Exact key only (no restore-keys): a UI
|
||||
# change misses and Playwright builds server/ui-dist inline.
|
||||
- name: Restore prebuilt UI assets (read only)
|
||||
id: e2e_ui_dist
|
||||
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
with:
|
||||
path: server/ui-dist
|
||||
key: e2e-ui-dist-v1-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('pnpm-lock.yaml', 'tsconfig*.json', 'ui/package.json', 'ui/index.html', 'ui/vite.config.*', 'ui/tsconfig*.json', 'ui/src/**', 'ui/public/**', 'packages/shared/src/**', 'packages/adapter-utils/src/**', 'packages/adapters/*/src/**', 'packages/plugins/sdk/src/**') }}
|
||||
|
||||
- name: Run e2e tests
|
||||
env:
|
||||
PAPERCLIP_E2E_SKIP_LLM: "true"
|
||||
PAPERCLIP_PLAYWRIGHT_CHANNEL: "chrome"
|
||||
PAPERCLIP_E2E_SKIP_UI_BUILD: ${{ steps.e2e_ui_dist.outputs.cache-hit == 'true' && '1' || '' }}
|
||||
run: |
|
||||
# Playwright's own --shard balances by test count, and one spec
|
||||
# (smoke-lab) is ~40% of the lane's wall clock. Partition by recorded
|
||||
|
||||
@@ -564,6 +564,28 @@ jobs:
|
||||
- name: Build
|
||||
run: pnpm build
|
||||
|
||||
# Exact-key master cache for PR e2e_shards (read-only restore in
|
||||
# pr-trusted.yml). Only canonical master pushes write this entry.
|
||||
- name: Check for prebuilt E2E UI assets cache
|
||||
id: e2e_ui_dist
|
||||
if: ${{ github.repository == 'paperclipai/paperclip' && github.event_name == 'push' && github.ref == 'refs/heads/master' && inputs.ref == github.sha }}
|
||||
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
with:
|
||||
lookup-only: true
|
||||
path: server/ui-dist
|
||||
key: e2e-ui-dist-v1-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('pnpm-lock.yaml', 'tsconfig*.json', 'ui/package.json', 'ui/index.html', 'ui/vite.config.*', 'ui/tsconfig*.json', 'ui/src/**', 'ui/public/**', 'packages/shared/src/**', 'packages/adapter-utils/src/**', 'packages/adapters/*/src/**', 'packages/plugins/sdk/src/**') }}
|
||||
|
||||
- name: Stage prebuilt UI assets for E2E cache
|
||||
if: ${{ github.repository == 'paperclipai/paperclip' && github.event_name == 'push' && github.ref == 'refs/heads/master' && inputs.ref == github.sha && steps.e2e_ui_dist.outputs.cache-hit != 'true' }}
|
||||
run: PAPERCLIP_RELEASE_REUSE_UI_DIST=1 bash scripts/prepare-server-ui-dist.sh
|
||||
|
||||
- name: Save prebuilt UI assets for PR E2E shards
|
||||
if: ${{ github.repository == 'paperclipai/paperclip' && github.event_name == 'push' && github.ref == 'refs/heads/master' && inputs.ref == github.sha && steps.e2e_ui_dist.outputs.cache-hit != 'true' }}
|
||||
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
with:
|
||||
path: server/ui-dist
|
||||
key: e2e-ui-dist-v1-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('pnpm-lock.yaml', 'tsconfig*.json', 'ui/package.json', 'ui/index.html', 'ui/vite.config.*', 'ui/tsconfig*.json', 'ui/src/**', 'ui/public/**', 'packages/shared/src/**', 'packages/adapter-utils/src/**', 'packages/adapters/*/src/**', 'packages/plugins/sdk/src/**') }}
|
||||
|
||||
runner_binary_targets:
|
||||
if: inputs.runner_binaries_only
|
||||
name: Read exact-source daemon targets
|
||||
|
||||
Reference in new issue
Block a user