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:
Dotta authored and GitHub committed 2026-11-24 13:25:46 -06:00
1 parent 3ca9b6d471
commit cffd17e78a
39 files changed
+6684 -4813

No files matched your search

+98 -6
View File
@@ -1,6 +1,7 @@
import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import { getPriority } from "node:os";
import { mkdtempSync, readFileSync, rmSync } from "node:fs";
import { getPriority, tmpdir } from "node:os";
import path from "node:path";
import test from "node:test";
import {
BACKGROUND_PRIORITY,
@@ -14,8 +15,10 @@ import {
selectBuildGapPackages,
SERIAL_BUILD_GAPS,
shouldRunReleaseRegistryTests,
shouldRunRunnerRustTypecheck,
typecheckUiIncremental,
} from "../ci-typecheck-lane.mjs";
import { PROJECTS, selectTestProjects } from "../typecheck-test-projects.mjs";
import { PROJECTS, orderProjectsLpt, selectTestProjects } from "../typecheck-test-projects.mjs";
const plan = () =>
planLane({
@@ -81,12 +84,21 @@ test("every check of the sequential job is planned with exact DAG dependencies",
for (const name of ["paperclipai", "@paperclipai/ui"]) assert.ok(byName.has(`typecheck ${name}`), name);
assert.deepEqual(byName.get("typecheck paperclipai").needs, [PREPARE_RUNNER_VENDOR]);
assert.equal(byName.get("typecheck @paperclipai/ui").needs, undefined);
assert.equal(byName.get("typecheck @paperclipai/ui").command, "node");
assert.deepEqual(byName.get("typecheck @paperclipai/ui").args, ["scripts/ci-typecheck-lane.mjs", "--typecheck-ui"]);
assert.deepEqual(byName.get("typecheck @paperclipai/ui").env, { GOMAXPROCS: "2" });
assert.deepEqual(byName.get("release registry tests").args, ["run", "test:release-registry"]);
assert.equal(byName.get("release registry tests").needs, undefined);
assert.ok(!byName.has("CLI guidance safety"));
const declarationReaders = tasks.filter((task) => task.needs?.includes("server declarations"));
assert.equal(declarationReaders.length, 2 + PROJECTS.length);
// Longest non-incremental project (tests/runner-e2e) is scheduled first among declaration readers.
assert.equal(declarationReaders[0].name, "test project tests/runner-e2e");
// UI starts ahead of smaller build-gap packages so it overlaps with prepare runner vendor from t=0.
assert.ok(
tasks.findIndex((t) => t.name === "typecheck @paperclipai/ui") <
tasks.findIndex((t) => t.name === "typecheck paperclipai"),
);
});
test("computeResourceProfile scales concurrency, checkers, and UI GOMAXPROCS across 2/4/8-core runners", () => {
@@ -106,7 +118,7 @@ test("computeResourceProfile scales concurrency, checkers, and UI GOMAXPROCS acr
serverLayerCheckers: 1,
testProjectCheckers: 1,
uiGomaxprocs: 2,
testProgramsConcurrency: 2,
testProgramsConcurrency: 3,
testProgramsCheckers: 1,
});
// 8-core / 16 GiB (c8i.2xlarge): 4 concurrent tasks so all 4 server layers finish in 1 wave under 16 GiB.
@@ -117,7 +129,7 @@ test("computeResourceProfile scales concurrency, checkers, and UI GOMAXPROCS acr
serverLayerCheckers: 1,
testProjectCheckers: 1,
uiGomaxprocs: 4,
testProgramsConcurrency: 3,
testProgramsConcurrency: 4,
testProgramsCheckers: 1,
});
// 8-core / 32 GiB (m8i.2xlarge): higher checkers and concurrency.
@@ -140,7 +152,7 @@ test("computeResourceProfile scales concurrency, checkers, and UI GOMAXPROCS acr
const byName = new Map(tasks.map((t) => [t.name, t]));
assert.deepEqual(byName.get("server declarations").args.slice(-2), ["--checkers", "3"]);
assert.deepEqual(byName.get("typecheck @paperclipai/ui").env, { GOMAXPROCS: "4" });
assert.ok(byName.get("typecheck test programs").args.join(" ").includes("--concurrency 3"));
assert.ok(byName.get("typecheck test programs").args.join(" ").includes("--concurrency 4"));
});
test("resolveScope uses CI_PLAN in PR mode, honors PAPERCLIP_CI_FULL, and fails closed", () => {
@@ -406,3 +418,83 @@ test("the PR typecheck job runs the lane after the Runner release crate restore"
assert.ok(fallback.includes(command), command);
}
});
test("PR mode skips Runner Rust typecheck when only shared TypeScript packages changed", () => {
assert.equal(shouldRunRunnerRustTypecheck(null), true);
assert.equal(shouldRunRunnerRustTypecheck(["packages/shared/src/customer-success.ts"]), false);
assert.equal(shouldRunRunnerRustTypecheck(["packages/adapter-utils/src/types.ts"]), false);
assert.equal(shouldRunRunnerRustTypecheck(["packages/paperclip-runner/runner/crates/runner-core/src/lib.rs"]), true);
assert.equal(shouldRunRunnerRustTypecheck(["packages/paperclip-runner/acpx-profiles.json"]), true);
assert.equal(shouldRunRunnerRustTypecheck(["rust-toolchain.toml"]), true);
assert.equal(shouldRunRunnerRustTypecheck(["tsconfig.base.json"]), true);
const sharedPr = planLane({
buildGapPackages: ["@paperclipai/paperclip-runner"],
testLayers: ["tests"],
changedFiles: ["packages/shared/src/customer-success.ts"],
});
const runnerTask = sharedPr.prepare.find((t) => t.name === "typecheck @paperclipai/paperclip-runner");
assert.deepEqual(runnerTask.args, ["--filter", "@paperclipai/paperclip-runner", "run", "typecheck:typescript"]);
const runnerPr = planLane({
buildGapPackages: ["@paperclipai/paperclip-runner"],
testLayers: ["tests"],
changedFiles: ["packages/paperclip-runner/protocol/schemas/result.schema.json"],
});
const runnerFullTask = runnerPr.prepare.find((t) => t.name === "typecheck @paperclipai/paperclip-runner");
assert.deepEqual(runnerFullTask.args, ["--filter", "@paperclipai/paperclip-runner", "typecheck"]);
});
test("typecheckUiIncremental runs storybook catalog then incremental tsc with a portable tsBuildInfoFile", () => {
const tmpRoot = mkdtempSync(path.join(tmpdir(), "ui-typecheck-inc-"));
try {
const calls = [];
const status = typecheckUiIncremental({
root: tmpRoot,
env: { GOMAXPROCS: "2" },
spawnSyncImpl: (cmd, args, opts) => {
calls.push({ kind: "spawn", cmd, args, cwd: opts.cwd });
return { status: 0 };
},
runTscImpl: (args, opts) => {
calls.push({ kind: "tsc", args, cwd: opts.cwd, env: opts.env });
return { status: 0 };
},
});
assert.equal(status, 0);
assert.equal(calls.length, 2);
assert.equal(calls[0].kind, "spawn");
assert.equal(calls[0].args[0], path.join(tmpRoot, "scripts", "storybook-catalog.mjs"));
assert.equal(calls[0].cwd, path.join(tmpRoot, "ui"));
assert.deepEqual(calls[1].args, [
"-p",
"tsconfig.json",
"--incremental",
"--tsBuildInfoFile",
"node_modules/.cache/paperclip-ui.tsbuildinfo",
]);
assert.equal(calls[1].cwd, path.join(tmpRoot, "ui"));
assert.deepEqual(calls[1].env, { GOMAXPROCS: "2" });
// Catalog failure stops before tsc.
const failedCalls = [];
const failStatus = typecheckUiIncremental({
root: tmpRoot,
spawnSyncImpl: () => ({ status: 3 }),
runTscImpl: () => {
failedCalls.push("tsc");
return { status: 0 };
},
});
assert.equal(failStatus, 3);
assert.deepEqual(failedCalls, []);
} finally {
rmSync(tmpRoot, { recursive: true, force: true });
}
});
test("orderProjectsLpt schedules tests/runner-e2e first among test projects", () => {
const ordered = orderProjectsLpt(PROJECTS);
assert.equal(ordered[0], "tests/runner-e2e");
assert.equal(ordered.length, PROJECTS.length);
});
+51 -1
View File
@@ -27,7 +27,9 @@ const trustedPrWorkflowPath = ".github/workflows/pr-trusted.yml";
const trustedPrWorkflow = path.join(repoRoot, trustedPrWorkflowPath);
const routingWorkflow = path.join(repoRoot, ".github", "workflows", "ci-routing.yml");
const SHARD_COUNT = 8;
const ciTaskMatrixPath = path.join(repoRoot, ".github", "ci-task-matrix.json");
const SHARD_COUNT = JSON.parse(readFileSync(ciTaskMatrixPath, "utf8")).e2e_shards.length;
const TARGET_PHASE3_SHARD_COUNT = 12;
function runShard(args) {
const result = spawnSync(process.execPath, [script, ...args], { cwd: repoRoot, encoding: "utf8" });
@@ -161,6 +163,54 @@ test("playwright.config.ts supports skipping the UI build when PAPERCLIP_E2E_SKI
assert.match(config, /availableParallelism/);
});
test("start-e2e-server.ts boots disposable embedded Postgres without durable fsync before migrations", () => {
const bootstrap = readFileSync(path.join(repoRoot, "tests", "e2e", "start-e2e-server.ts"), "utf8");
assert.match(bootstrap, /--no-sync/);
assert.match(bootstrap, /fsync = off/);
assert.match(bootstrap, /synchronous_commit = off/);
assert.match(bootstrap, /full_page_writes = off/);
assert.match(bootstrap, /Promise\.all\(/);
});
test("12-shard partitioning stays complete, segregated, and balanced under 145s estimated wall-clock", () => {
const durations = loadShardDurations(durationsManifest);
const specs = listE2eSpecs();
const fallbackWeight = defaultSuiteWeight(durations);
const shards = partitionE2eShards(specs, TARGET_PHASE3_SHARD_COUNT, durations, {
parallelWorkers: EFFECTIVE_PARALLEL_SPEEDUP,
});
assert.equal(shards.length, TARGET_PHASE3_SHARD_COUNT);
const combined = shards.flatMap((shard) => shard.files);
assert.deepEqual([...combined].sort(), [...specs].sort());
for (const shard of shards) {
assert.ok(shard.files.length > 0, "no 12-shard bucket may be empty");
const serialCount = shard.files.filter(isSerialE2eSpec).length;
assert.ok(
serialCount === 0 || serialCount === shard.files.length,
`12-shard bucket must not mix serial and parallel specs: ${shard.files.join(", ")}`,
);
}
const wallWeights = shards.map((shard) => {
const serialSum = shard.files.reduce((sum, file) => sum + (durations[file] ?? fallbackWeight), 0);
return shard.mode === "parallel" ? serialSum / EFFECTIVE_PARALLEL_SPEEDUP : serialSum;
});
const heaviest = Math.max(...wallWeights);
const totalWall = wallWeights.reduce((sum, weight) => sum + weight, 0);
const largestSerialSpec = Math.max(
0,
...specs.filter(isSerialE2eSpec).map((file) => durations[file] ?? fallbackWeight),
);
const bound = Math.max((totalWall / TARGET_PHASE3_SHARD_COUNT) * 1.15, largestSerialSpec);
assert.ok(
heaviest <= bound,
`heaviest 12-shard bucket ${Math.round(heaviest)}ms exceeds the balance bound (${Math.round(bound)}ms)`,
);
assert.ok(
heaviest <= 145_000,
`heaviest 12-shard bucket ${Math.round(heaviest)}ms exceeds 145s Phase 3 ceiling`,
);
});
test("the duration manifest only names specs that still exist", () => {
const durations = loadShardDurations(durationsManifest);
assert.ok(Object.keys(durations).length > 0, "expected a populated duration manifest");
@@ -423,8 +423,9 @@ test("only the master Rust lane writes the crate, after a lookup, with the reade
// The dependency cache's own writer gate is the same expression.
assert.match(body, new RegExp(`save-if: \\$\\{\\{ ${WRITER_GATE.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")} \\}\\}`));
assert.equal((body.match(/actions\/cache\/save@/g) ?? []).length, 2, "release and debug workspace caches have separate guarded writers");
// The only other cache save in release-verify.yml is the master-guarded E2E UI dist writer in `build`.
assert.equal((releaseWorkflow.match(/actions\/cache\/save@/g) ?? []).length, 3, "release-verify.yml has guarded writers for release crate, debug crate, and E2E UI dist");
// The other cache saves in release-verify.yml are the master-guarded writers in `build`
// (E2E UI dist, prebuilt Runner dist, and incremental typecheck cache).
assert.equal((releaseWorkflow.match(/actions\/cache\/save@/g) ?? []).length, 5, "release-verify.yml has guarded writers for release crate, debug crate, E2E UI dist, Runner dist, and incremental typecheck");
});
test("the scope names the platform, the compiler and the checkout root, and survives a missing rustc", () => {
File diff suppressed because it is too large. Load diff
+142 -70
View File
@@ -1,22 +1,24 @@
#!/usr/bin/env node
import { execFileSync, spawn, spawnSync } from "node:child_process";
import { mkdirSync } from "node:fs";
import { availableParallelism, setPriority, totalmem } from "node:os";
import path from "node:path";
import { fileURLToPath } from "node:url";
import { listLayers } from "../server/scripts/typecheck-layers.mjs";
import { LOW_MEMORY_VARIABLE, EMIT_ONLY_VARIABLE } from "./run-tsc.mjs";
import { LOW_MEMORY_VARIABLE, EMIT_ONLY_VARIABLE, runTsc } from "./run-tsc.mjs";
import { selectTestPrograms } from "./typecheck-test-programs.mjs";
import { PROJECTS, selectTestProjects } from "./typecheck-test-projects.mjs";
import { PROJECTS, orderProjectsLpt, selectTestProjects } from "./typecheck-test-projects.mjs";
export const SERIAL_BUILD_GAPS = ["@paperclipai/paperclip-runner"];
export const BACKGROUND_PRIORITY = 10;
export const DEFAULT_MAX_CONCURRENCY = 3;
export const DEFAULT_TEST_PROGRAMS_CONCURRENCY = 2;
export const DEFAULT_TEST_PROGRAMS_CONCURRENCY = 3;
export const PREPARE_RUNNER_VENDOR = "prepare runner vendor";
export const BUILD_SERVER_EMIT_ONLY = "build server without type checks";
const SERVER_DECLARATIONS = "server declarations";
export const CLI_GUIDANCE_SAFETY = "CLI guidance safety";
export const UI_TSBUILDINFO = "ui/node_modules/.cache/paperclip-ui.tsbuildinfo";
const lowMemory = { [LOW_MEMORY_VARIABLE]: "1" };
/**
@@ -45,7 +47,7 @@ export function computeResourceProfile({ cpus = availableParallelism(), totalMem
serverLayerCheckers: 1,
testProjectCheckers: 1,
uiGomaxprocs: 2,
testProgramsConcurrency: 2,
testProgramsConcurrency: 3,
testProgramsCheckers: 1,
};
}
@@ -58,7 +60,7 @@ export function computeResourceProfile({ cpus = availableParallelism(), totalMem
serverLayerCheckers: 1,
testProjectCheckers: 1,
uiGomaxprocs: 4,
testProgramsConcurrency: 3,
testProgramsConcurrency: 4,
testProgramsCheckers: 1,
};
}
@@ -200,6 +202,47 @@ export function shouldRunServerTypecheck(changedFiles, selectedProjects = []) {
);
}
/**
* Rust typecheck (`cargo fmt --check && cargo check`) only reads files inside `packages/paperclip-runner/`
* and Rust toolchain config. When a PR only touches shared TypeScript packages (`packages/shared`,
* `packages/adapter-utils`, `packages/paperclip-eval-kernel`), running `typecheck:typescript` alone is sound
* and saves ~9s of serial prepare time.
*/
export function shouldRunRunnerRustTypecheck(changedFiles) {
if (!Array.isArray(changedFiles)) return true;
if (changedFiles.some(isGlobalTypecheckInput)) return true;
return changedFiles.some(
(file) =>
file.startsWith("packages/paperclip-runner/") ||
file.startsWith("rust-toolchain") ||
file.startsWith(".cargo/"),
);
}
export function typecheckUiIncremental({
root,
env = process.env,
spawnSyncImpl = spawnSync,
runTscImpl = runTsc,
}) {
const uiDir = path.join(root, "ui");
const catalog = spawnSyncImpl(process.execPath, [path.join(root, "scripts", "storybook-catalog.mjs")], {
cwd: uiDir,
env,
stdio: "inherit",
});
if (catalog.error) throw catalog.error;
if ((catalog.status ?? 1) !== 0) return catalog.status ?? 1;
const tsBuildInfoPath = path.join(root, UI_TSBUILDINFO);
mkdirSync(path.dirname(tsBuildInfoPath), { recursive: true });
const relTsBuildInfo = path.relative(uiDir, tsBuildInfoPath).split(path.sep).join(path.posix.sep);
return runTscImpl(["-p", "tsconfig.json", "--incremental", "--tsBuildInfoFile", relTsBuildInfo], {
cwd: uiDir,
env,
}).status;
}
function readGitDiff(root, rangeArgs, execGit) {
const output = execGit(["diff", "--no-ext-diff", "--no-textconv", "--no-renames", "--name-only", "-z", ...rangeArgs, "--"], {
cwd: root,
@@ -277,20 +320,38 @@ export function planLane({
}) {
const isPrMode = Array.isArray(changedFiles);
const selectedBuildGaps = selectBuildGapPackages(buildGapPackages, changedFiles);
const selectedProjects = selectTestProjects(changedFiles, projects);
const selectedProjects = orderProjectsLpt(selectTestProjects(changedFiles, projects));
const runServer = shouldRunServerTypecheck(changedFiles, selectedProjects);
const runReleaseRegistry = shouldRunReleaseRegistryTests(changedFiles);
const runRunnerRust = shouldRunRunnerRustTypecheck(changedFiles);
const programSelection = selectTestPrograms(changedFiles);
const typecheckPackage = (name, background, needs) => ({
name: `typecheck ${name}`,
command: "pnpm",
args: ["--filter", name, "typecheck"],
// UI typecheck runs ~7-10x faster without --singleThreaded while staying at ~4.4 GiB with bounded GOMAXPROCS.
env: name === "@paperclipai/ui" ? { GOMAXPROCS: String(resources.uiGomaxprocs) } : lowMemory,
background,
...(needs ? { needs } : {}),
});
const typecheckPackage = (name, background, needs) => {
if (name === "@paperclipai/ui") {
return {
name: `typecheck ${name}`,
command: "node",
args: ["scripts/ci-typecheck-lane.mjs", "--typecheck-ui"],
// UI typecheck runs ~7-10x faster without --singleThreaded while staying at ~4.4 GiB with bounded GOMAXPROCS,
// and persists ui/node_modules/.cache/paperclip-ui.tsbuildinfo for incremental reuse across runs.
env: { GOMAXPROCS: String(resources.uiGomaxprocs) },
background,
...(needs ? { needs } : {}),
};
}
const args =
name === "@paperclipai/paperclip-runner" && !runRunnerRust
? ["--filter", name, "run", "typecheck:typescript"]
: ["--filter", name, "typecheck"];
return {
name: `typecheck ${name}`,
command: "pnpm",
args,
env: lowMemory,
background,
...(needs ? { needs } : {}),
};
};
const prepare = [{ name: "link workspace packages", command: "pnpm", args: ["run", "preflight:workspace-links"] }];
@@ -352,6 +413,11 @@ export function planLane({
tasks.push({ name: "release registry tests", command: "pnpm", args: ["run", "test:release-registry"] });
}
if (selectedBuildGaps.includes("@paperclipai/ui")) {
// Schedule UI right at t=0 alongside prepare runner vendor / release registry instead of behind small plugins.
tasks.push(typecheckPackage("@paperclipai/ui", true));
}
if (programSelection.programs.length > 0 || programSelection.checkCoverage) {
const programArgs = [
"scripts/typecheck-test-programs.mjs",
@@ -386,19 +452,9 @@ export function planLane({
}
if (runServer) {
// Start LPT-ordered test projects (longest non-incremental project like tests/runner-e2e first)
// alongside incremental server test layers so they never form a late tail wave.
tasks.push(
...testLayers.map((layer) => ({
name: `server layer ${layer}`,
command: "node",
args: [
"server/scripts/typecheck-layers.mjs",
"--layer",
layer,
"--checkers",
String(resources.serverLayerCheckers),
],
needs: needsDeclarations,
})),
...selectedProjects.map((project) => ({
name: `test project ${project}`,
command: "node",
@@ -411,6 +467,18 @@ export function planLane({
],
needs: needsDeclarations,
})),
...testLayers.map((layer) => ({
name: `server layer ${layer}`,
command: "node",
args: [
"server/scripts/typecheck-layers.mjs",
"--layer",
layer,
"--checkers",
String(resources.serverLayerCheckers),
],
needs: needsDeclarations,
})),
{
name: BUILD_SERVER_EMIT_ONLY,
command: "pnpm",
@@ -433,7 +501,7 @@ export function planLane({
tasks.push(
...selectedBuildGaps
.filter((name) => !SERIAL_BUILD_GAPS.includes(name))
.filter((name) => !SERIAL_BUILD_GAPS.includes(name) && name !== "@paperclipai/ui")
.map((name) =>
typecheckPackage(name, true, runServer && name === "paperclipai" ? needsRunnerVendor : undefined),
),
@@ -624,50 +692,54 @@ function listBuildGapPackages(root) {
if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
const args = process.argv.slice(2);
const resources = computeResourceProfile();
let concurrency = resources.laneConcurrency;
let base;
let full = false;
let valid = true;
for (let i = 0; i < args.length; i += 1) {
const arg = args[i];
if (arg === "--concurrency") {
concurrency = Number(args[++i]);
if (!Number.isInteger(concurrency) || concurrency < 1) valid = false;
} else if (arg === "--base") {
base = args[++i];
if (!base || base.startsWith("--")) valid = false;
} else if (arg === "--full") {
full = true;
} else {
valid = false;
}
}
if (!valid) {
console.error("Usage: node scripts/ci-typecheck-lane.mjs [--concurrency <n>] [--base <ref>] [--full]");
process.exitCode = 2;
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
if (args.length === 1 && args[0] === "--typecheck-ui") {
process.exitCode = typecheckUiIncremental({ root, env: process.env });
} else {
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
const buildGapPackages = listBuildGapPackages(root);
if (buildGapPackages === null) {
process.exitCode = 1;
const resources = computeResourceProfile();
let concurrency = resources.laneConcurrency;
let base;
let full = false;
let valid = true;
for (let i = 0; i < args.length; i += 1) {
const arg = args[i];
if (arg === "--concurrency") {
concurrency = Number(args[++i]);
if (!Number.isInteger(concurrency) || concurrency < 1) valid = false;
} else if (arg === "--base") {
base = args[++i];
if (!base || base.startsWith("--")) valid = false;
} else if (arg === "--full") {
full = true;
} else {
valid = false;
}
}
if (!valid) {
console.error("Usage: node scripts/ci-typecheck-lane.mjs [--concurrency <n>] [--base <ref>] [--full] | --typecheck-ui");
process.exitCode = 2;
} else {
const testLayers = listLayers(path.join(root, "server"))
.filter((layer) => !layer.emitsDeclarations)
.map((layer) => layer.name);
const scope = resolveScope({ root, env: process.env, base, full });
const scopeDetail =
scope.mode === "pr"
? `PR (${scope.changedFiles.length} changed files via ${scope.reason})`
: `full (${scope.reason})`;
const lanePlan = planLane({ buildGapPackages, testLayers, changedFiles: scope.changedFiles, resources });
console.log(
`typecheck lane: ${concurrency} at a time (${availableParallelism()} vCPU, ${(totalmem() / 1024 ** 3).toFixed(1)} GiB; ` +
`decl=${resources.serverDeclCheckers}, layers=${resources.serverLayerCheckers}, ui=${resources.uiGomaxprocs}); ` +
`mode: ${scopeDetail}; prepare: ${lanePlan.prepare.length}; tasks: ${lanePlan.tasks.length}; ` +
`build gaps: ${buildGapPackages.join(", ")}`,
);
process.exitCode = await runLane({ ...lanePlan, concurrency, cwd: root });
const buildGapPackages = listBuildGapPackages(root);
if (buildGapPackages === null) {
process.exitCode = 1;
} else {
const testLayers = listLayers(path.join(root, "server"))
.filter((layer) => !layer.emitsDeclarations)
.map((layer) => layer.name);
const scope = resolveScope({ root, env: process.env, base, full });
const scopeDetail =
scope.mode === "pr"
? `PR (${scope.changedFiles.length} changed files via ${scope.reason})`
: `full (${scope.reason})`;
const lanePlan = planLane({ buildGapPackages, testLayers, changedFiles: scope.changedFiles, resources });
console.log(
`typecheck lane: ${concurrency} at a time (${availableParallelism()} vCPU, ${(totalmem() / 1024 ** 3).toFixed(1)} GiB; ` +
`decl=${resources.serverDeclCheckers}, layers=${resources.serverLayerCheckers}, ui=${resources.uiGomaxprocs}); ` +
`mode: ${scopeDetail}; prepare: ${lanePlan.prepare.length}; tasks: ${lanePlan.tasks.length}; ` +
`build gaps: ${buildGapPackages.join(", ")}`,
);
process.exitCode = await runLane({ ...lanePlan, concurrency, cwd: root });
}
}
}
}
+162
View File
@@ -289,6 +289,12 @@
"reason": "Native runner replacement, lease, or continuation recovery soak (89.9s in run 45238253588)",
"measuredMs": 89949
},
{
"path": "server/src/services/ssh-remote-workspace-heartbeat-cli.integration.test.ts",
"category": "workspace-recovery-soak",
"reason": "Real SSH server remote-workspace CLI heartbeat soak (88.9s in run 45440355579)",
"measuredMs": 88895
},
{
"path": "server/src/__tests__/heartbeat-workspace-busy.test.ts",
"category": "workspace-recovery-soak",
@@ -379,6 +385,12 @@
"reason": "Plugin scheduled-work real-clock deadline/quietness soak (70s)",
"measuredMs": 69649
},
{
"path": "server/src/services/ssh-remote-workspace-heartbeat-codex.integration.test.ts",
"category": "workspace-recovery-soak",
"reason": "Real SSH server remote-workspace Codex heartbeat soak (69.4s in run 45440355579)",
"measuredMs": 69357
},
{
"path": "server/src/__tests__/heartbeat-held-comment-wake.test.ts",
"category": "recovery-idle-maintenance-soak",
@@ -403,6 +415,18 @@
"reason": "Real-clock recovery, census, idle-quietness, retention, deadline, or background-work soak (65.7s in run 45238253588)",
"measuredMs": 65684
},
{
"path": "server/src/services/ssh-remote-workspace-heartbeat-claude.integration.test.ts",
"category": "workspace-recovery-soak",
"reason": "Real SSH server remote-workspace Claude heartbeat soak (64.2s in run 45440355579)",
"measuredMs": 64218
},
{
"path": "server/src/services/ssh-remote-workspace-heartbeat-gemini.integration.test.ts",
"category": "workspace-recovery-soak",
"reason": "Real SSH server remote-workspace Gemini heartbeat soak (61.8s in run 45440355579)",
"measuredMs": 61817
},
{
"path": "server/src/services/native-runtime/native-safe-replacement.test.ts",
"category": "restart-lease-soak",
@@ -697,6 +721,12 @@
"reason": "Remote workspace snapshot reuse soak (39s)",
"measuredMs": 38856
},
{
"path": "server/src/services/quarantined-task-retry.test.ts",
"category": "recovery-idle-maintenance-soak",
"reason": "Quarantined task retry soak (38.8s in run 45440355579)",
"measuredMs": 38826
},
{
"path": "server/src/__tests__/native-workspace-sync-history.test.ts",
"category": "workspace-recovery-soak",
@@ -901,6 +931,12 @@
"reason": "Remote/git workspace recovery, migration, or heavy working-copy soak (30.4s in run 45238253588)",
"measuredMs": 30390
},
{
"path": "server/src/services/remote-workspace-readonly-inventory-entries.test.ts",
"category": "workspace-recovery-soak",
"reason": "Remote workspace readonly inventory entries soak (30.4s in run 45440355579)",
"measuredMs": 30380
},
{
"path": "server/src/services/heartbeat/run-lifecycle.test.ts",
"category": "recovery-idle-maintenance-soak",
@@ -1063,6 +1099,12 @@
"reason": "Real-clock soak, watchdog, drain, sweep, archive, or heavy lifecycle integration (25.2s in run 45238253588)",
"measuredMs": 25170
},
{
"path": "server/src/__tests__/heartbeat-isolated-continuation-hold.test.ts",
"category": "restart-lease-soak",
"reason": "Isolated continuation hold soak (25.2s in run 45440355579)",
"measuredMs": 25154
},
{
"path": "server/src/services/fresh-continuation-move-forward-offer.test.ts",
"category": "restart-lease-soak",
@@ -1195,6 +1237,12 @@
"reason": "Real-clock recovery, census, idle-quietness, retention, deadline, or background-work soak (22.3s in run 45238253588)",
"measuredMs": 22254
},
{
"path": "server/src/__tests__/heartbeat-clean-continuation-dispatch.test.ts",
"category": "restart-lease-soak",
"reason": "Clean continuation dispatch soak (22.2s in run 45440355579)",
"measuredMs": 22213
},
{
"path": "server/src/__tests__/heartbeat-agent-directory-busy.test.ts",
"category": "workspace-recovery-soak",
@@ -1339,6 +1387,12 @@
"reason": "Execution workspace reopen git/DB soak (20.3s in run 45238253588)",
"measuredMs": 20305
},
{
"path": "server/src/__tests__/environment-retained-orphan-listing-cost.test.ts",
"category": "recovery-idle-maintenance-soak",
"reason": "Retained orphan listing SQL query-cost benchmark (20.2s in run 45440355579)",
"measuredMs": 20229
},
{
"path": "server/src/__tests__/heartbeat-remote-workspace-busy.test.ts",
"category": "workspace-recovery-soak",
@@ -1393,6 +1447,12 @@
"reason": "External provider, adapter CLI, sandbox-provider, or container-image integration soak (19.8s in run 45238253588)",
"measuredMs": 19765
},
{
"path": "server/src/__tests__/plugin-loader-activation-timeout.test.ts",
"category": "recovery-idle-maintenance-soak",
"reason": "Real-clock plugin loader activation timeout soak (19.6s in run 45440355579)",
"measuredMs": 19637
},
{
"path": "server/src/__tests__/chat-completion-delivery.test.ts",
"category": "channel-integration-soak",
@@ -1441,6 +1501,12 @@
"reason": "Agent file durability storage soak (19.1s in run 45238253588)",
"measuredMs": 19117
},
{
"path": "server/src/__tests__/abandoned-workspace-files-hold.test.ts",
"category": "workspace-recovery-soak",
"reason": "Abandoned workspace files hold soak (19.0s in run 45440355579)",
"measuredMs": 19046
},
{
"path": "server/src/services/native-runtime/plugin-task-source-recovery.integration.test.ts",
"category": "recovery-idle-maintenance-soak",
@@ -1453,6 +1519,12 @@
"reason": "Heavy multi-component integration suite (covered on master/release-verify/full-ci) (18.6s in run 45238253588)",
"measuredMs": 18587
},
{
"path": "server/src/__tests__/heartbeat-answer-behind-settling-run.test.ts",
"category": "recovery-idle-maintenance-soak",
"reason": "Settling-run answer race soak (18.4s in run 45440355579)",
"measuredMs": 18391
},
{
"path": "server/src/services/native-runtime/create-skill.integration.test.ts",
"category": "integration-soak",
@@ -1471,6 +1543,18 @@
"reason": "Real-clock recovery, census, idle-quietness, retention, deadline, or background-work soak (18.0s in run 45238253588)",
"measuredMs": 17969
},
{
"path": "server/src/__tests__/heartbeat-context-compaction-execution.test.ts",
"category": "recovery-idle-maintenance-soak",
"reason": "Heartbeat context compaction execution soak (18.0s in run 45440355579)",
"measuredMs": 17964
},
{
"path": "server/src/services/native-runtime/native-cancelled-workspace-preservation.test.ts",
"category": "workspace-recovery-soak",
"reason": "Cancelled workspace preservation soak (17.9s in run 45440355579)",
"measuredMs": 17893
},
{
"path": "server/src/__tests__/merged-pr-confirmation-work.test.ts",
"category": "recovery-idle-maintenance-soak",
@@ -1525,6 +1609,12 @@
"reason": "Heavy multi-component integration suite (covered on master/release-verify/full-ci) (16.8s in run 45238253588)",
"measuredMs": 16813
},
{
"path": "server/src/__tests__/legacy-workspace-rehome.test.ts",
"category": "workspace-recovery-soak",
"reason": "Legacy workspace rehome migration soak (16.8s in run 45440355579)",
"measuredMs": 16753
},
{
"path": "server/src/__tests__/recovery-durable-wait-projection.test.ts",
"category": "recovery-idle-maintenance-soak",
@@ -1573,6 +1663,12 @@
"reason": "Heavy native-runtime continuation, lease, handoff, or multi-turn soak (16.2s in run 45238253588)",
"measuredMs": 16226
},
{
"path": "server/src/__tests__/heartbeat-lease-release-before-runner-attach.test.ts",
"category": "restart-lease-soak",
"reason": "Heartbeat lease release before runner attach soak (16.2s in run 45440355579)",
"measuredMs": 16200
},
{
"path": "server/src/services/native-runtime/native-provider-capacity.integration.test.ts",
"category": "integration-soak",
@@ -1585,6 +1681,12 @@
"reason": "Real-clock soak, watchdog, drain, sweep, archive, or heavy lifecycle integration (16.0s in run 45238253588)",
"measuredMs": 16037
},
{
"path": "server/src/__tests__/heartbeat-reassignment-deferred-wake.test.ts",
"category": "recovery-idle-maintenance-soak",
"reason": "Heartbeat reassignment deferred-wake soak (16.0s in run 45440355579)",
"measuredMs": 16031
},
{
"path": "server/src/__tests__/decision-expiry-work.test.ts",
"category": "recovery-idle-maintenance-soak",
@@ -1597,6 +1699,12 @@
"reason": "Real-clock recovery, census, idle-quietness, retention, deadline, or background-work soak (15.7s in run 45238253588)",
"measuredMs": 15693
},
{
"path": "server/src/services/setup-failure-after-work-continuation.test.ts",
"category": "restart-lease-soak",
"reason": "Setup failure after work continuation soak (15.5s in run 45440355579)",
"measuredMs": 15457
},
{
"path": "server/src/__tests__/chat-native-progress-work.test.ts",
"category": "recovery-idle-maintenance-soak",
@@ -1609,6 +1717,12 @@
"reason": "Real-clock soak, watchdog, drain, sweep, archive, or heavy lifecycle integration (15.2s in run 45238253588)",
"measuredMs": 15224
},
{
"path": "server/src/__tests__/heartbeat-workspace-finalize-branch.test.ts",
"category": "workspace-recovery-soak",
"reason": "Heartbeat workspace finalize-branch git soak (15.0s in run 45440355579)",
"measuredMs": 15046
},
{
"path": "server/src/services/remote-workspace-snapshot-storage.test.ts",
"category": "workspace-recovery-soak",
@@ -1729,6 +1843,12 @@
"reason": "Real-clock soak, watchdog, drain, sweep, archive, or heavy lifecycle integration (13.5s in run 45238253588)",
"measuredMs": 13543
},
{
"path": "server/src/__tests__/never-started-retry-cancellation-hold.test.ts",
"category": "recovery-idle-maintenance-soak",
"reason": "Never-started retry cancellation hold soak (13.5s in run 45440355579)",
"measuredMs": 13511
},
{
"path": "server/src/__tests__/eval-feedback-recovery.integration.test.ts",
"category": "recovery-idle-maintenance-soak",
@@ -1957,6 +2077,12 @@
"reason": "Remote/git workspace recovery, migration, or heavy working-copy soak (10.5s in run 45238253588)",
"measuredMs": 10495
},
{
"path": "server/src/__tests__/plugin-connector-tool-timeout.test.ts",
"category": "recovery-idle-maintenance-soak",
"reason": "Real-clock plugin connector tool timeout soak (10.5s in run 45440355579)",
"measuredMs": 10473
},
{
"path": "server/src/services/native-runtime/agent-instruction-tools.integration.test.ts",
"category": "integration-soak",
@@ -1987,6 +2113,12 @@
"reason": "Real-clock recovery, census, idle-quietness, retention, deadline, or background-work soak (10.4s in run 45238253588)",
"measuredMs": 10383
},
{
"path": "server/src/services/native-runtime/native-harness-backup-upload-deadline.integration.test.ts",
"category": "restart-lease-soak",
"reason": "Native harness backup upload deadline soak (10.3s in run 45440355579)",
"measuredMs": 10256
},
{
"path": "server/src/services/legacy-source-unavailable-continuation.test.ts",
"category": "restart-lease-soak",
@@ -2047,6 +2179,12 @@
"reason": "Heavy multi-component integration suite (covered on master/release-verify/full-ci) (9.9s in run 45238253588)",
"measuredMs": 9905
},
{
"path": "server/src/__tests__/plugin-workspace-terminal-hold.integration.test.ts",
"category": "workspace-recovery-soak",
"reason": "Plugin workspace terminal hold integration soak (9.9s in run 45440355579)",
"measuredMs": 9863
},
{
"path": "server/src/services/native-runtime/native-harness-filesystem-independence-continuation.integration.test.ts",
"category": "restart-lease-soak",
@@ -2137,6 +2275,12 @@
"reason": "External provider, adapter CLI, sandbox-provider, or container-image integration soak (9.5s in run 45238253588)",
"measuredMs": 9454
},
{
"path": "server/src/services/online-durable-data-migration-postgres.test.ts",
"category": "workspace-recovery-soak",
"reason": "Online durable-data migration Postgres soak (9.4s in run 45440355579)",
"measuredMs": 9418
},
{
"path": "server/src/__tests__/plugin-runner-task.integration.test.ts",
"category": "integration-soak",
@@ -2155,6 +2299,12 @@
"reason": "Heavy git/worktree workspace preparation, rotation, or cleanup soak (9.3s in run 45238253588)",
"measuredMs": 9335
},
{
"path": "server/src/__tests__/tool-gateway-named-gateway-deadlock.test.ts",
"category": "recovery-idle-maintenance-soak",
"reason": "Tool gateway named-gateway deadlock soak (9.3s in run 45440355579)",
"measuredMs": 9298
},
{
"path": "server/src/__tests__/chat-run-milestone-recovery-work.test.ts",
"category": "recovery-idle-maintenance-soak",
@@ -2179,6 +2329,12 @@
"reason": "Heavy multi-component integration suite (covered on master/release-verify/full-ci) (9.2s in run 45238253588)",
"measuredMs": 9151
},
{
"path": "server/src/__tests__/native-plan-review-card-finalizer.test.ts",
"category": "restart-lease-soak",
"reason": "Native plan-review card finalizer soak (9.1s in run 45440355579)",
"measuredMs": 9104
},
{
"path": "server/src/maintenance/native-harness-prestage-runtime.test.ts",
"category": "restart-lease-soak",
@@ -2209,6 +2365,12 @@
"reason": "Heavy multi-component integration suite (covered on master/release-verify/full-ci) (9.0s in run 45238253588)",
"measuredMs": 8957
},
{
"path": "server/src/services/recovery/restored-configuration.test.ts",
"category": "recovery-idle-maintenance-soak",
"reason": "Restored configuration recovery soak (8.9s in run 45440355579)",
"measuredMs": 8921
},
{
"path": "server/src/__tests__/board-native-attachments.integration.test.ts",
"category": "integration-soak",
+68 -72
View File
@@ -1,85 +1,81 @@
{
"$comment": "Generated by node scripts/ci/refresh-test-durations.mjs from successful .github/workflows/pr.yml runs of PRs merged into master, each pinned to the PR's final head SHA. Per spec: the sum of gaps between consecutive Playwright result lines in 'Run e2e tests' (one worker), so fixture and navigation time count; tests located in a *.shared.ts file are attributed to the shard's matching spec. Median across runs. scripts/e2e-shard.mjs uses these weights only to place specs on shards; they never change which specs run. Missing specs retain their prior weight or the median fallback.",
"$comment": "Refreshed from successful merged PR #22729 (run 45440355579) and PR #22679 (run 45314200835) with exact per-test split totals for agent-chat-projects, chat-adapters-ui-providers, and chat-adapters-ui-messaging. scripts/e2e-shard.mjs uses these weights only to place specs on shards; they never change which specs run.",
"unit": "ms",
"sources": [
{
"pull": 19613,
"run": 42296374365,
"attempt": 2,
"sha": "cd8c9cd07c192832fa180a845577d36fb0bc41c8",
"url": "https://github.com/paperclipai/paperclip/actions/runs/42296374365"
"pull": 22729,
"run": 45440355579,
"attempt": 1,
"sha": "6ca7a27481e1af45c60069a563632f2b00a008a7",
"url": "https://github.com/paperclipai/paperclip/actions/runs/45440355579"
},
{
"pull": 19191,
"run": 42297700476,
"attempt": 1,
"sha": "36c0400008a12ec74ed65a0e17951f1b47221a02",
"url": "https://github.com/paperclipai/paperclip/actions/runs/42297700476"
},
{
"pull": 19176,
"run": 42296994179,
"attempt": 1,
"sha": "d0a937768da9be297485323c5b905eb63371ec15",
"url": "https://github.com/paperclipai/paperclip/actions/runs/42296994179"
"pull": 22679,
"run": 45314200835,
"attempt": 3,
"sha": "d930b4a9b30bc2d9e9a80f5ae93ca95a659bc52c",
"url": "https://github.com/paperclipai/paperclip/actions/runs/45314200835"
}
],
"coverage": {
"measured": 51,
"withSetup": 51,
"inventory": 51
"measured": 54,
"withSetup": 54,
"inventory": 54
},
"durations": {
"tests/e2e/acp-stop-continuation.spec.ts": 67299,
"tests/e2e/action-test-agent-picker.spec.ts": 13115,
"tests/e2e/agent-chat-messages.spec.ts": 42000,
"tests/e2e/agent-chat-projects.spec.ts": 155000,
"tests/e2e/agent-chat-sessions.spec.ts": 80000,
"tests/e2e/agent-configuration.spec.ts": 101200,
"tests/e2e/agentmail.spec.ts": 22000,
"tests/e2e/ai-personal-connection-recovery.spec.ts": 14900,
"tests/e2e/announcement-first-session.spec.ts": 11600,
"tests/e2e/announcement-placement.spec.ts": 20400,
"tests/e2e/app-not-connected.spec.ts": 15300,
"tests/e2e/applications-crud.spec.ts": 11400,
"tests/e2e/apps-prosumer-mcp-flow.spec.ts": 13276,
"tests/e2e/archived-company-url.spec.ts": 6500,
"tests/e2e/artifact-tab-arrival.spec.ts": 11800,
"tests/e2e/artifact-uploads.spec.ts": 34900,
"tests/e2e/board-attachment-receipts.spec.ts": 78000,
"tests/e2e/cases-read-only.spec.ts": 10500,
"tests/e2e/chat-adapters-ui-messaging.spec.ts": 125000,
"tests/e2e/chat-adapters-ui-providers.spec.ts": 181541,
"tests/e2e/chunk-load-recovery.spec.ts": 16330,
"tests/e2e/classic-workspace.spec.ts": 7600,
"tests/e2e/cloud-auth.spec.ts": 40400,
"tests/e2e/company-context-refresh.spec.ts": 4128,
"tests/e2e/completed-task-paused-assignee.spec.ts": 25016,
"tests/e2e/composer-stop.spec.ts": 55400,
"tests/e2e/conference-room-typing-intro.spec.ts": 53600,
"tests/e2e/connection-intents.spec.ts": 20900,
"tests/e2e/connection-reviews.spec.ts": 75000,
"tests/e2e/coordinator-inbox-views.spec.ts": 21600,
"tests/e2e/daytona-connector.spec.ts": 4700,
"tests/e2e/disconnect-resilience.spec.ts": 55000,
"tests/e2e/disconnect-write-recovery.spec.ts": 61000,
"tests/e2e/document-image-gallery.spec.ts": 47800,
"tests/e2e/mcp-user-stories.spec.ts": 45600,
"tests/e2e/new-task-picker-touch.spec.ts": 25700,
"tests/e2e/onboarding.spec.ts": 70300,
"tests/e2e/paused-composer.spec.ts": 60500,
"tests/e2e/plan-task-fixture.spec.ts": 7828,
"tests/e2e/project-repositories.spec.ts": 16000,
"tests/e2e/railway-catalog.spec.ts": 3000,
"tests/e2e/runner-e2e-dashboard.spec.ts": 4700,
"tests/e2e/runner-task-creation.spec.ts": 32437,
"tests/e2e/sidebar-takeover.spec.ts": 7700,
"tests/e2e/signoff-policy.spec.ts": 52229,
"tests/e2e/smoke-lab-p1-p4.spec.ts": 19700,
"tests/e2e/smoke-lab-p5-p7.spec.ts": 16416,
"tests/e2e/task-loading-frame.spec.ts": 37600,
"tests/e2e/task-reload.spec.ts": 21200,
"tests/e2e/text-attachment-tabs.spec.ts": 18200,
"tests/e2e/unikraft-connector.spec.ts": 4000
"tests/e2e/acp-stop-continuation.spec.ts": 69300,
"tests/e2e/action-test-agent-picker.spec.ts": 7200,
"tests/e2e/agent-chat-messages.spec.ts": 69900,
"tests/e2e/agent-chat-projects-handoff.spec.ts": 93000,
"tests/e2e/agent-chat-projects.spec.ts": 88900,
"tests/e2e/agent-chat-sessions.spec.ts": 104100,
"tests/e2e/agent-configuration.spec.ts": 111700,
"tests/e2e/agentmail.spec.ts": 17100,
"tests/e2e/ai-personal-connection-recovery.spec.ts": 12900,
"tests/e2e/announcement-first-session.spec.ts": 10900,
"tests/e2e/announcement-placement.spec.ts": 22700,
"tests/e2e/app-not-connected.spec.ts": 16700,
"tests/e2e/applications-crud.spec.ts": 9400,
"tests/e2e/apps-prosumer-mcp-flow.spec.ts": 21500,
"tests/e2e/archived-company-url.spec.ts": 6200,
"tests/e2e/artifact-tab-arrival.spec.ts": 18100,
"tests/e2e/artifact-uploads.spec.ts": 45900,
"tests/e2e/board-attachment-receipts.spec.ts": 147338,
"tests/e2e/cases-read-only.spec.ts": 9900,
"tests/e2e/chat-adapters-ui-messaging-batches.spec.ts": 95000,
"tests/e2e/chat-adapters-ui-messaging.spec.ts": 100900,
"tests/e2e/chat-adapters-ui-providers-catalog.spec.ts": 133000,
"tests/e2e/chat-adapters-ui-providers.spec.ts": 86800,
"tests/e2e/chunk-load-recovery.spec.ts": 17000,
"tests/e2e/classic-workspace.spec.ts": 10000,
"tests/e2e/cloud-auth.spec.ts": 49000,
"tests/e2e/company-context-refresh.spec.ts": 3600,
"tests/e2e/completed-task-paused-assignee.spec.ts": 32400,
"tests/e2e/composer-stop.spec.ts": 41900,
"tests/e2e/conference-room-typing-intro.spec.ts": 60600,
"tests/e2e/connection-intents.spec.ts": 25600,
"tests/e2e/connection-reviews.spec.ts": 121300,
"tests/e2e/coordinator-inbox-views.spec.ts": 31400,
"tests/e2e/daytona-connector.spec.ts": 6300,
"tests/e2e/disconnect-resilience.spec.ts": 116700,
"tests/e2e/disconnect-write-recovery.spec.ts": 56600,
"tests/e2e/document-image-gallery.spec.ts": 49400,
"tests/e2e/mcp-user-stories.spec.ts": 45900,
"tests/e2e/new-task-picker-touch.spec.ts": 23500,
"tests/e2e/onboarding.spec.ts": 78300,
"tests/e2e/paused-composer.spec.ts": 65200,
"tests/e2e/plan-task-fixture.spec.ts": 9200,
"tests/e2e/project-repositories.spec.ts": 19000,
"tests/e2e/railway-catalog.spec.ts": 5400,
"tests/e2e/runner-e2e-dashboard.spec.ts": 5378,
"tests/e2e/runner-task-creation.spec.ts": 35000,
"tests/e2e/sidebar-takeover.spec.ts": 12100,
"tests/e2e/signoff-policy.spec.ts": 57208,
"tests/e2e/smoke-lab-p1-p4.spec.ts": 22500,
"tests/e2e/smoke-lab-p5-p7.spec.ts": 19100,
"tests/e2e/task-loading-frame.spec.ts": 44200,
"tests/e2e/task-reload.spec.ts": 26600,
"tests/e2e/text-attachment-tabs.spec.ts": 16000,
"tests/e2e/unikraft-connector.spec.ts": 5800
}
}
+6 -4
View File
@@ -20,6 +20,7 @@ export const IGNORED_SPECS = ["in-feed-native/**", "multi-user.spec.ts", "multi-
// with `SERIAL_SPECS` in tests/e2e/playwright.config.ts —
// `scripts/__tests__/e2e-shard.test.mjs` fails if the two ever drift.
export const SERIAL_SPECS = [
"agent-chat-projects-handoff.spec.ts",
"agent-chat-projects.spec.ts",
"agent-chat-sessions.spec.ts",
"agent-configuration.spec.ts",
@@ -36,11 +37,12 @@ export const SERIAL_SPECS = [
// Matches the 4-vCPU CI worker count in tests/e2e/playwright.config.ts for
// shards that contain only parallel-safe specs. Empirical wall-clock speedup
// on 4-vCPU runners with 2 Chromium workers sharing one server + Postgres is
// ~1.5x (measured on run 45245582904); using the empirical factor avoids
// under-allocating shards to parallel specs.
// on 4-vCPU runners with 2 Chromium workers sharing one server + non-durable
// Postgres is ~1.85x (measured 1.78x-1.91x across shards 4-8 on run
// 45440355579); using the empirical factor keeps serial and parallel shards
// balanced across 12 shards.
export const DEFAULT_PARALLEL_WORKERS = 2;
export const EFFECTIVE_PARALLEL_SPEEDUP = 1.5;
export const EFFECTIVE_PARALLEL_SPEEDUP = 1.85;
export function isSerialE2eSpec(file) {
return SERIAL_SPECS.includes(path.posix.basename(file.split(path.sep).join("/")));
File diff suppressed because it is too large. Load diff
+86
View File
@@ -0,0 +1,86 @@
#!/usr/bin/env node
import { spawn } from "node:child_process";
import { existsSync, readFileSync } from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
import { discoverWorkspacePackagePaths } from "./ensure-workspace-package-links.mjs";
const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
function readPostinstall(dirPath) {
const manifestPath = path.join(dirPath, "package.json");
if (!existsSync(manifestPath)) return null;
const manifest = JSON.parse(readFileSync(manifestPath, "utf8"));
const script = manifest.scripts?.postinstall;
return typeof script === "string" && script.trim().length > 0 ? script.trim() : null;
}
export function findWorkspacePostinstallScripts(rootDir = repoRoot) {
const workspacePaths = discoverWorkspacePackagePaths(rootDir);
const canonicalRoot = path.resolve(rootDir);
const workspaceHooks = [];
const seenDirs = new Set([canonicalRoot]);
for (const dirPath of Array.from(workspacePaths.values()).sort()) {
const resolved = path.resolve(dirPath);
if (seenDirs.has(resolved)) continue;
seenDirs.add(resolved);
const script = readPostinstall(resolved);
if (script) {
workspaceHooks.push({
dir: resolved,
relDir: path.relative(canonicalRoot, resolved).split(path.sep).join("/"),
script,
});
}
}
const rootScript = readPostinstall(canonicalRoot);
return {
workspaceHooks,
rootHook: rootScript ? { dir: canonicalRoot, relDir: ".", script: rootScript } : null,
};
}
function runHook(hook, rootDir, env = process.env) {
const binDirs = [
path.join(hook.dir, "node_modules", ".bin"),
path.join(rootDir, "node_modules", ".bin"),
];
const mergedPath = [...binDirs, env.PATH ?? ""].filter(Boolean).join(path.delimiter);
return new Promise((resolve, reject) => {
const child = spawn(hook.script, {
cwd: hook.dir,
env: { ...env, PATH: mergedPath },
shell: true,
stdio: "inherit",
});
child.once("error", (error) => {
reject(new Error(`postinstall in ${hook.relDir} failed to start: ${error.message}`));
});
child.once("close", (code, signal) => {
if (code === 0) resolve();
else reject(new Error(`postinstall in ${hook.relDir} exited with ${signal ?? code}`));
});
});
}
export async function replayWorkspacePostinstalls(rootDir = repoRoot, env = process.env) {
const canonicalRoot = path.resolve(rootDir);
const { workspaceHooks, rootHook } = findWorkspacePostinstallScripts(canonicalRoot);
// Mirror `pnpm -r --if-present run postinstall && pnpm run postinstall`:
// run independent workspace hooks in parallel first, then the root hook.
await Promise.all(workspaceHooks.map((hook) => runHook(hook, canonicalRoot, env)));
if (rootHook) {
await runHook(rootHook, canonicalRoot, env);
}
return {
workspaceCount: workspaceHooks.length,
ranRoot: Boolean(rootHook),
};
}
const invokedPath = process.argv[1] ? path.resolve(process.argv[1]) : null;
if (invokedPath && invokedPath === fileURLToPath(import.meta.url)) {
await replayWorkspacePostinstalls();
}
+182 -180
View File
@@ -3,196 +3,198 @@
"unit": "ms",
"sources": [
{
"pull": 22679,
"run": 45238253588,
"run": 45440355579,
"attempt": 1,
"sha": "8d513d5b1ab8fbfa2905d41be44c165b03a8a320",
"url": "https://github.com/paperclipai/paperclip/actions/runs/45238253588"
"sha": "6ca7a27481e1af45c60069a563632f2b00a008a7",
"url": "https://github.com/paperclipai/paperclip/actions/runs/45440355579"
}
],
"coverage": {
"measured": 178,
"withSetup": 178,
"inventory": 178
"inventory": 181
},
"durations": {
"server/src/__tests__/access-routes-hidden-floor.test.ts": 7709,
"server/src/__tests__/access-routes-permissions-upgrade.test.ts": 7117,
"server/src/__tests__/activity-routes.test.ts": 21578,
"server/src/__tests__/adapter-auth-signal-routes.test.ts": 17029,
"server/src/__tests__/adapter-model-refresh-routes.test.ts": 6222,
"server/src/__tests__/adapter-routes-authz.test.ts": 19486,
"server/src/__tests__/adapter-routes.test.ts": 17941,
"server/src/__tests__/agent-action-audit-routes.test.ts": 10946,
"server/src/__tests__/agent-adapter-validation-routes.test.ts": 100370,
"server/src/__tests__/agent-cross-tenant-authz-routes.test.ts": 6553,
"server/src/__tests__/agent-device-login-routes.test.ts": 23028,
"server/src/__tests__/agent-hire-auth-inheritance-routes.test.ts": 23298,
"server/src/__tests__/agent-hire-idempotency-routes.test.ts": 8900,
"server/src/__tests__/agent-instructions-routes.test.ts": 7607,
"server/src/__tests__/agent-live-run-routes.test.ts": 85464,
"server/src/__tests__/agent-permissions-routes.test.ts": 19196,
"server/src/__tests__/agent-runner-qualification-routes.test.ts": 8686,
"server/src/__tests__/agent-secrets-routes.test.ts": 8763,
"server/src/__tests__/agent-skills-routes.test.ts": 7999,
"server/src/__tests__/agent-task-hierarchy-depth-routes.test.ts": 10309,
"server/src/__tests__/agent-test-environment-routes.test.ts": 19471,
"server/src/__tests__/ai-connection-router.test.ts": 42177,
"server/src/__tests__/announcements-routes.test.ts": 6400,
"server/src/__tests__/approval-routes-idempotency.test.ts": 5399,
"server/src/__tests__/artifact-review-document-routes.test.ts": 9350,
"server/src/__tests__/assets.test.ts": 9131,
"server/src/__tests__/auth-routes.test.ts": 7299,
"server/src/__tests__/auth-session-route.test.ts": 5366,
"server/src/__tests__/authz-company-access.test.ts": 1619,
"server/src/__tests__/authz-existence-oracle-guard.test.ts": 569,
"server/src/__tests__/authz-secret-context.test.ts": 1421,
"server/src/__tests__/board-bootstrap-routes.test.ts": 5950,
"server/src/__tests__/board-chat-route-feature-flag.test.ts": 1578,
"server/src/__tests__/board-route-statement-census.test.ts": 8356,
"server/src/__tests__/bootstrap-claim-routes.test.ts": 5323,
"server/src/__tests__/browser-use-route-scope.test.ts": 4166,
"server/src/__tests__/built-in-agent-routes.test.ts": 14052,
"server/src/__tests__/cases-routes.test.ts": 15579,
"server/src/__tests__/cli-auth-routes.test.ts": 26031,
"server/src/__tests__/cloud-routes.test.ts": 7000,
"server/src/__tests__/companies-route-cross-company-authz.test.ts": 19290,
"server/src/__tests__/companies-route-path-guard.test.ts": 4572,
"server/src/__tests__/company-branding-route.test.ts": 13767,
"server/src/__tests__/company-default-decision-owner-route.test.ts": 9824,
"server/src/__tests__/company-import-transfer-routes.test.ts": 7926,
"server/src/__tests__/company-portability-routes.test.ts": 16020,
"server/src/__tests__/company-portability.test.ts": 11437,
"server/src/__tests__/company-search-extract-routes.test.ts": 6767,
"server/src/__tests__/company-search-rate-limit-routes.test.ts": 6118,
"server/src/__tests__/company-skill-policy-routes.test.ts": 6222,
"server/src/__tests__/company-skills-import-authz-routes.test.ts": 7892,
"server/src/__tests__/company-skills-routes.test.ts": 6446,
"server/src/__tests__/company-user-directory-route.test.ts": 6130,
"server/src/__tests__/cost-data-quality-routes.test.ts": 5213,
"server/src/__tests__/costs-service.test.ts": 5309,
"server/src/__tests__/decision-queues-routes.test.ts": 6023,
"server/src/__tests__/document-annotation-routes.test.ts": 10105,
"server/src/__tests__/email-routes-provider-errors.test.ts": 5765,
"server/src/__tests__/environment-custom-image-routes.test.ts": 6238,
"server/src/__tests__/environment-instance-routes.test.ts": 6976,
"server/src/__tests__/environment-routes.test.ts": 14035,
"server/src/__tests__/environment-selection-route-guards.test.ts": 7244,
"server/src/__tests__/execution-workspace-runtime-lease-route.test.ts": 7541,
"server/src/__tests__/execution-workspaces-routes.test.ts": 5986,
"server/src/__tests__/express5-auth-wildcard.test.ts": 836,
"server/src/__tests__/external-object-routes.test.ts": 7481,
"server/src/__tests__/folders-routes.test.ts": 3807,
"server/src/__tests__/health-dev-server-token.test.ts": 7458,
"server/src/__tests__/health.test.ts": 5117,
"server/src/__tests__/heartbeat-dependency-scheduling.test.ts": 79302,
"server/src/__tests__/access-routes-hidden-floor.test.ts": 6639,
"server/src/__tests__/access-routes-permissions-upgrade.test.ts": 7741,
"server/src/__tests__/activity-routes.test.ts": 17811,
"server/src/__tests__/adapter-auth-signal-routes.test.ts": 16169,
"server/src/__tests__/adapter-model-refresh-routes.test.ts": 6016,
"server/src/__tests__/adapter-routes-authz.test.ts": 17641,
"server/src/__tests__/adapter-routes.test.ts": 6099,
"server/src/__tests__/agent-action-audit-routes.test.ts": 22215,
"server/src/__tests__/agent-adapter-validation-routes.test.ts": 97660,
"server/src/__tests__/agent-cross-tenant-authz-routes.test.ts": 6495,
"server/src/__tests__/agent-device-login-routes.test.ts": 21994,
"server/src/__tests__/agent-hire-auth-inheritance-routes.test.ts": 14680,
"server/src/__tests__/agent-hire-idempotency-routes.test.ts": 9000,
"server/src/__tests__/agent-instructions-routes.test.ts": 6166,
"server/src/__tests__/agent-live-run-routes.test.ts": 83923,
"server/src/__tests__/agent-permissions-routes.test.ts": 18181,
"server/src/__tests__/agent-runner-qualification-routes.test.ts": 7313,
"server/src/__tests__/agent-secrets-routes.test.ts": 7823,
"server/src/__tests__/agent-skills-routes.test.ts": 18777,
"server/src/__tests__/agent-task-hierarchy-depth-routes.test.ts": 8933,
"server/src/__tests__/agent-test-environment-routes.test.ts": 20840,
"server/src/__tests__/ai-connection-router.test.ts": 45967,
"server/src/__tests__/announcements-routes.test.ts": 6273,
"server/src/__tests__/approval-routes-idempotency.test.ts": 6232,
"server/src/__tests__/artifact-review-document-routes.test.ts": 10346,
"server/src/__tests__/assets.test.ts": 8425,
"server/src/__tests__/auth-routes.test.ts": 5953,
"server/src/__tests__/auth-session-route.test.ts": 5899,
"server/src/__tests__/authz-company-access.test.ts": 1875,
"server/src/__tests__/authz-existence-oracle-guard.test.ts": 635,
"server/src/__tests__/authz-secret-context.test.ts": 1538,
"server/src/__tests__/board-bootstrap-routes.test.ts": 6170,
"server/src/__tests__/board-chat-route-feature-flag.test.ts": 1470,
"server/src/__tests__/board-route-statement-census.test.ts": 7682,
"server/src/__tests__/bootstrap-claim-routes.test.ts": 5985,
"server/src/__tests__/browser-use-route-scope.test.ts": 5042,
"server/src/__tests__/built-in-agent-routes.test.ts": 14536,
"server/src/__tests__/cases-routes.test.ts": 25955,
"server/src/__tests__/cli-auth-routes.test.ts": 26802,
"server/src/__tests__/cloud-routes.test.ts": 5763,
"server/src/__tests__/companies-route-cross-company-authz.test.ts": 19729,
"server/src/__tests__/companies-route-path-guard.test.ts": 4382,
"server/src/__tests__/company-branding-route.test.ts": 11256,
"server/src/__tests__/company-default-decision-owner-route.test.ts": 11016,
"server/src/__tests__/company-import-transfer-routes.test.ts": 8458,
"server/src/__tests__/company-portability-routes.test.ts": 15373,
"server/src/__tests__/company-portability.test.ts": 10750,
"server/src/__tests__/company-search-extract-routes.test.ts": 7809,
"server/src/__tests__/company-search-rate-limit-routes.test.ts": 6535,
"server/src/__tests__/company-skill-policy-routes.test.ts": 7574,
"server/src/__tests__/company-skills-import-authz-routes.test.ts": 7772,
"server/src/__tests__/company-skills-routes.test.ts": 16144,
"server/src/__tests__/company-user-directory-route.test.ts": 6131,
"server/src/__tests__/cost-data-quality-routes.test.ts": 5430,
"server/src/__tests__/costs-service.test.ts": 5465,
"server/src/__tests__/decision-queues-routes.test.ts": 7812,
"server/src/__tests__/document-annotation-routes.test.ts": 11792,
"server/src/__tests__/email-routes-provider-errors.test.ts": 5673,
"server/src/__tests__/environment-custom-image-routes.test.ts": 5783,
"server/src/__tests__/environment-instance-routes.test.ts": 5242,
"server/src/__tests__/environment-routes.test.ts": 15517,
"server/src/__tests__/environment-selection-route-guards.test.ts": 5902,
"server/src/__tests__/execution-workspace-runtime-lease-route.test.ts": 6999,
"server/src/__tests__/execution-workspaces-routes.test.ts": 5351,
"server/src/__tests__/express5-auth-wildcard.test.ts": 738,
"server/src/__tests__/external-object-routes.test.ts": 6198,
"server/src/__tests__/folders-routes.test.ts": 5714,
"server/src/__tests__/health-dev-server-token.test.ts": 6574,
"server/src/__tests__/health.test.ts": 5679,
"server/src/__tests__/heartbeat-dependency-scheduling.test.ts": 78007,
"server/src/__tests__/heartbeat-issue-liveness-escalation.test.ts": 54768,
"server/src/__tests__/heartbeat-process-recovery.test.ts": 344017,
"server/src/__tests__/heartbeat-run-privacy-routes.test.ts": 25152,
"server/src/__tests__/inbox-agent-policy-routes.test.ts": 9188,
"server/src/__tests__/inbox-archive-routes.test.ts": 8268,
"server/src/__tests__/inbox-mine-routes.test.ts": 10977,
"server/src/__tests__/instance-database-backups-routes.test.ts": 6034,
"server/src/__tests__/instance-server-metrics-routes.test.ts": 16867,
"server/src/__tests__/instance-settings-routes.test.ts": 5803,
"server/src/__tests__/invite-accept-existing-member.test.ts": 6558,
"server/src/__tests__/invite-accept-gateway-defaults.test.ts": 8151,
"server/src/__tests__/invite-accept-replay.test.ts": 6489,
"server/src/__tests__/invite-create-route.test.ts": 9982,
"server/src/__tests__/invite-expiry.test.ts": 4886,
"server/src/__tests__/invite-join-manager.test.ts": 6003,
"server/src/__tests__/invite-list-route.test.ts": 5932,
"server/src/__tests__/invite-logo-route.test.ts": 5533,
"server/src/__tests__/invite-onboarding-text.test.ts": 7361,
"server/src/__tests__/invite-rate-limit-route.test.ts": 6103,
"server/src/__tests__/invite-summary-route.test.ts": 8714,
"server/src/__tests__/invite-test-resolution-route.test.ts": 6673,
"server/src/__tests__/invite-url-public-base-url.test.ts": 6521,
"server/src/__tests__/issue-access-grants-routes.test.ts": 9735,
"server/src/__tests__/issue-activity-events-routes.test.ts": 15122,
"server/src/__tests__/issue-agent-mutation-ownership-routes.test.ts": 17814,
"server/src/__tests__/issue-assigned-backlog-contract-routes.test.ts": 7165,
"server/src/__tests__/issue-assignee-invokability-routes.test.ts": 7237,
"server/src/__tests__/issue-attachment-routes.test.ts": 17644,
"server/src/__tests__/issue-blocker-diagnostics-routes.test.ts": 9650,
"server/src/__tests__/issue-chat-bootstrap-routes.test.ts": 10756,
"server/src/__tests__/issue-closed-workspace-routes.test.ts": 7089,
"server/src/__tests__/issue-comment-attribution-audit-routes.test.ts": 8446,
"server/src/__tests__/issue-comment-cancel-routes.test.ts": 6164,
"server/src/__tests__/issue-comment-reopen-routes.test.ts": 19442,
"server/src/__tests__/issue-confirm-run-stopped-routes.test.ts": 9839,
"server/src/__tests__/issue-create-deduplication-routes.test.ts": 9136,
"server/src/__tests__/issue-created-from-routes.test.ts": 7614,
"server/src/__tests__/issue-creation-source-routes.test.ts": 10770,
"server/src/__tests__/issue-dependency-wakeups-routes.test.ts": 12551,
"server/src/__tests__/issue-document-restore-routes.test.ts": 10496,
"server/src/__tests__/issue-execution-policy-routes.test.ts": 8945,
"server/src/__tests__/issue-feedback-routes.test.ts": 5778,
"server/src/__tests__/issue-identifier-routes.test.ts": 7007,
"server/src/__tests__/issue-list-assignee-filter-routes.test.ts": 27792,
"server/src/__tests__/issue-list-updatedsince-filter-routes.test.ts": 8596,
"server/src/__tests__/issue-onboarding-first-task-routes.test.ts": 14748,
"server/src/__tests__/issue-queued-comments-routes.test.ts": 99424,
"server/src/__tests__/issue-scheduled-retry-routes.test.ts": 22055,
"server/src/__tests__/issue-stale-execution-lock-routes.test.ts": 9935,
"server/src/__tests__/issue-stalled-review-decision-routes.test.ts": 17957,
"server/src/__tests__/issue-status-version-route-service.test.ts": 8577,
"server/src/__tests__/issue-subtree-diagnostics-routes.test.ts": 7841,
"server/src/__tests__/issue-summaries-routes.test.ts": 9355,
"server/src/__tests__/issue-telemetry-routes.test.ts": 10283,
"server/src/__tests__/issue-thread-interaction-routes.test.ts": 17322,
"server/src/__tests__/issue-tree-control-routes.test.ts": 6060,
"server/src/__tests__/issue-update-comment-wakeup-routes.test.ts": 7306,
"server/src/__tests__/issue-wake-diagnostics-routes.test.ts": 15170,
"server/src/__tests__/issue-watchdogs-routes.test.ts": 15822,
"server/src/__tests__/issue-workspace-command-authz.test.ts": 6275,
"server/src/__tests__/issues-checkout-wakeup.test.ts": 1065,
"server/src/__tests__/issues-goal-context-routes.test.ts": 6658,
"server/src/__tests__/issues-service.test.ts": 35882,
"server/src/__tests__/link-preview-routes.test.ts": 6145,
"server/src/__tests__/llms-routes.test.ts": 6553,
"server/src/__tests__/low-trust-red-team-routes.test.ts": 51564,
"server/src/__tests__/heartbeat-run-privacy-routes.test.ts": 28486,
"server/src/__tests__/inbox-agent-policy-routes.test.ts": 6628,
"server/src/__tests__/inbox-archive-routes.test.ts": 11396,
"server/src/__tests__/inbox-mine-routes.test.ts": 14968,
"server/src/__tests__/instance-database-backups-routes.test.ts": 4882,
"server/src/__tests__/instance-server-metrics-routes.test.ts": 15308,
"server/src/__tests__/instance-settings-routes.test.ts": 16324,
"server/src/__tests__/invite-accept-existing-member.test.ts": 5994,
"server/src/__tests__/invite-accept-gateway-defaults.test.ts": 7591,
"server/src/__tests__/invite-accept-replay.test.ts": 7498,
"server/src/__tests__/invite-create-route.test.ts": 9844,
"server/src/__tests__/invite-expiry.test.ts": 6932,
"server/src/__tests__/invite-join-manager.test.ts": 6848,
"server/src/__tests__/invite-list-route.test.ts": 5908,
"server/src/__tests__/invite-logo-route.test.ts": 5411,
"server/src/__tests__/invite-onboarding-text.test.ts": 6448,
"server/src/__tests__/invite-rate-limit-route.test.ts": 7713,
"server/src/__tests__/invite-summary-route.test.ts": 10599,
"server/src/__tests__/invite-test-resolution-route.test.ts": 7340,
"server/src/__tests__/invite-url-public-base-url.test.ts": 6951,
"server/src/__tests__/issue-access-grants-routes.test.ts": 10374,
"server/src/__tests__/issue-activity-events-routes.test.ts": 14295,
"server/src/__tests__/issue-agent-mutation-ownership-routes.test.ts": 20902,
"server/src/__tests__/issue-assigned-backlog-contract-routes.test.ts": 6256,
"server/src/__tests__/issue-assignee-invokability-routes.test.ts": 6983,
"server/src/__tests__/issue-attachment-routes.test.ts": 6170,
"server/src/__tests__/issue-blocker-diagnostics-routes.test.ts": 7132,
"server/src/__tests__/issue-chat-bootstrap-routes.test.ts": 11029,
"server/src/__tests__/issue-closed-workspace-routes.test.ts": 6547,
"server/src/__tests__/issue-comment-attribution-audit-routes.test.ts": 8661,
"server/src/__tests__/issue-comment-cancel-routes.test.ts": 6428,
"server/src/__tests__/issue-comment-reopen-routes.test.ts": 19146,
"server/src/__tests__/issue-confirm-run-stopped-routes.test.ts": 10495,
"server/src/__tests__/issue-create-deduplication-routes.test.ts": 9592,
"server/src/__tests__/issue-created-from-routes.test.ts": 7346,
"server/src/__tests__/issue-creation-source-routes.test.ts": 10757,
"server/src/__tests__/issue-dependency-wakeups-routes.test.ts": 11829,
"server/src/__tests__/issue-document-restore-routes.test.ts": 10834,
"server/src/__tests__/issue-execution-policy-routes.test.ts": 6791,
"server/src/__tests__/issue-feedback-routes.test.ts": 6080,
"server/src/__tests__/issue-identifier-routes.test.ts": 7464,
"server/src/__tests__/issue-list-assignee-filter-routes.test.ts": 19013,
"server/src/__tests__/issue-list-updatedsince-filter-routes.test.ts": 8205,
"server/src/__tests__/issue-onboarding-first-task-routes.test.ts": 17178,
"server/src/__tests__/issue-queued-comments-routes.test.ts": 127744,
"server/src/__tests__/issue-scheduled-retry-routes.test.ts": 37853,
"server/src/__tests__/issue-stale-execution-lock-routes.test.ts": 10115,
"server/src/__tests__/issue-stalled-review-decision-routes.test.ts": 9355,
"server/src/__tests__/issue-status-version-route-service.test.ts": 8442,
"server/src/__tests__/issue-subtree-diagnostics-routes.test.ts": 8416,
"server/src/__tests__/issue-summaries-routes.test.ts": 8058,
"server/src/__tests__/issue-telemetry-routes.test.ts": 8844,
"server/src/__tests__/issue-thread-interaction-routes.test.ts": 22774,
"server/src/__tests__/issue-tree-control-routes.test.ts": 5288,
"server/src/__tests__/issue-update-comment-wakeup-routes.test.ts": 9045,
"server/src/__tests__/issue-wake-diagnostics-routes.test.ts": 8382,
"server/src/__tests__/issue-watchdogs-routes.test.ts": 15246,
"server/src/__tests__/issue-workspace-command-authz.test.ts": 7758,
"server/src/__tests__/issues-checkout-wakeup.test.ts": 497,
"server/src/__tests__/issues-goal-context-routes.test.ts": 6560,
"server/src/__tests__/issues-service.test.ts": 31680,
"server/src/__tests__/link-preview-routes.test.ts": 5601,
"server/src/__tests__/llms-routes.test.ts": 6340,
"server/src/__tests__/low-trust-red-team-routes.test.ts": 49466,
"server/src/__tests__/maintenance-server-routes.test.ts": 276429,
"server/src/__tests__/managed-agent-profile-routes-authz.test.ts": 6245,
"server/src/__tests__/multilingual-issues-routes.test.ts": 8186,
"server/src/__tests__/muse-qualification-routes.test.ts": 5311,
"server/src/__tests__/native-child-task-read-routes.test.ts": 8905,
"server/src/__tests__/onboarding-seed-route.test.ts": 7929,
"server/src/__tests__/openapi-routes.test.ts": 19600,
"server/src/__tests__/openclaw-invite-prompt-route.test.ts": 6484,
"server/src/__tests__/opencode-local-adapter-environment.test.ts": 7463,
"server/src/__tests__/openrouter-attribution.test.ts": 1697,
"server/src/__tests__/openrouter-catalog-error-handler.test.ts": 3983,
"server/src/__tests__/permissions-upgrade-boundary-routes.test.ts": 8104,
"server/src/__tests__/plugin-install-route-security.test.ts": 8271,
"server/src/__tests__/plugin-routes-authz.test.ts": 14858,
"server/src/__tests__/plugin-scoped-api-routes.test.ts": 13393,
"server/src/__tests__/project-decision-owner-route.test.ts": 10045,
"server/src/__tests__/project-goal-telemetry-routes.test.ts": 5925,
"server/src/__tests__/project-routes-env.test.ts": 8038,
"server/src/__tests__/project-workspace-managed-sandbox-routes.test.ts": 9106,
"server/src/__tests__/projects-list-archived-routes.test.ts": 7611,
"server/src/__tests__/redaction.test.ts": 654,
"server/src/__tests__/resource-memberships-routes.test.ts": 7719,
"server/src/__tests__/routine-document-annotation-routes.test.ts": 6388,
"server/src/__tests__/routines-e2e.test.ts": 42624,
"server/src/__tests__/routines-routes.test.ts": 25919,
"server/src/__tests__/secret-proposals-routes.test.ts": 34207,
"server/src/__tests__/secrets-routes-claude-oauth-service.test.ts": 8198,
"server/src/__tests__/secrets-routes.test.ts": 6718,
"server/src/__tests__/sidebar-preferences-routes.test.ts": 7854,
"server/src/__tests__/skill-update-diff-routes.test.ts": 7253,
"server/src/__tests__/subscription-routes.test.ts": 5517,
"server/src/__tests__/summary-slot-routes.test.ts": 13804,
"server/src/__tests__/tailscale-connection-routes.test.ts": 5215,
"server/src/__tests__/task-connector-read-routes.test.ts": 10338,
"server/src/__tests__/task-title-routes.test.ts": 25360,
"server/src/__tests__/teams-catalog-routes.test.ts": 12771,
"server/src/__tests__/user-profile-routes.test.ts": 6490,
"server/src/__tests__/workspace-command-authz.test.ts": 668,
"server/src/__tests__/workspace-preferences-routes.test.ts": 5757,
"server/src/__tests__/workspace-restore-repair-route.test.ts": 9418,
"server/src/__tests__/workspace-runtime-routes-authz.test.ts": 6436,
"server/src/__tests__/workspace-runtime-service-authz.test.ts": 2659
"server/src/__tests__/managed-agent-profile-routes-authz.test.ts": 5362,
"server/src/__tests__/multilingual-issues-routes.test.ts": 7327,
"server/src/__tests__/muse-qualification-routes.test.ts": 5898,
"server/src/__tests__/native-child-task-read-routes.test.ts": 7995,
"server/src/__tests__/onboarding-chat-route.test.ts": 9811,
"server/src/__tests__/onboarding-seed-route.test.ts": 9784,
"server/src/__tests__/openapi-routes.test.ts": 17551,
"server/src/__tests__/openclaw-invite-prompt-route.test.ts": 5307,
"server/src/__tests__/opencode-local-adapter-environment.test.ts": 7743,
"server/src/__tests__/openrouter-attribution.test.ts": 1044,
"server/src/__tests__/openrouter-catalog-error-handler.test.ts": 4947,
"server/src/__tests__/permissions-upgrade-boundary-routes.test.ts": 9124,
"server/src/__tests__/plugin-install-route-security.test.ts": 6716,
"server/src/__tests__/plugin-routes-authz.test.ts": 5222,
"server/src/__tests__/plugin-scoped-api-routes.test.ts": 4743,
"server/src/__tests__/project-decision-owner-route.test.ts": 8979,
"server/src/__tests__/project-goal-telemetry-routes.test.ts": 6838,
"server/src/__tests__/project-routes-env.test.ts": 7737,
"server/src/__tests__/project-workspace-managed-sandbox-routes.test.ts": 10278,
"server/src/__tests__/projects-list-archived-routes.test.ts": 8670,
"server/src/__tests__/redaction.test.ts": 789,
"server/src/__tests__/resource-memberships-routes.test.ts": 8448,
"server/src/__tests__/responsibility-summaries-routes.test.ts": 7816,
"server/src/__tests__/routine-document-annotation-routes.test.ts": 6516,
"server/src/__tests__/routines-e2e.test.ts": 44403,
"server/src/__tests__/routines-routes.test.ts": 16810,
"server/src/__tests__/secret-proposals-routes.test.ts": 37160,
"server/src/__tests__/secrets-routes-claude-oauth-service.test.ts": 18513,
"server/src/__tests__/secrets-routes.test.ts": 9060,
"server/src/__tests__/sidebar-preferences-routes.test.ts": 7858,
"server/src/__tests__/skill-update-diff-routes.test.ts": 7339,
"server/src/__tests__/subscription-routes.test.ts": 5335,
"server/src/__tests__/summary-slot-routes.test.ts": 13724,
"server/src/__tests__/tailscale-connection-routes.test.ts": 5240,
"server/src/__tests__/task-connector-read-routes.test.ts": 9301,
"server/src/__tests__/task-title-routes.test.ts": 23892,
"server/src/__tests__/teams-catalog-routes.test.ts": 9516,
"server/src/__tests__/tool-policy-list-authz.integration.test.ts": 15182,
"server/src/__tests__/user-profile-routes.test.ts": 6524,
"server/src/__tests__/workspace-command-authz.test.ts": 688,
"server/src/__tests__/workspace-preferences-routes.test.ts": 6332,
"server/src/__tests__/workspace-restore-repair-route.test.ts": 10409,
"server/src/__tests__/workspace-runtime-routes-authz.test.ts": 5944,
"server/src/__tests__/workspace-runtime-service-authz.test.ts": 2669
}
}
+49 -5
View File
@@ -30,11 +30,43 @@ export const PROVIDER_WORKSPACE = "scripts/typecheck-sandbox-providers";
export function defaultConcurrency({ cpus = availableParallelism(), totalMemoryBytes = totalmem() } = {}) {
const memGiB = totalMemoryBytes / 1024 ** 3;
if (cpus <= 2 || memGiB < 12) return 1;
if (cpus <= 4) return 2;
if (memGiB < 24) return Math.min(3, cpus);
if (cpus <= 4) return 3;
if (memGiB < 24) return Math.min(4, cpus);
return Math.min(4, cpus);
}
// Measured CI durations (seconds, run 45440355579 / 45444347449) so concurrent
// execution starts the heaviest programs first instead of leaving 26s tails at the end.
export const PROGRAM_DURATION_WEIGHTS = {
"tests/tsconfig.playwright.json": 26.3,
"packages/paperclip-runner/tsconfig.test.json": 25.9,
"packages/db/tsconfig.test.json": 23.7,
"packages/paperclip-runner/tsconfig.browser.test.json": 9.6,
"packages/paperclip-runner/tsconfig.surfaces.test.json": 8.8,
"packages/plugins/sandbox-providers/daytona/tsconfig.test.json": 7.5,
"tests/runner-acceptance/tsconfig.json": 7.3,
"packages/plugins/plugin-workspace-diff/tsconfig.test.json": 7.2,
"packages/plugins/sdk/tsconfig.test.json": 6.8,
"packages/plugins/sandbox-providers/kubernetes/tsconfig.test.json": 6.6,
"packages/plugins/sandbox-providers/e2b/tsconfig.test.json": 5.7,
"packages/plugins/sandbox-providers/exe-dev/tsconfig.test.json": 5.6,
"packages/plugins/sandbox-providers/modal/tsconfig.test.json": 4.4,
"packages/plugins/sandbox-providers/createos/tsconfig.test.json": 4.2,
"packages/plugins/sandbox-providers/novita/tsconfig.test.json": 3.9,
"packages/plugins/sandbox-providers/cloudflare/tsconfig.test.json": 3.8,
"packages/plugins/sandbox-providers/boxd/tsconfig.test.json": 3.7,
"packages/plugins/examples/plugin-orchestration-smoke-example/tsconfig.test.json": 1.6,
"packages/kv-demo-mcp-server/tsconfig.test.json": 1.5,
"scripts/scale-ramp/tsconfig.json": 0.4,
"packages/plugins/sandbox-providers/cloudflare/bridge-template/tsconfig.test.json": 0.4,
};
export function orderProgramsLpt(programs = PROGRAMS) {
return [...programs].sort(
(left, right) => (PROGRAM_DURATION_WEIGHTS[right] ?? 5) - (PROGRAM_DURATION_WEIGHTS[left] ?? 5),
);
}
export const SANDBOX_PROVIDERS = [
"packages/plugins/sandbox-providers/boxd",
"packages/plugins/sandbox-providers/cloudflare",
@@ -319,11 +351,22 @@ function listTrackedFiles(root) {
return result.stdout.split("\0").filter(Boolean);
}
function projectCoverageConfigs(root, projects = PROJECTS) {
const hasServerDeclarations = existsSync(
path.join(root, "server", "node_modules", ".cache", "paperclip-typecheck", "tsconfig.declarations.json"),
);
return projects.map((project) => {
const layered = `${project}/tsconfig.layers.json`;
return hasServerDeclarations && existsSync(path.join(root, layered)) ? layered : `${project}/tsconfig.json`;
});
}
/** Returns the test files in no program, or null if a program could not be listed. */
export function checkCoverage({
root,
env = process.env,
programs = PROGRAMS,
projects = PROJECTS,
workspaceConfigs = listWorkspaceConfigs,
trackedFiles = listTrackedFiles,
listFiles = listProgramFiles,
@@ -332,7 +375,7 @@ export function checkCoverage({
const checkedFiles = [];
// `pnpm build` and `typecheck:build-gaps` check each workspace's tsconfig.json.
// scripts/typecheck-test-projects.mjs checks these same files through tsconfig.layers.json.
const projectConfigs = PROJECTS.map((project) => `${project}/tsconfig.json`);
const projectConfigs = projectCoverageConfigs(root, projects);
for (const config of [...workspaceConfigs(root), ...projectConfigs, ...programs]) {
const listing = listFiles(config, { cwd: root, env });
if (listing.status !== 0) {
@@ -352,6 +395,7 @@ export async function checkCoverageAsync({
root,
env = process.env,
programs = PROGRAMS,
projects = PROJECTS,
includeProviders = true,
onlyFiles = null,
concurrency = Math.max(1, Math.min(6, availableParallelism())),
@@ -379,7 +423,7 @@ export async function checkCoverageAsync({
const providerSet = new Set(SANDBOX_PROVIDER_PROGRAMS);
const coveragePrograms = includeProviders ? programs : programs.filter((program) => !providerSet.has(program));
const projectConfigs = PROJECTS.map((project) => `${project}/tsconfig.json`);
const projectConfigs = projectCoverageConfigs(root, projects);
let configs = [...workspaceConfigs(root), ...projectConfigs, ...coveragePrograms];
if (remaining) {
@@ -560,7 +604,7 @@ export async function typecheckTestProgramsAsync({
const checkerArgs = Number.isInteger(checkers) && checkers >= 1 ? ["--checkers", String(checkers)] : [];
let exitCode = 0;
let aborted = false;
const queue = [...programs];
const queue = orderProgramsLpt(programs);
const workerCount = Math.max(1, Math.min(concurrency, queue.length));
async function worker() {
while (!aborted) {
+62 -3
View File
@@ -1,6 +1,6 @@
import assert from "node:assert/strict";
import { execFileSync, spawnSync } from "node:child_process";
import { existsSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
import { tmpdir } from "node:os";
import path from "node:path";
import { test } from "node:test";
@@ -11,6 +11,7 @@ import {
defaultConcurrency,
findUncheckedTests,
LOCKED_PROVIDERS,
orderProgramsLpt,
PROGRAMS,
prepareTestPrograms,
PROVIDER_WORKSPACE,
@@ -244,6 +245,7 @@ test("checkCoverage uses the compiler's file list, so a dropped sibling is caugh
const unchecked = checkCoverage({
root,
programs: [`${relative}/tsconfig.json`],
projects: [],
workspaceConfigs: () => [],
trackedFiles: () => [`${relative}/foo.test.ts`, `${relative}/foo.test.tsx`],
});
@@ -420,7 +422,64 @@ test("checkCoverageAsync checks targeted files with early exit and skips uninsta
test("defaultConcurrency scales safely with CPU count and memory", () => {
const GiB = 1024 ** 3;
assert.equal(defaultConcurrency({ cpus: 2, totalMemoryBytes: 8 * GiB }), 1);
assert.equal(defaultConcurrency({ cpus: 4, totalMemoryBytes: 16 * GiB }), 2);
assert.equal(defaultConcurrency({ cpus: 8, totalMemoryBytes: 16 * GiB }), 3);
assert.equal(defaultConcurrency({ cpus: 4, totalMemoryBytes: 16 * GiB }), 3);
assert.equal(defaultConcurrency({ cpus: 8, totalMemoryBytes: 16 * GiB }), 4);
assert.equal(defaultConcurrency({ cpus: 8, totalMemoryBytes: 32 * GiB }), 4);
});
test("orderProgramsLpt schedules heaviest test programs first while preserving unknown order", () => {
const ordered = orderProgramsLpt([
"packages/plugins/sdk/tsconfig.test.json",
"packages/db/tsconfig.test.json",
"tests/tsconfig.playwright.json",
"packages/paperclip-runner/tsconfig.test.json",
]);
assert.equal(ordered[0], "tests/tsconfig.playwright.json");
assert.equal(ordered[1], "packages/paperclip-runner/tsconfig.test.json");
assert.equal(ordered[2], "packages/db/tsconfig.test.json");
assert.equal(ordered[3], "packages/plugins/sdk/tsconfig.test.json");
});
test("checkCoverageAsync prefers tsconfig.layers.json for test projects when server declarations exist", async () => {
const tmpRoot = mkdtempSync(path.join(tmpdir(), "coverage-layers-"));
try {
mkdirSync(path.join(tmpRoot, "tests", "e2e"), { recursive: true });
writeFileSync(path.join(tmpRoot, "tests", "e2e", "tsconfig.json"), "{}\n");
writeFileSync(path.join(tmpRoot, "tests", "e2e", "tsconfig.layers.json"), "{}\n");
const listedWithoutDecls = [];
await checkCoverageAsync({
root: tmpRoot,
programs: [],
projects: ["tests/e2e"],
workspaceConfigs: () => [],
trackedFiles: () => [],
listFilesAsync: async (config) => {
listedWithoutDecls.push(config);
return { status: 0, output: "", files: [] };
},
});
assert.deepEqual(listedWithoutDecls, ["tests/e2e/tsconfig.json"]);
mkdirSync(path.join(tmpRoot, "server", "node_modules", ".cache", "paperclip-typecheck"), { recursive: true });
writeFileSync(
path.join(tmpRoot, "server", "node_modules", ".cache", "paperclip-typecheck", "tsconfig.declarations.json"),
"{}\n",
);
const listedWithDecls = [];
await checkCoverageAsync({
root: tmpRoot,
programs: [],
projects: ["tests/e2e"],
workspaceConfigs: () => [],
trackedFiles: () => [],
listFilesAsync: async (config) => {
listedWithDecls.push(config);
return { status: 0, output: "", files: [] };
},
});
assert.deepEqual(listedWithDecls, ["tests/e2e/tsconfig.layers.json"]);
} finally {
rmSync(tmpRoot, { recursive: true, force: true });
}
});
+17
View File
@@ -32,6 +32,23 @@ export const PROJECTS = [
"tests/speko-native",
];
// Measured CI durations (seconds, run 45440355579 / 45444347449) used to schedule
// the slowest test projects first so they never land at the end of a lane wave.
export const PROJECT_DURATION_WEIGHTS = {
"tests/runner-e2e": 21.3,
"server/src/__tests__/helpers/maintenance": 11.0,
"tests/e2e": 10.8,
"tests/restart-chaos": 10.7,
"tests/lifecycle-baseline": 7.6,
"tests/speko-native": 5.0,
};
export function orderProjectsLpt(projects = PROJECTS) {
return [...projects].sort(
(left, right) => (PROJECT_DURATION_WEIGHTS[right] ?? 10) - (PROJECT_DURATION_WEIGHTS[left] ?? 10),
);
}
const GLOBAL_PROJECT_INPUTS = new Set([
"package.json",
"pnpm-lock.yaml",