mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-25 16:14:26 +01:00
perf(ci): Phase 3 PR CI under 3m — 4x Runner support, 12x E2E, incremental TS 7 cache, pure-Node postinstall, and rebalanced shards (#22804)
## 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 build, typecheck, server tests, Runner tests, and Playwright E2E shards. > - After Phase 1 (#22679) and Phase 2 (#22729), full-fanout PR CI still takes 9m45s wall-clock on 4-core AWS runners because of five bottlenecks: an unsharded 7m22s `Runner support suite`, stale server/chat/Runner shard duration manifests plus newly landed SSH/soak whales, 28s of `pnpm -r run postinstall` replay on every job, cold server/UI typecheck and single-build overhead, and 3 oversized (>180s) Playwright E2E specs across 8 shards with double-start Postgres template boot. > - Docs-only prose edits under `doc/**` and `docs/**` also fanned out to 66 CI jobs because only three doc paths bypassed global dependencies. > - This pull request shards `Runner support suite` 4 ways with `pool: "threads"`, shards E2E 12 ways after splitting the 3 oversized specs and removing double-start Postgres boot, adds pure-Node workspace postinstall replay, adds read-only master-warmed incremental TS 7 and Runner dist caches, rebalances all server/chat/Runner duration manifests, demotes 48 new non-invariant soak whales to nightly, and routes audited prose docs without triggering 66-job storms. > - The benefit is driving ordinary PR CI toward under 3 minutes wall-clock while preserving every invariant check, cache boundary, and full master/nightly test coverage. ## Linked Issues or Issue Description Refs #22679 Refs #22729 **What existing behavior does this improve?** Pull request CI wall-clock latency across `.github/workflows/pr-trusted.yml`, `.github/workflows/release-verify.yml`, `.github/actions/setup-ci-dependencies/action.yml`, typecheck orchestration, Vitest/Runner lanes, and Playwright E2E shards. **Subsystem affected** Cross-cutting (multiple of the above) **Current behavior** Full-fanout PR CI takes 9m45s on 4-core runners (run `45440355579`), dominated by `Runner support suite` (7m22s), `e2e shards` (5m02s–6m24s), `General tests (server/chat)` (5m37s–6m01s), `Verify Paperclip Runner (vitest package)` (6m25s on stale manifests), `Typecheck` (4m13s–6m30s), `Build` (~4m), and 28s of `pnpm -r postinstall` per job. Prose edits under `doc/**` trigger 66 jobs. **Proposed behavior** Shard `Runner support suite` (4x) and `e2e_shards` (12x), split the 3 oversized E2E specs, boot disposable E2E Postgres in a single non-durable start, replay workspace `postinstall` in pure Node (<1s), cache prebuilt Runner dist and TS 7 `.tsbuildinfo` from canonical `master` pushes (read-only in PRs), use emit-only server compile in ordinary PR `Build`, rebalance all shard duration manifests, demote 48 new non-invariant soak whales to nightly, and route audited prose docs cleanly. ## What Changed - **Pure-Node postinstall replay (`scripts/replay-workspace-postinstall.mjs`, `.github/actions/setup-ci-dependencies/action.yml`):** Replaces the 28s `pnpm -r --if-present run postinstall && pnpm run postinstall` call on every CI job with a pure-Node parallel runner (~0.84s locally) with fallback for older checkouts. - **4-way sharded `Runner support suite` + `threads` pool (`.github/ci-task-matrix.json`, `.github/workflows/pr-trusted.yml`, `tests/runner-e2e/run-unit.mjs`, `tests/runner-e2e/vitest.config.ts`):** Shards Vitest and `node:test` suites 4 ways (`--shard-index 0..3 --shard-count 4`) and switches `tests/runner-e2e` to `pool: "threads"` with CPU-aware `maxWorkers` while preserving `isolate: true`. - **12-way E2E shards, single-start E2E Postgres boot, and 3 oversized spec splits (`tests/e2e/start-e2e-server.ts`, `tests/e2e/*.spec.ts`, `tests/e2e/playwright.config.ts`, `scripts/e2e-shard.mjs`, `scripts/e2e-shard-durations.json`, `.github/ci-task-matrix.json`):** Boots cold ephemeral E2E Postgres in one `initdb --no-sync` + non-durable `postgresql.conf` start overlapped with server module import; splits `agent-chat-projects`, `chat-adapters-ui-providers`, and `chat-adapters-ui-messaging` cleanly with zero tests removed; balances all 54 specs across 12 shards (6.8s spread). - **Incremental TS 7 typecheck & Runner dist caching (`server/scripts/typecheck-layers.mjs`, `scripts/ci-typecheck-lane.mjs`, `scripts/typecheck-test-programs.mjs`, `scripts/typecheck-test-projects.mjs`, `.github/workflows/pr-trusted.yml`, `.github/workflows/release-verify.yml`):** Preserves portable `.tsbuildinfo`/`.d.ts` with `layer-map.json` invalidation and stale-declaration pruning, wires read-only `runner-dist-v1` and `typecheck-incremental-v1` restores in `pr-trusted.yml` (zero `actions/cache/save`) paired with canonical-`master`-only guarded writers in `release-verify.yml`, skips redundant Runner Rust `cargo check` on TS-only shared PRs, and uses LPT scheduling with concurrency 3 (4-core) / 4 (8-core). - **Emit-only PR `Build` & audited prose doc routing (`.github/workflows/pr-trusted.yml`, `.github/scripts/ci-inputs.mjs`):** Passes `PAPERCLIP_TSC_EMIT_ONLY=1` on ordinary PR `Build` jobs (full `pnpm build` on `full-ci` / `master`), and classifies audited prose Markdown under `doc/**` and `docs/**` as `guidance` / `historical` while keeping `docs/api/**`, JSON/TS fixtures, `maps/**`, and unknown files fail-closed. - **Rebalanced shard manifests & new soak demotions (`scripts/ci/nightly-only-suites.json`, `scripts/*-shard-durations.json`, `packages/paperclip-runner/scripts/vitest-lane-durations.json`, `packages/paperclip-runner/vitest.config.ts`, `packages/paperclip-runner/scripts/vitest-sequencer.mjs`):** Demotes 48 newly landed/grown non-invariant soak suites (including 4 real-SSH integration suites) to nightly, refreshes all 4 timing manifests from live CI measurements (0.1s–0.6s LPT skew), and scales Runner package Vitest CI `maxWorkers` to 3 on 4-core / 6 on 8-core. ## Verification - `node --test .github/scripts/tests/*.test.mjs scripts/__tests__/runner-release-crate-cache.test.mjs scripts/__tests__/public-install-closure.test.mjs scripts/__tests__/merge-queue-checks-workflow.test.mjs scripts/__tests__/e2e-shard.test.mjs scripts/__tests__/ci-typecheck-lane.test.mjs scripts/__tests__/run-vitest-stable-shard.test.mjs scripts/__tests__/run-vitest-stable-pr-mode.test.mjs scripts/__tests__/runner-vitest-package-lanes.test.mjs scripts/typecheck-test-programs.test.mjs scripts/check-test-budget.test.mjs scripts/ci/test-selection-pr-timings.test.mjs scripts/ci/test-selection-timings.test.mjs` — **973/973 PASS** - `node scripts/check-test-budget.mjs --base origin/master` — **PASS** (`609` nightly suites validated, zero protected invariants demoted) - `node scripts/check-maps.mjs` — **PASS** - `pnpm exec vitest run --config tests/runner-e2e/vitest.config.ts tests/runner-e2e/source-sdk-public-inputs.test.mjs tests/runner-e2e/unit-launcher.test.mjs` — **PASS** - `pnpm --filter @paperclipai/paperclip-runner exec vitest run scripts/vitest-sequencer.test.mjs` — **PASS** - `cd server && node ../node_modules/vitest/vitest.mjs run scripts/typecheck-layers.test.mjs scripts/typecheck-layers-incremental.test.mjs` — **56/56 PASS** (real TS 7.0.2 incremental soundness tests) - `node scripts/run-tsc.mjs -p tests/e2e/tsconfig.json --noEmit && node scripts/run-tsc.mjs -p tests/tsconfig.playwright.json --noEmit && pnpm run test:e2e:runner:typecheck` — **0 errors** - Live Playwright smoke passed across all 6 split E2E spec files on the cold non-durable Postgres boot path (`PAPERCLIP_TEST_POSTGRES_TEMPLATE=0`). - Live sharded `tests/runner-e2e` runs passed under `pool: "threads", maxWorkers: 4` (shard `1/4` 172/172 PASS; shard `2/4` all Vitest + 65/65 `node:test` PASS). ## Risks - **Cache invalidation on incremental typecheck / Runner dist:** Mitigated by exact-key hashing (including `packages/{shared,adapter-utils,plugins/sdk}/src/**` and `packages/paperclip-runner/spec/**`) with no `restore-keys:` on `runner-dist-v1`, SHA-256 self-validation inside `prepare-runner-vendor.mjs`, `layer-map.json` invalidation + stale `.d.ts` pruning in `typecheck-layers.mjs`, and read-only PR restores (only canonical `master` pushes save caches). - **Shard rebalancing & soak demotions:** All demoted suites remain in `nightly-only-suites.json` and run on `full-ci` / `master` / nightly; `check-test-budget.mjs` enforces zero protected invariants are demoted. - **Workflow security boundaries:** `ci-routing.yml`, `pr.yml`, `CODEOWNERS`, and all `runs-on:` expressions are unchanged; `pr-trusted.yml` performs zero `actions/cache/save` calls. ## Model Used - Google Gemini (Antigravity agent swarm) with extended reasoning, tool use, and local code/test execution across 6 parallel worker roles (`ci-pipeline`, `vitest-runner`, `server-prune`, `e2e-opt`, `typecheck-opt`, `verifier`). ## 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
3ca9b6d471
commit
cffd17e78a
39 files changed
+6684
-4813
No files matched your search
@@ -70,8 +70,12 @@ runs:
|
||||
shell: bash
|
||||
working-directory: ${{ inputs.working-directory }}
|
||||
run: |
|
||||
pnpm -r --if-present run postinstall
|
||||
pnpm run postinstall
|
||||
if [ -f scripts/replay-workspace-postinstall.mjs ]; then
|
||||
node scripts/replay-workspace-postinstall.mjs
|
||||
else
|
||||
pnpm -r --if-present run postinstall
|
||||
pnpm run postinstall
|
||||
fi
|
||||
|
||||
- name: Restore certified shared build outputs (read only)
|
||||
if: inputs.restore-cache == 'true' && steps.inputs.outputs.cacheable == 'true'
|
||||
|
||||
+61
-16
@@ -343,55 +343,100 @@
|
||||
"e2e_shards": [
|
||||
{
|
||||
"shard_index": 0,
|
||||
"shard_count": 8,
|
||||
"shard_label": "1/8",
|
||||
"shard_count": 12,
|
||||
"shard_label": "1/12",
|
||||
"task": "ci:e2e"
|
||||
},
|
||||
{
|
||||
"shard_index": 1,
|
||||
"shard_count": 8,
|
||||
"shard_label": "2/8",
|
||||
"shard_count": 12,
|
||||
"shard_label": "2/12",
|
||||
"task": "ci:e2e"
|
||||
},
|
||||
{
|
||||
"shard_index": 2,
|
||||
"shard_count": 8,
|
||||
"shard_label": "3/8",
|
||||
"shard_count": 12,
|
||||
"shard_label": "3/12",
|
||||
"task": "ci:e2e"
|
||||
},
|
||||
{
|
||||
"shard_index": 3,
|
||||
"shard_count": 8,
|
||||
"shard_label": "4/8",
|
||||
"shard_count": 12,
|
||||
"shard_label": "4/12",
|
||||
"task": "ci:e2e"
|
||||
},
|
||||
{
|
||||
"shard_index": 4,
|
||||
"shard_count": 8,
|
||||
"shard_label": "5/8",
|
||||
"shard_count": 12,
|
||||
"shard_label": "5/12",
|
||||
"task": "ci:e2e"
|
||||
},
|
||||
{
|
||||
"shard_index": 5,
|
||||
"shard_count": 8,
|
||||
"shard_label": "6/8",
|
||||
"shard_count": 12,
|
||||
"shard_label": "6/12",
|
||||
"task": "ci:e2e"
|
||||
},
|
||||
{
|
||||
"shard_index": 6,
|
||||
"shard_count": 8,
|
||||
"shard_label": "7/8",
|
||||
"shard_count": 12,
|
||||
"shard_label": "7/12",
|
||||
"task": "ci:e2e"
|
||||
},
|
||||
{
|
||||
"shard_index": 7,
|
||||
"shard_count": 8,
|
||||
"shard_label": "8/8",
|
||||
"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"
|
||||
}
|
||||
],
|
||||
"verify_runner_e2e_support": [
|
||||
{
|
||||
"shard_index": 0,
|
||||
"shard_count": 4,
|
||||
"shard_label": "1/4",
|
||||
"task": "ci:runner-e2e-support"
|
||||
},
|
||||
{
|
||||
"shard_index": 1,
|
||||
"shard_count": 4,
|
||||
"shard_label": "2/4",
|
||||
"task": "ci:runner-e2e-support"
|
||||
},
|
||||
{
|
||||
"shard_index": 2,
|
||||
"shard_count": 4,
|
||||
"shard_label": "3/4",
|
||||
"task": "ci:runner-e2e-support"
|
||||
},
|
||||
{
|
||||
"shard_index": 3,
|
||||
"shard_count": 4,
|
||||
"shard_label": "4/4",
|
||||
"task": "ci:runner-e2e-support"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -1,9 +1,34 @@
|
||||
// Audited prose inputs, shared by routing, Vitest selection and task hashing.
|
||||
// Do not broaden this to all Markdown: docs/api and bundled skills are runtime inputs.
|
||||
// Do not broaden this to all Markdown: docs/api, bundled skills, maps, and
|
||||
// non-Markdown fixtures (e.g. doc/connections/*.json) are runtime/test inputs.
|
||||
const AUDITED_ROOT_GUIDANCE_DOCS = new Set([
|
||||
"doc/CLI.md",
|
||||
"doc/DATABASE.md",
|
||||
"doc/DEVELOPING.md",
|
||||
"doc/GOAL.md",
|
||||
"doc/PRODUCT.md",
|
||||
"doc/PUBLISHING.md",
|
||||
"doc/RELEASING.md",
|
||||
]);
|
||||
|
||||
const AUDITED_DOC_GUIDANCE_DIR =
|
||||
/^doc\/(?:architecture|connections|design|experimental|memory|performance|plugins|pr|spec|testing)\/(?:[^/]+\/)*[^/]+\.md$/;
|
||||
|
||||
const AUDITED_DOCS_GUIDANCE_DIR =
|
||||
/^docs\/(?:adapters|cli|companies|deploy|guides|performance|plans|specs|start)\/(?:[^/]+\/)*[^/]+\.md$/;
|
||||
|
||||
const AUDITED_HISTORICAL_DOC = /^doc\/(?:plans|logs)\/(?:[^/]+\/)*[^/]+\.md$/;
|
||||
|
||||
export function documentationInput(file) {
|
||||
if (file === "doc/DEVELOPING.md" || file === "doc/DATABASE.md") return "guidance";
|
||||
if (/^doc\/plans\/(?:[^/]+\/)*[^/]+\.md$/.test(file)
|
||||
&& !file.split("/").includes("..")) return "historical";
|
||||
if (typeof file !== "string" || file.split("/").includes("..")) return null;
|
||||
if (AUDITED_HISTORICAL_DOC.test(file)) return "historical";
|
||||
if (
|
||||
AUDITED_ROOT_GUIDANCE_DOCS.has(file)
|
||||
|| AUDITED_DOC_GUIDANCE_DIR.test(file)
|
||||
|| AUDITED_DOCS_GUIDANCE_DIR.test(file)
|
||||
) {
|
||||
return "guidance";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
import assert from "node:assert/strict";
|
||||
import test from "node:test";
|
||||
import { readFileSync } from "node:fs";
|
||||
import { mkdtempSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
import { cachePlan } from "../../../scripts/ci-dependency-cache.mjs";
|
||||
import { findWorkspacePostinstallScripts, replayWorkspacePostinstalls } from "../../../scripts/replay-workspace-postinstall.mjs";
|
||||
|
||||
const entries = {
|
||||
"package.json": '{"scripts":{"postinstall":"node scripts/link-plugin-dev-sdk.mjs"}}',
|
||||
@@ -97,10 +100,54 @@ test('known Copilot hooks permit caching, track their helpers, and still run on
|
||||
const action = readFileSync(new URL('../../actions/setup-ci-dependencies/action.yml', import.meta.url), 'utf8');
|
||||
const replay = action.split(' - name: Replay workspace install hooks after restore')[1].split(' - name:')[0];
|
||||
assert.match(replay, /if: steps\.installed\.outputs\.cache-hit == 'true'/);
|
||||
assert.match(replay, /node scripts\/replay-workspace-postinstall\.mjs/);
|
||||
assert.match(replay, /pnpm -r --if-present run postinstall\s+pnpm run postinstall/);
|
||||
assert.ok(action.indexOf('Replay workspace install hooks') < action.indexOf('Validate workspace links'));
|
||||
});
|
||||
|
||||
test('replay-workspace-postinstall discovers repo hooks, runs workspace hooks before root, and fails closed', async () => {
|
||||
const discovered = findWorkspacePostinstallScripts();
|
||||
assert.deepEqual(
|
||||
discovered.workspaceHooks.map((hook) => hook.relDir),
|
||||
['packages/paperclip-runner', 'server'],
|
||||
);
|
||||
assert.equal(discovered.rootHook?.relDir, '.');
|
||||
|
||||
const tmp = mkdtempSync(path.join(os.tmpdir(), 'replay-postinstall-'));
|
||||
try {
|
||||
const orderFile = path.join(tmp, 'order.log');
|
||||
mkdirSync(path.join(tmp, 'packages/alpha'), { recursive: true });
|
||||
mkdirSync(path.join(tmp, 'server'), { recursive: true });
|
||||
writeFileSync(path.join(tmp, 'package.json'), JSON.stringify({
|
||||
name: 'root',
|
||||
scripts: { postinstall: "node -e \"require('node:fs').appendFileSync(process.env.ORDER_FILE, 'root\\n')\"" },
|
||||
}));
|
||||
writeFileSync(path.join(tmp, 'packages/alpha/package.json'), JSON.stringify({
|
||||
name: '@test/alpha',
|
||||
scripts: { postinstall: "node -e \"require('node:fs').appendFileSync(process.env.ORDER_FILE, 'alpha\\n')\"" },
|
||||
}));
|
||||
writeFileSync(path.join(tmp, 'server/package.json'), JSON.stringify({
|
||||
name: '@test/server',
|
||||
scripts: { postinstall: "node -e \"require('node:fs').appendFileSync(process.env.ORDER_FILE, 'server\\n')\"" },
|
||||
}));
|
||||
|
||||
const result = await replayWorkspacePostinstalls(tmp, { ...process.env, ORDER_FILE: orderFile });
|
||||
assert.deepEqual(result, { workspaceCount: 2, ranRoot: true });
|
||||
const lines = readFileSync(orderFile, 'utf8').trim().split('\n');
|
||||
assert.equal(lines.length, 3);
|
||||
assert.equal(lines[2], 'root', 'root postinstall must run after workspace postinstall hooks');
|
||||
assert.deepEqual(lines.slice(0, 2).sort(), ['alpha', 'server']);
|
||||
|
||||
writeFileSync(path.join(tmp, 'server/package.json'), JSON.stringify({
|
||||
name: '@test/server',
|
||||
scripts: { postinstall: 'node -e "process.exit(3)"' },
|
||||
}));
|
||||
await assert.rejects(() => replayWorkspacePostinstalls(tmp, { ...process.env, ORDER_FILE: orderFile }), /postinstall in server exited with 3/);
|
||||
} finally {
|
||||
rmSync(tmp, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
test('cache restores are exact and only a frozen canonical master push can publish entries', () => {
|
||||
const action = readFileSync(new URL('../../actions/setup-ci-dependencies/action.yml', import.meta.url), 'utf8');
|
||||
const installed = action.slice(action.indexOf(' - name: Restore installed'), action.indexOf(' - name: Locate pnpm'));
|
||||
|
||||
@@ -100,7 +100,12 @@ test("PR workflow keeps Build fast and passes PR-mode context to typecheck and V
|
||||
assert.ok(!build.includes("node scripts/verify-grok-npm-install.mjs"), "PR Build must not run the 4-min public npm install verifier");
|
||||
assert.ok(!build.includes("warm-public-install-npm-cache.mjs"), "PR Build must not warm the unused public npm install cache");
|
||||
assert.ok(build.includes("pnpm --filter @paperclipai/server build:runtime"), "PR Build still verifies production runtime bundle");
|
||||
assert.match(build, /PAPERCLIP_TSC_EMIT_ONLY: \$\{\{ !\(contains\(github\.event\.pull_request\.labels\.\*\.name, 'full-ci'\) \|\| vars\.CI_INCREMENTAL_MODE == 'full'\) && '1' \|\| '' \}\}\n\s+run: pnpm build/, "ordinary PR Build should use emit-only server compile while full-ci and CI_INCREMENTAL_MODE=full clear PAPERCLIP_TSC_EMIT_ONLY");
|
||||
assert.match(build, /if \[ "\$\{PAPERCLIP_CI_FULL:-\}" = "1" \]; then\n\s+scripts\/server-boot-smoke\.sh/);
|
||||
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");
|
||||
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 \}\}/);
|
||||
@@ -120,6 +125,19 @@ test("PR workflow keeps Build fast and passes PR-mode context to typecheck and V
|
||||
assert.equal(prKey, releaseKey, "E2E UI dist reader and writer keys must match exactly");
|
||||
assert.doesNotMatch(e2e.split("Restore prebuilt UI assets")[1].split("Run e2e tests")[0], /restore-keys:/);
|
||||
assert.match(e2e, /PAPERCLIP_E2E_SKIP_UI_BUILD: \$\{\{ steps\.e2e_ui_dist\.outputs\.cache-hit == 'true' && '1' \|\| '' \}\}/);
|
||||
|
||||
// Exact reader/writer key parity for prebuilt Runner dist and incremental typecheck caches.
|
||||
const prRunnerDistKey = typecheck.match(/key: (runner-dist-v1-.+)/)?.[1];
|
||||
const releaseRunnerDistKey = releaseBuild.match(/key: (runner-dist-v1-.+)/)?.[1];
|
||||
assert.ok(prRunnerDistKey && releaseRunnerDistKey, "both pr-trusted.yml and release-verify.yml must define runner-dist-v1 cache key");
|
||||
assert.equal(prRunnerDistKey, releaseRunnerDistKey, "runner-dist-v1 reader and writer keys must match exactly");
|
||||
assert.doesNotMatch(typecheck.split("Restore prebuilt Runner dist")[1].split("Restore incremental typecheck")[0], /restore-keys:/);
|
||||
|
||||
const prIncPrefix = typecheck.match(/key: (typecheck-incremental-v1-.+)-\$\{\{ github\.event\.pull_request\.base\.sha \}\}/)?.[1];
|
||||
const releaseIncPrefix = releaseBuild.match(/key: (typecheck-incremental-v1-.+)-\$\{\{ github\.sha \}\}/)?.[1];
|
||||
assert.ok(prIncPrefix && releaseIncPrefix, "both pr-trusted.yml and release-verify.yml must define typecheck-incremental-v1 prefix");
|
||||
assert.equal(prIncPrefix, releaseIncPrefix, "typecheck-incremental-v1 reader and writer prefixes must match exactly");
|
||||
assert.doesNotMatch(workflow, /actions\/cache\/save@/, "pr-trusted.yml must never save caches");
|
||||
});
|
||||
|
||||
test("source inspected across package boundaries selects its consumers", () => {
|
||||
@@ -386,18 +404,36 @@ else process.exit(3);
|
||||
test("audited prose does not widen source selection, but guidance still runs its uncached guard", () => {
|
||||
const source = "ui/src/components/Sidebar.tsx";
|
||||
const sourcePlan = plan([source]);
|
||||
for (const doc of ["doc/DEVELOPING.md", "doc/DATABASE.md", "doc/plans/2026-10-30-example.md"]) {
|
||||
for (const doc of [
|
||||
"doc/DEVELOPING.md",
|
||||
"doc/DATABASE.md",
|
||||
"doc/connections/GOOGLE-WORKSPACE.md",
|
||||
"docs/guides/board-operator/importing-and-exporting.md",
|
||||
"doc/plans/2026-10-30-example.md",
|
||||
"doc/logs/2026-11-01-verify.md",
|
||||
]) {
|
||||
const mixed = plan([source, doc]);
|
||||
assert.equal(mixed.forceReason, null);
|
||||
assert.deepEqual(mixed.jobs, sourcePlan.jobs);
|
||||
assert.deepEqual(mixed.documentation, [doc]);
|
||||
assert.equal(mixed.forceReason, null, doc);
|
||||
assert.deepEqual(mixed.jobs, sourcePlan.jobs, doc);
|
||||
assert.deepEqual(mixed.documentation, [doc], doc);
|
||||
}
|
||||
const guidance = plan(["doc/DEVELOPING.md"]);
|
||||
assert.deepEqual([...selectedTasks(guidance)], ["ci:typecheck"]);
|
||||
assert.equal(config.tasks["//#ci:typecheck"].cache, false);
|
||||
assert.deepEqual([...selectedTasks(plan(["doc/connections/GOOGLE-WORKSPACE.md"]))], ["ci:typecheck"]);
|
||||
assert.equal(selected(plan(["doc/connections/GOOGLE-WORKSPACE.md"]), "canary_dry_run"), false);
|
||||
assert.equal(selected(plan(["doc/connections/GOOGLE-WORKSPACE.md"]), "verify_paperclip_runner"), false);
|
||||
assert.deepEqual([...selectedTasks(plan(["doc/plans/2026-10-30-example.md"]))], []);
|
||||
for (const file of ["docs/api/issues.md", "doc/unknown.md", "doc/plans/tool.sh", "skills/paperclip/SKILL.md",
|
||||
"server/src/onboarding-assets/default/AGENTS.md", "tests/fixtures/example.md"]) {
|
||||
assert.deepEqual([...selectedTasks(plan(["doc/logs/2026-11-01-verify.md"]))], []);
|
||||
for (const file of [
|
||||
"docs/api/issues.md",
|
||||
"doc/connections/tool-method-permission-reviews.json",
|
||||
"doc/unknown.md",
|
||||
"doc/plans/tool.sh",
|
||||
"skills/paperclip/SKILL.md",
|
||||
"server/src/onboarding-assets/default/AGENTS.md",
|
||||
"tests/fixtures/example.md",
|
||||
]) {
|
||||
assert.ok(selectedTasks(plan([source, file])).has("ci:server"), file);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -435,7 +435,7 @@ for (const [name, vars, github, expected = "ubuntu-latest"] of reviewPlacementCa
|
||||
test("GitHub-hosted PR runs queue at most four jobs per matrix", () => {
|
||||
const trusted = readFileSync(new URL("../../workflows/pr-trusted.yml", import.meta.url), "utf8");
|
||||
const strategies = trusted.match(/^ {4}strategy:\n(?: {6}.*\n)+/gm) ?? [];
|
||||
assert.equal(strategies.length, 4);
|
||||
assert.equal(strategies.length, 5);
|
||||
for (const strategy of strategies) {
|
||||
const expression = strategy.match(/^ {6}max-parallel: \$\{\{ (.+) \}\}$/m)?.[1];
|
||||
assert.ok(expression, "every PR matrix must bound its GitHub-hosted fan-out");
|
||||
|
||||
@@ -499,6 +499,33 @@ jobs:
|
||||
if: ${{ steps.runner_release_crate.outputs.cache-hit == 'true' }}
|
||||
run: node scripts/runner-release-crate-cache.mjs mark-current
|
||||
|
||||
# Exact-key master cache for prebuilt Runner dist (read-only restore;
|
||||
# prepare-runner-vendor.mjs self-validates the SHA-256 input digest and
|
||||
# every output size, rebuilding on any mismatch).
|
||||
- name: Restore prebuilt Runner dist (read only)
|
||||
id: runner_dist
|
||||
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
with:
|
||||
path: |
|
||||
packages/paperclip-runner/dist
|
||||
packages/paperclip-runner/node_modules/.cache/paperclip-runner-build-inputs.json
|
||||
packages/paperclip-eval-kernel/dist
|
||||
key: runner-dist-v1-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('package.json', 'pnpm-lock.yaml', 'pnpm-workspace.yaml', 'tsconfig.base.json', 'patches/**', 'packages/shared/src/**', 'packages/adapter-utils/src/**', 'packages/plugins/sdk/src/**', 'packages/paperclip-runner/package.json', 'packages/paperclip-runner/tsconfig*.json', 'packages/paperclip-runner/rust-toolchain.toml', 'packages/paperclip-runner/acpx-profiles.json', 'packages/paperclip-runner/antigravity-distributions.json', 'packages/paperclip-runner/cursor-*.json', 'packages/paperclip-runner/src/**', 'packages/paperclip-runner/scripts/**', 'packages/paperclip-runner/protocol/**', 'packages/paperclip-runner/spec/**', 'packages/paperclip-runner/runner/Cargo.toml', 'packages/paperclip-runner/runner/Cargo.lock', 'packages/paperclip-runner/runner/crates/**', 'packages/paperclip-runner/test-fixtures/**', 'packages/paperclip-runner/test/fixtures/**', 'packages/paperclip-eval-kernel/package.json', 'packages/paperclip-eval-kernel/tsconfig*.json', 'packages/paperclip-eval-kernel/src/**') }}
|
||||
|
||||
# Prefix-keyed master cache for TS 7 incremental .tsbuildinfo + dts outputs
|
||||
# (read-only restore). TypeScript 7 hashes file contents so changed PR files
|
||||
# always re-check cleanly while unchanged layers finish 10-18x faster.
|
||||
- name: Restore incremental typecheck cache (read only)
|
||||
id: typecheck_incremental
|
||||
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
with:
|
||||
path: |
|
||||
server/node_modules/.cache/paperclip-typecheck
|
||||
ui/node_modules/.cache/paperclip-ui.tsbuildinfo
|
||||
key: typecheck-incremental-v1-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('pnpm-lock.yaml', 'tsconfig.base.json', 'server/tsconfig.json', 'server/src/__tests__/tsconfig.json', 'server/scripts/typecheck-layers.mjs', 'ui/tsconfig.json') }}-${{ github.event.pull_request.base.sha }}
|
||||
restore-keys: |
|
||||
typecheck-incremental-v1-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('pnpm-lock.yaml', 'tsconfig.base.json', 'server/tsconfig.json', 'server/src/__tests__/tsconfig.json', 'server/scripts/typecheck-layers.mjs', 'ui/tsconfig.json') }}-
|
||||
|
||||
- name: Typecheck, CLI guidance safety and release registry tests
|
||||
if: ${{ hashFiles('scripts/ci-typecheck-lane.mjs') != '' }}
|
||||
run: node scripts/ci-typecheck-lane.mjs
|
||||
@@ -772,15 +799,19 @@ jobs:
|
||||
retention-days: 14
|
||||
|
||||
verify_runner_e2e_support:
|
||||
name: Runner support suite
|
||||
name: Runner support suite (${{ matrix.shard_label }})
|
||||
needs: [gate]
|
||||
if: ${{ needs.gate.outputs.full_ci == 'true' && (needs.gate.outputs.plan == '' || fromJSON(needs.gate.outputs.plan).jobs.verify_runner_e2e_support.run) }}
|
||||
runs-on: ${{ needs.gate.outputs.runner }}
|
||||
timeout-minutes: 20
|
||||
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_runner_e2e_support.matrix) || '{"include":[{"shard_index":0,"shard_count":4,"shard_label":"1/4","task":"ci:runner-e2e-support"},{"shard_index":1,"shard_count":4,"shard_label":"2/4","task":"ci:runner-e2e-support"},{"shard_index":2,"shard_count":4,"shard_label":"3/4","task":"ci:runner-e2e-support"},{"shard_index":3,"shard_count":4,"shard_label":"4/4","task":"ci:runner-e2e-support"}]}') }}
|
||||
|
||||
env:
|
||||
PAPERCLIP_CI_PROFILE: ${{ needs.gate.outputs.profile_ci }}
|
||||
PAPERCLIP_CI_PROFILE_JOB: Runner support suite
|
||||
PAPERCLIP_CI_PROFILE_JOB: Runner support suite (${{ matrix.shard_label }})
|
||||
PAPERCLIP_CI_PR_AUTHOR: ${{ github.event.pull_request.user.login }}
|
||||
|
||||
# The paid Runner workflows depend on this suite: workflow security
|
||||
@@ -820,7 +851,14 @@ jobs:
|
||||
|
||||
# Builds the plugin SDK first, then runs Vitest and the node:test files.
|
||||
- name: Run the Runner support suite
|
||||
run: pnpm test:e2e:runner:unit
|
||||
run: |
|
||||
if grep -q 'shard-index' tests/runner-e2e/run-unit.mjs; then
|
||||
node tests/runner-e2e/run-unit.mjs --shard-index ${{ matrix.shard_index }} --shard-count ${{ matrix.shard_count }}
|
||||
elif [ "${{ matrix.shard_index }}" = "0" ]; then
|
||||
pnpm test:e2e:runner:unit
|
||||
else
|
||||
echo "Checkout predates sharded run-unit.mjs; shard 0 covers full suite."
|
||||
fi
|
||||
|
||||
- name: Upload CI profile timings
|
||||
continue-on-error: true
|
||||
@@ -1293,7 +1331,12 @@ jobs:
|
||||
- name: Build Runner Evalbook viewer
|
||||
run: pnpm --filter @paperclipai/paperclip-runner build:issue-thread
|
||||
|
||||
# On ordinary PRs, Typecheck + Release Registry checks every server type in
|
||||
# parallel, so server build only needs JS emit (`PAPERCLIP_TSC_EMIT_ONLY=1`).
|
||||
# Full-CI / release builds emit full declarations and re-check types.
|
||||
- name: Build
|
||||
env:
|
||||
PAPERCLIP_TSC_EMIT_ONLY: ${{ !(contains(github.event.pull_request.labels.*.name, 'full-ci') || vars.CI_INCREMENTAL_MODE == 'full') && '1' || '' }}
|
||||
run: pnpm build
|
||||
|
||||
# Always verify the production runtime bundle builds cleanly (~4s).
|
||||
@@ -1658,7 +1701,7 @@ 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.e2e_shards.matrix) || '{"include":[{"shard_index":0,"shard_count":8,"shard_label":"1/8","task":"ci:e2e"},{"shard_index":1,"shard_count":8,"shard_label":"2/8","task":"ci:e2e"},{"shard_index":2,"shard_count":8,"shard_label":"3/8","task":"ci:e2e"},{"shard_index":3,"shard_count":8,"shard_label":"4/8","task":"ci:e2e"},{"shard_index":4,"shard_count":8,"shard_label":"5/8","task":"ci:e2e"},{"shard_index":5,"shard_count":8,"shard_label":"6/8","task":"ci:e2e"},{"shard_index":6,"shard_count":8,"shard_label":"7/8","task":"ci:e2e"},{"shard_index":7,"shard_count":8,"shard_label":"8/8","task":"ci:e2e"}]}') }}
|
||||
matrix: ${{ fromJSON(needs.gate.outputs.plan != '' && toJSON(fromJSON(needs.gate.outputs.plan).jobs.e2e_shards.matrix) || '{"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"}]}') }}
|
||||
|
||||
env:
|
||||
PAPERCLIP_CI_PROFILE: ${{ needs.gate.outputs.profile_ci }}
|
||||
|
||||
@@ -586,6 +586,59 @@ jobs:
|
||||
path: server/ui-dist
|
||||
key: e2e-ui-dist-v2-${{ 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/package.json', 'packages/shared/src/**', 'packages/adapter-utils/package.json', 'packages/adapter-utils/src/**', 'packages/adapters/*/package.json', 'packages/adapters/*/src/**', 'packages/plugins/sdk/package.json', 'packages/plugins/sdk/src/**', 'announcements/examples/animated/**') }}
|
||||
|
||||
# Exact-key master cache for prebuilt Runner dist (read-only restore in
|
||||
# pr-trusted.yml typecheck_release_registry). Only canonical master pushes write.
|
||||
- name: Check for prebuilt Runner dist cache
|
||||
id: runner_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: |
|
||||
packages/paperclip-runner/dist
|
||||
packages/paperclip-runner/node_modules/.cache/paperclip-runner-build-inputs.json
|
||||
packages/paperclip-eval-kernel/dist
|
||||
key: runner-dist-v1-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('package.json', 'pnpm-lock.yaml', 'pnpm-workspace.yaml', 'tsconfig.base.json', 'patches/**', 'packages/shared/src/**', 'packages/adapter-utils/src/**', 'packages/plugins/sdk/src/**', 'packages/paperclip-runner/package.json', 'packages/paperclip-runner/tsconfig*.json', 'packages/paperclip-runner/rust-toolchain.toml', 'packages/paperclip-runner/acpx-profiles.json', 'packages/paperclip-runner/antigravity-distributions.json', 'packages/paperclip-runner/cursor-*.json', 'packages/paperclip-runner/src/**', 'packages/paperclip-runner/scripts/**', 'packages/paperclip-runner/protocol/**', 'packages/paperclip-runner/spec/**', 'packages/paperclip-runner/runner/Cargo.toml', 'packages/paperclip-runner/runner/Cargo.lock', 'packages/paperclip-runner/runner/crates/**', 'packages/paperclip-runner/test-fixtures/**', 'packages/paperclip-runner/test/fixtures/**', 'packages/paperclip-eval-kernel/package.json', 'packages/paperclip-eval-kernel/tsconfig*.json', 'packages/paperclip-eval-kernel/src/**') }}
|
||||
|
||||
- name: Save prebuilt Runner dist for PR typecheck
|
||||
if: ${{ github.repository == 'paperclipai/paperclip' && github.event_name == 'push' && github.ref == 'refs/heads/master' && inputs.ref == github.sha && steps.runner_dist.outputs.cache-hit != 'true' }}
|
||||
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
with:
|
||||
path: |
|
||||
packages/paperclip-runner/dist
|
||||
packages/paperclip-runner/node_modules/.cache/paperclip-runner-build-inputs.json
|
||||
packages/paperclip-eval-kernel/dist
|
||||
key: runner-dist-v1-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('package.json', 'pnpm-lock.yaml', 'pnpm-workspace.yaml', 'tsconfig.base.json', 'patches/**', 'packages/shared/src/**', 'packages/adapter-utils/src/**', 'packages/plugins/sdk/src/**', 'packages/paperclip-runner/package.json', 'packages/paperclip-runner/tsconfig*.json', 'packages/paperclip-runner/rust-toolchain.toml', 'packages/paperclip-runner/acpx-profiles.json', 'packages/paperclip-runner/antigravity-distributions.json', 'packages/paperclip-runner/cursor-*.json', 'packages/paperclip-runner/src/**', 'packages/paperclip-runner/scripts/**', 'packages/paperclip-runner/protocol/**', 'packages/paperclip-runner/spec/**', 'packages/paperclip-runner/runner/Cargo.toml', 'packages/paperclip-runner/runner/Cargo.lock', 'packages/paperclip-runner/runner/crates/**', 'packages/paperclip-runner/test-fixtures/**', 'packages/paperclip-runner/test/fixtures/**', 'packages/paperclip-eval-kernel/package.json', 'packages/paperclip-eval-kernel/tsconfig*.json', 'packages/paperclip-eval-kernel/src/**') }}
|
||||
|
||||
# Incremental TS 7 .tsbuildinfo + server dts cache for PR typecheck
|
||||
# (read-only prefix restore in pr-trusted.yml). Only canonical master pushes write.
|
||||
- name: Check for incremental typecheck cache
|
||||
id: typecheck_incremental
|
||||
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/node_modules/.cache/paperclip-typecheck
|
||||
ui/node_modules/.cache/paperclip-ui.tsbuildinfo
|
||||
key: typecheck-incremental-v1-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('pnpm-lock.yaml', 'tsconfig.base.json', 'server/tsconfig.json', 'server/src/__tests__/tsconfig.json', 'server/scripts/typecheck-layers.mjs', 'ui/tsconfig.json') }}-${{ github.sha }}
|
||||
|
||||
- name: Warm incremental typecheck cache
|
||||
if: ${{ github.repository == 'paperclipai/paperclip' && github.event_name == 'push' && github.ref == 'refs/heads/master' && inputs.ref == github.sha && steps.typecheck_incremental.outputs.cache-hit != 'true' }}
|
||||
run: |
|
||||
node server/scripts/typecheck-layers.mjs --checkers 4
|
||||
node scripts/storybook-catalog.mjs
|
||||
node scripts/run-tsc.mjs -p ui/tsconfig.json --incremental --tsBuildInfoFile ui/node_modules/.cache/paperclip-ui.tsbuildinfo
|
||||
|
||||
- name: Save incremental typecheck cache for PR typecheck
|
||||
if: ${{ github.repository == 'paperclipai/paperclip' && github.event_name == 'push' && github.ref == 'refs/heads/master' && inputs.ref == github.sha && steps.typecheck_incremental.outputs.cache-hit != 'true' }}
|
||||
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
with:
|
||||
path: |
|
||||
server/node_modules/.cache/paperclip-typecheck
|
||||
ui/node_modules/.cache/paperclip-ui.tsbuildinfo
|
||||
key: typecheck-incremental-v1-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('pnpm-lock.yaml', 'tsconfig.base.json', 'server/tsconfig.json', 'server/src/__tests__/tsconfig.json', 'server/scripts/typecheck-layers.mjs', 'ui/tsconfig.json') }}-${{ github.sha }}
|
||||
|
||||
runner_binary_targets:
|
||||
if: inputs.runner_binaries_only
|
||||
name: Read exact-source daemon targets
|
||||
|
||||
Reference in new issue
Block a user