perf(ci): shard release-verify stragglers and move typecheck cache warmup (#23156)

## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work.
> - Every merge to `master` runs `release-verify.yml` on the dedicated
`paperclip-post-merge-x64` fleet to certify the exact commit before
downstream releases consume it.
> - Four lanes currently bottleneck `release-verify.yml` at ~6m–6m 30s
(`server-integration`, `server (1/10)`, `Serialized tests (1/9)`, and
`Build` with 75s of serial typecheck-cache warming), while every other
lane finishes in 2m–3m 45s.
> - Post-merge verification latency directly delays every release
pipeline waiting on exact-source proof.
> - This pull request shards those three test stragglers using existing
deterministic shard flags and moves incremental typecheck cache warming
into `typecheck` (skipping a redundant server pass when `pnpm -r
typecheck` already populated the cache).
> - The benefit is a balanced ~4m post-merge verification critical path
with zero weakened or removed checks.

## Linked Issues or Issue Description

**What happened?**
Post-merge release verification (`release-verify.yml`) takes ~6m 30s on
its slowest lanes (`server-integration` 6m 29s, `server (1/10)` 6m 23s,
`Serialized tests (1/9)` 6m 00s, and `Build` 5m 45s including 75s of
`Warm incremental typecheck cache`), while the rest of the workflow
finishes in ~3m.

**Expected behavior**
All lanes in `release-verify.yml` should run with balanced parallelism
on `paperclip-post-merge-x64` so post-merge verification finishes in ~4m
while running every existing check.

**Steps to reproduce**
1. Inspect a canonical `master` run of `cloud-readiness.yml` /
`release-verify.yml` (such as run `46019173820`).
2. Compare the four straggler lanes (345s–389s) against `Typecheck`
(162s) and all other verification lanes (58s–225s).

## What Changed

- Expanded `general-server-without-chat-or-native-runner` in
`.github/workflows/release-verify.yml` from 10 to 20 shards.
- Expanded `serialized_tests` in `.github/workflows/release-verify.yml`
from 9 to 16 shards.
- Split `verify_paperclip_runner` `server-integration` into 3 sharded
lanes (`server-integration (1/3)`, `(2/3)`, `(3/3)`) passing
`--shard-index` and `--shard-count` to `pnpm test:run:general -- --group
general-server-native-runner`.
- Moved `Check/Warm/Save incremental typecheck cache` from `build` into
`typecheck`, skipping the duplicate
`server/scripts/typecheck-layers.mjs` pass when `pnpm -r typecheck`
already populated `server/node_modules/.cache/paperclip-typecheck`.
- Updated workflow guard tests in
`.github/scripts/tests/release-runner-cache.test.mjs`,
`scripts/__tests__/release-verify-workflow.test.mjs`, and
`.github/scripts/tests/ci-plan.test.mjs`.

## Verification

- Ran locally against the PR worktree:
- `node --test .github/scripts/tests/release-runner-cache.test.mjs
scripts/__tests__/release-verify-workflow.test.mjs
.github/scripts/tests/ci-plan.test.mjs
.github/scripts/tests/post-merge-runner-routing.test.mjs` — all passed.
- Full PR CI runs on this PR.

## Risks

- Low risk: all tests and verification gates remain required; only
matrix shard counts and cache-warm job placement change.
- Peak post-merge AWS fleet concurrency increases by 19 lanes on
`paperclip-post-merge-x64` (isolated from PR CI); easily reverted by
reverting this PR if fleet scaling shows unexpected queue wait.

## Model Used

- Gemini (Antigravity)

## 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)
This commit is contained in:
Dotta authored and GitHub committed 2026-11-28 06:32:00 -06:00
1 parent 9c1fd24642
commit 7bd652e3ba
4 files changed
+173 -87

No files matched your search

@@ -38,9 +38,9 @@ test("parallel lanes cover check:all exactly once and never bypass verification"
const scripts = JSON.parse(readFileSync(new URL("../../../packages/paperclip-runner/package.json", import.meta.url))).scripts;
const matrixBlock = runner.split(" matrix:\n include:\n")[1].split("\n steps:")[0];
const matrixEntries = matrixBlock.split(/^ - /m).slice(1).map((entry) => {
const row = { lane: "", checks: "", vitest_lane: "" };
const row = { lane: "", checks: "", vitest_lane: "", server_integration_shard_index: "", server_integration_shard_count: "" };
for (const line of entry.trim().split("\n")) {
const match = /^\s*(lane|checks|vitest_lane):\s*(.+?)\s*$/.exec(line);
const match = /^\s*(lane|checks|vitest_lane|server_integration_shard_index|server_integration_shard_count):\s*(.+?)\s*$/.exec(line);
assert.ok(match, `unexpected matrix field line: ${line}`);
row[match[1]] = match[2];
}
@@ -48,8 +48,15 @@ test("parallel lanes cover check:all exactly once and never bypass verification"
});
const checks = matrixEntries.filter((row) => row.checks).flatMap((row) => row.checks.split(" "));
assert.deepEqual(checks, scripts["check:all-without-vitest"].split(" && ").map((command) => command.replace(/^pnpm run /, "")));
assert.deepEqual(matrixEntries.map((row) => row.lane), ["protocol-static", "protocol (1/4)", "protocol (2/4)", "protocol (3/4)", "protocol (4/4)", "rust", "api-authority", "server-integration"]);
assert.deepEqual(matrixEntries.map((row) => row.lane), [
"protocol-static", "protocol (1/4)", "protocol (2/4)", "protocol (3/4)", "protocol (4/4)",
"rust", "api-authority", "server-integration (1/3)", "server-integration (2/3)", "server-integration (3/3)",
]);
assert.deepEqual(matrixEntries.filter((row) => row.vitest_lane).map((row) => row.vitest_lane), ["1/4", "2/4", "3/4", "4/4"]);
assert.deepEqual(
matrixEntries.filter((row) => row.lane.startsWith("server-integration")).map((row) => [row.server_integration_shard_index, row.server_integration_shard_count]),
[["0", "3"], ["1", "3"], ["2", "3"]],
);
assert.match(runner, /fail-fast: false/);
assert.doesNotMatch(runner, /max-parallel: 1|^ needs:|continue-on-error:/m);
const verify = runner.split(" - name: Verify Paperclip Runner\n")[1].split(" - name:")[0];
@@ -57,7 +64,7 @@ test("parallel lanes cover check:all exactly once and never bypass verification"
assert.match(verify, /set -euo pipefail/);
assert.match(verify, /for check in \$RUNNER_CHECKS; do\s+pnpm --filter @paperclipai\/paperclip-runner "\$check"\s+done/);
const verifyIf = verify.match(/^\s*if: \$\{\{ (.+) \}\}$/m)?.[1];
assert.equal(verifyIf, "matrix.lane != 'server-integration' && matrix.vitest_lane == ''");
assert.equal(verifyIf, "!startsWith(matrix.lane, 'server-integration') && matrix.vitest_lane == ''");
const vitestStep = runner.split(" - name: Run Paperclip Runner package Vitest lane\n")[1].split(" - name:")[0];
assert.match(vitestStep, /RUNNER_VITEST_LANE: \$\{\{ matrix.vitest_lane \}\}/);
assert.match(vitestStep, /pnpm --filter @paperclipai\/paperclip-runner test:typescript:vitest "--package-lane=\$RUNNER_VITEST_LANE"/);
@@ -65,10 +72,11 @@ test("parallel lanes cover check:all exactly once and never bypass verification"
assert.equal(vitestIf, "matrix.vitest_lane != ''");
const serverStep = runner.split(" - name: Run native server integration suites\n")[1].split(" - name:")[0];
const serverIf = serverStep.match(/^\s*if: \$\{\{ (.+) \}\}$/m)?.[1];
const startsWith = (value, prefix) => String(value).startsWith(prefix);
for (const matrix of matrixEntries) {
const runsVerify = runInNewContext(verifyIf, { matrix });
const runsVitest = runInNewContext(vitestIf, { matrix });
const runsServer = runInNewContext(serverIf, { matrix });
const runsVerify = runInNewContext(verifyIf, { matrix, startsWith });
const runsVitest = runInNewContext(vitestIf, { matrix, startsWith });
const runsServer = runInNewContext(serverIf, { matrix, startsWith });
assert.equal([runsVerify, runsVitest, runsServer].filter(Boolean).length, 1, `lane ${matrix.lane} must match exactly one verification step`);
assert.equal(Boolean(matrix.checks), runsVerify, `lane ${matrix.lane} checks field must match Verify Paperclip Runner condition`);
assert.equal(Boolean(matrix.vitest_lane), runsVitest, `lane ${matrix.lane} vitest_lane field must match Vitest lane condition`);
@@ -86,7 +94,7 @@ test("only the trusted Rust lane writes, and warms both build profiles before sa
assert.match(warm, /run: pnpm --filter @paperclipai\/paperclip-runner build:rust/);
const sha = "a".repeat(40);
const base = { repository: "paperclipai/paperclip", event_name: "push", ref: "refs/heads/master", sha };
for (const lane of ["protocol-static", "protocol (1/4)", "protocol (2/4)", "protocol (3/4)", "protocol (4/4)", "rust", "api-authority", "server-integration"]) {
for (const lane of ["protocol-static", "protocol (1/4)", "protocol (2/4)", "protocol (3/4)", "protocol (4/4)", "rust", "api-authority", "server-integration (1/3)", "server-integration (2/3)", "server-integration (3/3)"]) {
for (const [overrides, ref, trusted] of [
[{}, sha, true],
[{ event_name: "pull_request", ref: "refs/pull/1/merge" }, sha, false],