mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-26 01:39:51 +01:00
perf(ci): parallelize Runner Rust checks, Runner build, and typecheck lane (#22957)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - Live 8-core PR runs (`45667106472`, `45665466678`, `45668834558`) showed two critical-path stragglers on Rust- and TypeScript-heavy PRs: > 1. `Verify Paperclip Runner (rust)` (`206s` step): ran a redundant `cargo check --workspace` (`8.1s`) before `cargo test --release`, executed all 44 compiled Rust test binaries **sequentially** (`119.2s` vs `~50s` parallel!), and then re-invoked `cargo test --release` twice more for `check:conformance-parity` and `check:replay-parity` (`~8s`). > 2. `Typecheck + Release Registry` (`100s–147s` step): ran `CLI guidance safety` (`2.9s`) and `typecheck @paperclipai/paperclip-runner` (`5.6s`) serially before `prepare:runner-vendor`, ran `packages/paperclip-runner` `build` (`17.1s` hit / `51.0s` miss) serially across 12 steps, and scheduled lighter `7–10s` test projects ahead of the 4 `17–25s` server test layers. > - This pull request parallelizes `check:runner` (`run-check-runner.mjs`), `packages/paperclip-runner` `build` (`run-build.mjs`), and `scripts/ci-typecheck-lane.mjs` cleanly across 8 cores with full process-group signal cleanup (`stopActiveChildren`), exact `CARGO_BIN_EXE_*` / `CARGO_MANIFEST_DIR` fidelity, fail-closed parity assertions, exact `record-build-inputs --begin/--finish` bracketing, and 100% check parity. ## Linked Issues or Issue Description Refs #22804 **What existing behavior does this improve?** Execution wall-clock of `Verify Paperclip Runner (rust)`, `Typecheck + Release Registry`, and `Build` on 8-core runners. **Subsystem affected** packages/paperclip-runner/ and scripts/ — Rust test orchestration, Runner package build, and monorepo typecheck DAG **Current behavior** `check:runner` runs `cargo check`, 44 Rust test binaries sequentially, and 2 redundant parity re-runs; `packages/paperclip-runner` `build` executes 12 build/check steps serially; `ci-typecheck-lane.mjs` blocks `prepare:runner-vendor` behind serial `prepare` steps and under-utilizes 8-core / 32 GiB runners. **Proposed behavior** Execute `check:runner` with overlapped `acpx-profiles` / `cargo fmt --check` / `cargo test --release --no-run` followed by LPT-ordered concurrent execution of all 44 test binaries + `--doc` + fail-closed parity verification; parallelize `packages/paperclip-runner` `build` into race-free pre-dist / build / staging / post-dist phases; parallelize `CLI guidance safety` and `typecheck @paperclipai/paperclip-runner` in `ci-typecheck-lane.mjs`, LPT-order post-declaration tasks, and tune 8-core / >=24 GiB concurrency (`laneConcurrency: 8`, `serverDeclCheckers: 6`). ## What Changed - **`packages/paperclip-runner/scripts/run-check-runner.mjs` & `run-check-runner.test.mjs`:** - Overlaps `check:acpx-profiles` and `cargo fmt --all -- --check` with `cargo test --release --locked --workspace --no-run --message-format=json-render-diagnostics`. - Parses all 44 compiled test binaries with exact `CARGO_BIN_EXE_*` and per-crate `CARGO_MANIFEST_DIR`, executes them concurrently in LPT order (`codex_provider` first, `acpx_sidecar_stopped_time` isolated in its own detached process group with `--test-threads=1`, plus `cargo test --release --workspace --doc`). - Verifies both `runs_the_mock_core_path_with_stable_output` and `replay_fixture_parity` passed in the workspace run (failing closed if missing or ignored), eliminating 2 redundant `cargo test` re-invocations. - **`packages/paperclip-runner/scripts/run-build.mjs` & `run-build.test.mjs`:** - Preserves exact `record-build-inputs.mjs --begin` / `--finish` bracketing from the same parent PID, overlaps `eval-kernel + tsc`, `cargo build --release` (honoring `PAPERCLIP_RELEASE_RUNNER_ARTIFACTS_DIR`), and all 9 pure source-only pre-dist checks, stages disjoint `dist/` outputs in parallel, and runs all 5 `dist/`-importing checks (`check:runner-workflow-traceability`, `check:protocol-coverage`, `check:semantic-contracts`, `check:replay-goldens`, `check:semantic-action-catalog`) in parallel post-dist. - **`scripts/ci-typecheck-lane.mjs`, `scripts/__tests__/ci-typecheck-lane.test.mjs`, & `.github/scripts/tests/ci-plan.test.mjs`:** - Moved `CLI guidance safety` and `typecheck @paperclipai/paperclip-runner` (`needs: [PREPARE_RUNNER_VENDOR]` when `runServer`) out of serial `prepare` into `tasks`. - Ordered post-declaration tasks LPT (`tests/runner-e2e` -> 4 `server layer test-*` -> smaller projects) and tuned 8+ core / >=24 GiB runners to `laneConcurrency: 8`, `serverDeclCheckers: 6`. - **`packages/paperclip-runner/scripts/run-check-static.mjs`, `run-prep-tests.mjs`, & `package.json`:** - Shared `stopActiveChildren` / process-group runner helpers across `run-check-static.mjs`, `run-check-runner.mjs`, and `run-build.mjs`; wired `run-build.test.mjs` and `run-check-runner.test.mjs` into `PREP_TEST_FILES`. ## Verification - `node --test .github/scripts/tests/*.test.mjs scripts/__tests__/ci-typecheck-lane.test.mjs scripts/check-test-budget.test.mjs scripts/__tests__/runner-release-crate-cache.test.mjs` — **855/855 PASS** - `node --test scripts/run-check-runner.test.mjs scripts/run-build.test.mjs scripts/run-check-static.test.mjs scripts/build-inputs.test.mjs scripts/stage-runner-binary.test.mjs` (in `packages/paperclip-runner`) — **32/32 PASS** - `node scripts/check-test-budget.mjs --base origin/master` and `node scripts/check-maps.mjs` — **PASS** - Live Linux Cargo/Runner and monorepo Typecheck/Build execution verified end-to-end by PR CI. ## Risks - Low risk: all 9 pre-dist checks were verified pure source read-only while all 5 `dist/`-importing checks run strictly after `tsc` and asset staging; Rust parity checks fail closed if either test is absent or ignored; process-group cancellation ensures zero orphaned test processes. ## Model Used - Gemini 4 Neon (High) via Antigravity agent swarm (`server-prune`, `verifier`, `ci-pipeline`). ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [ ] All Paperclip CI gates are green - [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge
This commit is contained in:
1 parent
a336e295f6
commit
1c36d24d0c
12 files changed
+842
-103
No files matched your search
@@ -282,7 +282,7 @@ test("repository-wide guidance guards run uncached for every scanned UI file typ
|
||||
"server/src/__tests__/cli-invocation-safety.test.ts",
|
||||
"pnpm run test:release-registry",
|
||||
]) assert.ok(fallback.includes(command), command);
|
||||
const guidance = planLane({ buildGapPackages: [], testLayers: [] }).prepare.find((task) => task.name === "CLI guidance safety");
|
||||
const guidance = planLane({ buildGapPackages: [], testLayers: [] }).tasks.find((task) => task.name === "CLI guidance safety");
|
||||
assert.deepEqual(guidance.args, ["exec", "vitest", "run", "--project", "@paperclipai/server", "server/src/__tests__/cli-invocation-safety.test.ts"]);
|
||||
assert.ok(!job.includes("uses: ./.github/actions/run-ci-task"));
|
||||
});
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
},
|
||||
"sideEffects": false,
|
||||
"scripts": {
|
||||
"build": "node scripts/record-build-inputs.mjs --begin && pnpm run check:protocol-manifest && pnpm run build:typescript && pnpm run check:capability-contract && pnpm run check:capability-inventory && pnpm run check:protocol-coverage && node scripts/generate-semantic-contracts.mjs --check && node scripts/check-runner-workflow-traceability.mjs && node scripts/build-runner-binary.mjs && node scripts/generate-replay-goldens.mjs --check && node scripts/generate-semantic-action-catalog.mjs --check && node scripts/record-build-inputs.mjs --finish",
|
||||
"build": "node scripts/run-build.mjs",
|
||||
"build:typescript": "pnpm run check:acpx-profiles && node scripts/generate-antigravity-models.mjs --check && pnpm run ensure:eval-build-deps && pnpm run check:protocol-types && node ./node_modules/typescript/bin/tsc --version && node ./node_modules/typescript/bin/tsc -p tsconfig.json && node ./node_modules/typescript/bin/tsc -p tsconfig.surfaces.json && node scripts/build-verified-provider-entrypoints.mjs && node scripts/install-copilot-assets.mjs",
|
||||
"build:rust": "cargo build --manifest-path runner/Cargo.toml --locked --workspace --bins",
|
||||
"build:binary": "cargo build --release --manifest-path runner/Cargo.toml --locked -p paperclip-runner-core --bin paperclip-runnerd && node scripts/stage-runner-binary.mjs",
|
||||
@@ -109,7 +109,7 @@
|
||||
"check:semantic-action-catalog": "pnpm run build:typescript && node scripts/generate-semantic-action-catalog.mjs --check",
|
||||
"check:protocol": "pnpm run typecheck:typescript && pnpm run check:protocol-manifest && pnpm run test:typescript && pnpm run check:replay-goldens",
|
||||
"check:protocol-without-vitest": "pnpm run typecheck:typescript && pnpm run check:protocol-manifest && pnpm run test:typescript:prep && pnpm run check:replay-goldens",
|
||||
"check:runner": "pnpm run typecheck:rust && pnpm run test:rust && pnpm run check:conformance-parity && pnpm run check:replay-parity",
|
||||
"check:runner": "node scripts/run-check-runner.mjs",
|
||||
"check:all": "pnpm run check:eval-kernel && pnpm run check:protocol && pnpm run check:runner && pnpm run check:api-authority",
|
||||
"check:all-without-vitest": "pnpm run check:eval-kernel && pnpm run check:protocol-without-vitest && pnpm run check:runner && pnpm run check:api-authority",
|
||||
"check:static": "node scripts/run-check-static.mjs",
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { RELEASE_ARTIFACTS_VARIABLE } from "./build-runner-binary.mjs";
|
||||
import { executePhases } from "./run-check-static.mjs";
|
||||
|
||||
const packageRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
||||
const node = process.execPath;
|
||||
|
||||
function resolvePnpmInvocation(env = process.env) {
|
||||
const npmExecPath = env.npm_execpath?.trim();
|
||||
if (npmExecPath && npmExecPath.toLowerCase().includes("pnpm")) {
|
||||
if (/\.(cjs|mjs|js)$/i.test(npmExecPath)) {
|
||||
return { command: node, argsPrefix: [npmExecPath] };
|
||||
}
|
||||
return { command: npmExecPath, argsPrefix: [] };
|
||||
}
|
||||
return { command: "pnpm", argsPrefix: [] };
|
||||
}
|
||||
|
||||
function cmd(label, command, args, cwd = packageRoot) {
|
||||
return { label, command, args, cwd, shell: command === "pnpm" && process.platform === "win32" };
|
||||
}
|
||||
|
||||
export function buildRunnerBuildPlan({ env = process.env } = {}) {
|
||||
const pnpm = resolvePnpmInvocation(env);
|
||||
const prebuiltReleaseBinary = Boolean(env[RELEASE_ARTIFACTS_VARIABLE]?.trim());
|
||||
|
||||
const preDistChecks = [
|
||||
cmd("check:protocol-manifest", node, ["scripts/generate-protocol-manifest.mjs", "--check"]),
|
||||
cmd("check:acpx-profiles", node, ["scripts/generate-acpx-profiles.mjs", "--check"]),
|
||||
cmd("check:antigravity-models", node, ["scripts/generate-antigravity-models.mjs", "--check"]),
|
||||
cmd("check:protocol-schema-module", node, ["scripts/generate-protocol-schema-module.mjs", "--check"]),
|
||||
cmd("check:acpx-sidecar-contract", node, ["scripts/generate-acpx-sidecar-contract.mjs", "--check"]),
|
||||
cmd("check:runtime-context-contract", node, ["scripts/generate-runtime-context-contract.mjs", "--check"]),
|
||||
cmd("check:provider-failure-contract", node, ["scripts/generate-provider-failure-contract.mjs", "--check"]),
|
||||
cmd("check:capability-contract", node, ["scripts/generate-capability-contract.mjs", "--check"]),
|
||||
cmd("check:capability-inventory", node, ["scripts/check-capability-inventory.mjs"]),
|
||||
];
|
||||
|
||||
const buildChains = [
|
||||
{
|
||||
name: "typescript-dist",
|
||||
steps: [
|
||||
cmd("build:eval-kernel", pnpm.command, [...pnpm.argsPrefix, "--filter", "@paperclipai/paperclip-eval-kernel", "build"]),
|
||||
cmd("tsc:version", node, ["./node_modules/typescript/bin/tsc", "--version"]),
|
||||
cmd("tsc:tsconfig", node, ["./node_modules/typescript/bin/tsc", "-p", "tsconfig.json"]),
|
||||
cmd("tsc:surfaces", node, ["./node_modules/typescript/bin/tsc", "-p", "tsconfig.surfaces.json"]),
|
||||
],
|
||||
},
|
||||
...(prebuiltReleaseBinary
|
||||
? []
|
||||
: [
|
||||
{
|
||||
name: "cargo-release-runnerd",
|
||||
steps: [
|
||||
cmd("cargo:release-runnerd", "cargo", [
|
||||
"build",
|
||||
"--release",
|
||||
"--manifest-path",
|
||||
"runner/Cargo.toml",
|
||||
"--locked",
|
||||
"-p",
|
||||
"paperclip-runner-core",
|
||||
"--bin",
|
||||
"paperclip-runnerd",
|
||||
]),
|
||||
],
|
||||
},
|
||||
]),
|
||||
...preDistChecks.map((step) => ({ name: step.label, steps: [step] })),
|
||||
];
|
||||
|
||||
return [
|
||||
{
|
||||
name: "record-begin",
|
||||
mode: "serial",
|
||||
steps: [cmd("record-build-inputs:begin", node, ["scripts/record-build-inputs.mjs", "--begin"])],
|
||||
},
|
||||
{
|
||||
name: "compile-dist-binary-and-pre-checks",
|
||||
mode: "parallel-chains",
|
||||
chains: buildChains,
|
||||
},
|
||||
{
|
||||
name: "stage-dist-assets",
|
||||
mode: "parallel",
|
||||
steps: [
|
||||
cmd("build:verified-entrypoints", node, ["scripts/build-verified-provider-entrypoints.mjs"]),
|
||||
cmd("install:copilot-assets", node, ["scripts/install-copilot-assets.mjs"]),
|
||||
cmd("build:runner-binary", node, ["scripts/build-runner-binary.mjs"]),
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "post-dist-checks",
|
||||
mode: "parallel",
|
||||
steps: [
|
||||
cmd("check:protocol-coverage", node, ["scripts/generate-protocol-coverage.mjs", "--check"]),
|
||||
cmd("check:semantic-contracts", node, ["scripts/generate-semantic-contracts.mjs", "--check"]),
|
||||
cmd("check:replay-goldens", node, ["scripts/generate-replay-goldens.mjs", "--check"]),
|
||||
cmd("check:semantic-action-catalog", node, ["scripts/generate-semantic-action-catalog.mjs", "--check"]),
|
||||
cmd("check:runner-workflow-traceability", node, ["scripts/check-runner-workflow-traceability.mjs"]),
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "record-finish",
|
||||
mode: "serial",
|
||||
steps: [cmd("record-build-inputs:finish", node, ["scripts/record-build-inputs.mjs", "--finish"])],
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
async function main() {
|
||||
const args = process.argv.slice(2);
|
||||
const dryRun = args.includes("--dry-run");
|
||||
const unknown = args.filter((arg) => arg !== "--dry-run");
|
||||
if (unknown.length > 0) {
|
||||
console.error(`[runner:build] unrecognized argument(s): ${unknown.join(" ")}`);
|
||||
process.exit(1);
|
||||
}
|
||||
const phases = buildRunnerBuildPlan();
|
||||
if (dryRun) {
|
||||
console.log(JSON.stringify({ phases }, null, 2));
|
||||
return;
|
||||
}
|
||||
await executePhases(phases, { prefix: "[runner:build]", verbosePhases: false });
|
||||
}
|
||||
|
||||
if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
|
||||
await main();
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
import assert from "node:assert/strict";
|
||||
import test from "node:test";
|
||||
import { buildRunnerBuildPlan } from "./run-build.mjs";
|
||||
import { RELEASE_ARTIFACTS_VARIABLE } from "./build-runner-binary.mjs";
|
||||
|
||||
test("buildRunnerBuildPlan brackets with record-build-inputs and preserves every build check", () => {
|
||||
const phases = buildRunnerBuildPlan({ env: {} });
|
||||
assert.deepEqual(
|
||||
phases.map((phase) => phase.name),
|
||||
[
|
||||
"record-begin",
|
||||
"compile-dist-binary-and-pre-checks",
|
||||
"stage-dist-assets",
|
||||
"post-dist-checks",
|
||||
"record-finish",
|
||||
],
|
||||
);
|
||||
assert.deepEqual(phases[0].steps[0].args, ["scripts/record-build-inputs.mjs", "--begin"]);
|
||||
assert.deepEqual(phases[4].steps[0].args, ["scripts/record-build-inputs.mjs", "--finish"]);
|
||||
|
||||
const allLabels = phases.flatMap((phase) =>
|
||||
(phase.steps ?? phase.chains.flatMap((chain) => chain.steps)).map((step) => step.label),
|
||||
);
|
||||
for (const required of [
|
||||
"record-build-inputs:begin",
|
||||
"build:eval-kernel",
|
||||
"tsc:tsconfig",
|
||||
"tsc:surfaces",
|
||||
"cargo:release-runnerd",
|
||||
"check:protocol-manifest",
|
||||
"check:acpx-profiles",
|
||||
"check:antigravity-models",
|
||||
"check:protocol-schema-module",
|
||||
"check:acpx-sidecar-contract",
|
||||
"check:runtime-context-contract",
|
||||
"check:provider-failure-contract",
|
||||
"check:capability-contract",
|
||||
"check:capability-inventory",
|
||||
"build:verified-entrypoints",
|
||||
"install:copilot-assets",
|
||||
"build:runner-binary",
|
||||
"check:protocol-coverage",
|
||||
"check:semantic-contracts",
|
||||
"check:replay-goldens",
|
||||
"check:semantic-action-catalog",
|
||||
"check:runner-workflow-traceability",
|
||||
"record-build-inputs:finish",
|
||||
]) {
|
||||
assert.ok(allLabels.includes(required), `missing build step: ${required}`);
|
||||
}
|
||||
|
||||
const postDistLabels = phases
|
||||
.find((phase) => phase.name === "post-dist-checks")
|
||||
.steps.map((step) => step.label);
|
||||
for (const distCheck of [
|
||||
"check:protocol-coverage",
|
||||
"check:semantic-contracts",
|
||||
"check:replay-goldens",
|
||||
"check:semantic-action-catalog",
|
||||
"check:runner-workflow-traceability",
|
||||
]) {
|
||||
assert.ok(postDistLabels.includes(distCheck), `expected ${distCheck} in post-dist-checks`);
|
||||
}
|
||||
});
|
||||
|
||||
test("buildRunnerBuildPlan skips redundant cargo build when prebuilt release daemon directory is provided", () => {
|
||||
const phases = buildRunnerBuildPlan({
|
||||
env: { [RELEASE_ARTIFACTS_VARIABLE]: "/tmp/prebuilt-daemons" },
|
||||
});
|
||||
const compilePhase = phases.find((phase) => phase.name === "compile-dist-binary-and-pre-checks");
|
||||
assert.ok(!compilePhase.chains.some((chain) => chain.name === "cargo-release-runnerd"));
|
||||
const stagePhase = phases.find((phase) => phase.name === "stage-dist-assets");
|
||||
assert.ok(stagePhase.steps.some((step) => step.label === "build:runner-binary"));
|
||||
});
|
||||
@@ -0,0 +1,303 @@
|
||||
import { availableParallelism } from "node:os";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import {
|
||||
getShutdownPromise,
|
||||
installSignalHandlers,
|
||||
runCommand,
|
||||
uninstallSignalHandlers,
|
||||
} from "./run-check-static.mjs";
|
||||
|
||||
const packageRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
||||
const node = process.execPath;
|
||||
|
||||
export const REQUIRED_PARITY_TESTS = [
|
||||
"runs_the_mock_core_path_with_stable_output",
|
||||
"replay_fixture_parity",
|
||||
];
|
||||
|
||||
const LPT_PRIORITY = new Map([
|
||||
["codex_provider", 100],
|
||||
["acpx_sidecar_stopped_time", 90],
|
||||
["acpx_park_preparation", 85],
|
||||
["acpx_quiet_turn_continuation", 80],
|
||||
["paperclip_runner_core", 75],
|
||||
["native_provider_backend", 70],
|
||||
["acpx_warm_attachment", 65],
|
||||
["acpx_sidecar_transport", 60],
|
||||
["acpx_park_readiness", 55],
|
||||
["acpx_provider_turns", 50],
|
||||
["provider_bridge", 45],
|
||||
["stdio_mcp", 40],
|
||||
]);
|
||||
|
||||
const SINGLE_THREAD_BINARIES = new Set(["acpx_sidecar_stopped_time"]);
|
||||
|
||||
export function buildRunnerCheckPlan({ cpus = availableParallelism() } = {}) {
|
||||
const safeCpus = Math.max(1, Number.isFinite(cpus) ? Math.floor(cpus) : 4);
|
||||
return {
|
||||
binaryConcurrency: Math.min(6, Math.max(2, safeCpus)),
|
||||
heavyTestThreads: Math.max(2, safeCpus),
|
||||
defaultTestThreads: Math.max(2, Math.floor(safeCpus / 2)),
|
||||
compilePhase: [
|
||||
{ label: "check:acpx-profiles", command: node, args: ["scripts/generate-acpx-profiles.mjs", "--check"], cwd: packageRoot },
|
||||
{ label: "cargo:fmt", command: "cargo", args: ["fmt", "--manifest-path", "runner/Cargo.toml", "--all", "--", "--check"], cwd: packageRoot },
|
||||
{
|
||||
label: "cargo:test-no-run",
|
||||
command: "cargo",
|
||||
args: [
|
||||
"test",
|
||||
"--release",
|
||||
"--manifest-path",
|
||||
"runner/Cargo.toml",
|
||||
"--locked",
|
||||
"--workspace",
|
||||
"--no-run",
|
||||
"--message-format=json-render-diagnostics",
|
||||
],
|
||||
cwd: packageRoot,
|
||||
},
|
||||
],
|
||||
docTestCommand: {
|
||||
label: "cargo:test-doc",
|
||||
command: "cargo",
|
||||
args: ["test", "--release", "--manifest-path", "runner/Cargo.toml", "--locked", "--workspace", "--doc"],
|
||||
cwd: packageRoot,
|
||||
},
|
||||
requiredParityTests: [...REQUIRED_PARITY_TESTS],
|
||||
};
|
||||
}
|
||||
|
||||
export function parseCargoTestArtifacts(jsonLinesText) {
|
||||
const testBinaries = [];
|
||||
const seenExecutables = new Set();
|
||||
const binEnv = {};
|
||||
|
||||
for (const rawLine of jsonLinesText.split("\n")) {
|
||||
const line = rawLine.trim();
|
||||
if (!line.startsWith("{")) continue;
|
||||
let message;
|
||||
try {
|
||||
message = JSON.parse(line);
|
||||
} catch {
|
||||
continue;
|
||||
}
|
||||
if (message.reason !== "compiler-artifact" || !message.executable) continue;
|
||||
const kinds = Array.isArray(message.target?.kind) ? message.target.kind : [];
|
||||
const name = String(message.target?.name ?? path.basename(message.executable));
|
||||
const manifestDir = message.manifest_path ? path.dirname(message.manifest_path) : packageRoot;
|
||||
|
||||
if (message.profile?.test === true) {
|
||||
if (seenExecutables.has(message.executable)) continue;
|
||||
seenExecutables.add(message.executable);
|
||||
testBinaries.push({
|
||||
name,
|
||||
kinds,
|
||||
executable: message.executable,
|
||||
manifestDir,
|
||||
label: kinds.includes("lib") ? `${name} (lib)` : name,
|
||||
});
|
||||
} else if (kinds.includes("bin")) {
|
||||
binEnv[`CARGO_BIN_EXE_${name}`] = message.executable;
|
||||
}
|
||||
}
|
||||
|
||||
return { testBinaries, binEnv };
|
||||
}
|
||||
|
||||
export function orderTestBinariesLpt(testBinaries) {
|
||||
return [...testBinaries].sort((a, b) => {
|
||||
const pa = LPT_PRIORITY.get(a.name) ?? 0;
|
||||
const pb = LPT_PRIORITY.get(b.name) ?? 0;
|
||||
if (pa !== pb) return pb - pa;
|
||||
return a.label.localeCompare(b.label);
|
||||
});
|
||||
}
|
||||
|
||||
export function verifyRequiredParityTests(combinedOutput, requiredFilters = REQUIRED_PARITY_TESTS) {
|
||||
const missing = [];
|
||||
for (const filter of requiredFilters) {
|
||||
const escaped = filter.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
||||
const okPattern = new RegExp(`test\\s+\\S*${escaped}\\S*\\s+\\.\\.\\.\\s+ok\\b`);
|
||||
if (!okPattern.test(combinedOutput)) missing.push(filter);
|
||||
}
|
||||
return missing;
|
||||
}
|
||||
|
||||
export async function runWithConcurrency(items, concurrency, worker) {
|
||||
const results = new Array(items.length);
|
||||
let nextIndex = 0;
|
||||
const slots = Math.min(Math.max(1, concurrency), items.length);
|
||||
await Promise.all(
|
||||
Array.from({ length: slots }, async () => {
|
||||
while (nextIndex < items.length) {
|
||||
const index = nextIndex;
|
||||
nextIndex += 1;
|
||||
results[index] = await worker(items[index], index);
|
||||
}
|
||||
}),
|
||||
);
|
||||
return results;
|
||||
}
|
||||
|
||||
export function formatCargoCompilerDiagnostics(stdout) {
|
||||
const rendered = [];
|
||||
for (const rawLine of stdout.split(/\r?\n/)) {
|
||||
const line = rawLine.trim();
|
||||
if (!line.startsWith("{")) continue;
|
||||
let message;
|
||||
try {
|
||||
message = JSON.parse(line);
|
||||
} catch {
|
||||
continue;
|
||||
}
|
||||
if (message.reason === "compiler-message" && typeof message.message?.rendered === "string") {
|
||||
rendered.push(message.message.rendered);
|
||||
}
|
||||
}
|
||||
return rendered.length > 0 ? rendered.join("") : stdout;
|
||||
}
|
||||
|
||||
function splitOutput(chunks) {
|
||||
const stdout = Buffer.concat(chunks.filter((c) => c.stream === "stdout").map((c) => c.chunk)).toString("utf8");
|
||||
const stderr = Buffer.concat(chunks.filter((c) => c.stream === "stderr").map((c) => c.chunk)).toString("utf8");
|
||||
return { stdout, stderr };
|
||||
}
|
||||
|
||||
async function executeRunnerCheck(plan) {
|
||||
installSignalHandlers();
|
||||
try {
|
||||
const compileStart = Date.now();
|
||||
console.log("[check:runner] phase=compile-and-lint mode=parallel");
|
||||
const compileResults = await Promise.all(
|
||||
plan.compilePhase.map((step) => runCommand(step, { bufferOutput: true })),
|
||||
);
|
||||
if (getShutdownPromise()) {
|
||||
await getShutdownPromise();
|
||||
return;
|
||||
}
|
||||
const parsedCompile = compileResults.map((result) => ({ ...result, ...splitOutput(result.chunks) }));
|
||||
for (const result of parsedCompile) {
|
||||
console.log(`[check:runner] --- ${result.label} (${(result.durationMs / 1000).toFixed(1)}s, exit=${result.code}) ---`);
|
||||
if (result.label !== "cargo:test-no-run" && result.stdout) process.stdout.write(result.stdout);
|
||||
if (result.label === "cargo:test-no-run" && result.code !== 0 && result.stdout) {
|
||||
process.stderr.write(formatCargoCompilerDiagnostics(result.stdout));
|
||||
}
|
||||
if (result.stderr) process.stderr.write(result.stderr);
|
||||
if (result.error) console.error(`[check:runner] ${result.label} spawn error: ${result.error.message}`);
|
||||
}
|
||||
const compileFailure = parsedCompile.find((result) => result.code !== 0);
|
||||
if (compileFailure) {
|
||||
console.error(`[check:runner] FAILED ${compileFailure.label} (exit=${compileFailure.code})`);
|
||||
process.exit(compileFailure.code);
|
||||
}
|
||||
|
||||
const cargoResult = parsedCompile.find((result) => result.label === "cargo:test-no-run");
|
||||
const { testBinaries, binEnv } = parseCargoTestArtifacts(cargoResult.stdout);
|
||||
if (testBinaries.length === 0) {
|
||||
console.error("[check:runner] FAILED: cargo test --no-run produced zero test executables");
|
||||
process.exit(1);
|
||||
}
|
||||
const ordered = orderTestBinariesLpt(testBinaries);
|
||||
console.log(
|
||||
`[check:runner] phase=compile-and-lint done (${((Date.now() - compileStart) / 1000).toFixed(1)}s, ` +
|
||||
`${ordered.length} test binaries discovered)`,
|
||||
);
|
||||
|
||||
const testStart = Date.now();
|
||||
console.log(`[check:runner] phase=execute-tests concurrency=${plan.binaryConcurrency}`);
|
||||
const testSteps = [
|
||||
...ordered.map((binary) => {
|
||||
const threads = SINGLE_THREAD_BINARIES.has(binary.name)
|
||||
? 1
|
||||
: binary.name === "codex_provider"
|
||||
? plan.heavyTestThreads
|
||||
: plan.defaultTestThreads;
|
||||
return {
|
||||
label: binary.label,
|
||||
command: binary.executable,
|
||||
args: ["--test-threads", String(threads)],
|
||||
cwd: binary.manifestDir,
|
||||
env: {
|
||||
...process.env,
|
||||
...binEnv,
|
||||
CARGO_MANIFEST_DIR: binary.manifestDir,
|
||||
},
|
||||
};
|
||||
}),
|
||||
{
|
||||
...plan.docTestCommand,
|
||||
env: process.env,
|
||||
},
|
||||
];
|
||||
|
||||
const testResults = await runWithConcurrency(testSteps, plan.binaryConcurrency, async (step) => {
|
||||
if (getShutdownPromise()) {
|
||||
return { label: step.label, code: 143, durationMs: 0, stdout: "", stderr: "" };
|
||||
}
|
||||
const raw = await runCommand(step, { bufferOutput: true, env: step.env });
|
||||
const { stdout, stderr } = splitOutput(raw.chunks);
|
||||
const result = { ...raw, stdout, stderr };
|
||||
const summary = stdout.match(/test result: .*/)?.[0] ?? "";
|
||||
if (result.code !== 0 || result.durationMs >= 1000 || summary) {
|
||||
console.log(
|
||||
`[check:runner] ${result.code === 0 ? "PASS" : "FAIL"} ${result.label} ` +
|
||||
`(${(result.durationMs / 1000).toFixed(2)}s)${summary ? ` — ${summary}` : ""}`,
|
||||
);
|
||||
}
|
||||
if (result.code !== 0) {
|
||||
if (stdout) process.stdout.write(stdout);
|
||||
if (stderr) process.stderr.write(stderr);
|
||||
if (result.error) console.error(`[check:runner] ${result.label} spawn error: ${result.error.message}`);
|
||||
}
|
||||
return result;
|
||||
});
|
||||
|
||||
if (getShutdownPromise()) {
|
||||
await getShutdownPromise();
|
||||
return;
|
||||
}
|
||||
|
||||
const firstFailure = testResults.find((result) => result.code !== 0);
|
||||
if (firstFailure) {
|
||||
console.error(`[check:runner] FAILED ${firstFailure.label} (exit=${firstFailure.code})`);
|
||||
process.exit(firstFailure.code);
|
||||
}
|
||||
|
||||
const combinedOutput = testResults.map((result) => result.stdout).join("\n");
|
||||
const missingParity = verifyRequiredParityTests(combinedOutput, plan.requiredParityTests);
|
||||
if (missingParity.length > 0) {
|
||||
console.error(
|
||||
`[check:runner] FAILED: required parity test(s) did not pass in workspace run: ${missingParity.join(", ")}`,
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
console.log(
|
||||
`[check:runner] phase=execute-tests done (${((Date.now() - testStart) / 1000).toFixed(1)}s; ` +
|
||||
`parity verified: ${plan.requiredParityTests.join(", ")})`,
|
||||
);
|
||||
} finally {
|
||||
uninstallSignalHandlers();
|
||||
}
|
||||
}
|
||||
|
||||
async function main() {
|
||||
const args = process.argv.slice(2);
|
||||
const dryRun = args.includes("--dry-run");
|
||||
const unknown = args.filter((arg) => arg !== "--dry-run");
|
||||
if (unknown.length > 0) {
|
||||
console.error(`[check:runner] unrecognized argument(s): ${unknown.join(" ")}`);
|
||||
process.exit(1);
|
||||
}
|
||||
const plan = buildRunnerCheckPlan();
|
||||
if (dryRun) {
|
||||
console.log(JSON.stringify(plan, null, 2));
|
||||
return;
|
||||
}
|
||||
await executeRunnerCheck(plan);
|
||||
}
|
||||
|
||||
if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
|
||||
await main();
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
import assert from "node:assert/strict";
|
||||
import test from "node:test";
|
||||
import {
|
||||
buildRunnerCheckPlan,
|
||||
formatCargoCompilerDiagnostics,
|
||||
orderTestBinariesLpt,
|
||||
parseCargoTestArtifacts,
|
||||
REQUIRED_PARITY_TESTS,
|
||||
runWithConcurrency,
|
||||
verifyRequiredParityTests,
|
||||
} from "./run-check-runner.mjs";
|
||||
|
||||
test("buildRunnerCheckPlan overlaps acpx-profiles, cargo fmt, and cargo test --release --no-run", () => {
|
||||
const plan = buildRunnerCheckPlan({ cpus: 8 });
|
||||
assert.equal(plan.binaryConcurrency, 6);
|
||||
assert.equal(plan.heavyTestThreads, 8);
|
||||
assert.equal(plan.defaultTestThreads, 4);
|
||||
const labels = plan.compilePhase.map((step) => step.label);
|
||||
assert.deepEqual(labels, ["check:acpx-profiles", "cargo:fmt", "cargo:test-no-run"]);
|
||||
const cargoStep = plan.compilePhase[2];
|
||||
assert.ok(cargoStep.args.includes("--release"));
|
||||
assert.ok(cargoStep.args.includes("--no-run"));
|
||||
assert.ok(cargoStep.args.includes("--message-format=json-render-diagnostics"));
|
||||
assert.ok(plan.docTestCommand.args.includes("--doc"));
|
||||
assert.deepEqual(plan.requiredParityTests, REQUIRED_PARITY_TESTS);
|
||||
});
|
||||
|
||||
test("parseCargoTestArtifacts extracts unique test executables, manifest dirs, and CARGO_BIN_EXE_* map", () => {
|
||||
const jsonLines = [
|
||||
"warning: plain non-json line",
|
||||
JSON.stringify({
|
||||
reason: "compiler-artifact",
|
||||
manifest_path: "/repo/packages/paperclip-runner/runner/crates/runner-core/Cargo.toml",
|
||||
target: { name: "paperclip-runnerd", kind: ["bin"] },
|
||||
profile: { test: false },
|
||||
executable: "/repo/target/release/paperclip-runnerd",
|
||||
}),
|
||||
JSON.stringify({
|
||||
reason: "compiler-artifact",
|
||||
manifest_path: "/repo/packages/paperclip-runner/runner/crates/runner-core/Cargo.toml",
|
||||
target: { name: "paperclip_runner_core", kind: ["lib"] },
|
||||
profile: { test: true },
|
||||
executable: "/repo/target/release/deps/paperclip_runner_core-aaa",
|
||||
}),
|
||||
JSON.stringify({
|
||||
reason: "compiler-artifact",
|
||||
manifest_path: "/repo/packages/paperclip-runner/runner/crates/runner-core/Cargo.toml",
|
||||
target: { name: "codex_provider", kind: ["test"] },
|
||||
profile: { test: true },
|
||||
executable: "/repo/target/release/deps/codex_provider-bbb",
|
||||
}),
|
||||
JSON.stringify({
|
||||
reason: "compiler-artifact",
|
||||
manifest_path: "/repo/packages/paperclip-runner/runner/crates/runner-core/Cargo.toml",
|
||||
target: { name: "codex_provider", kind: ["test"] },
|
||||
profile: { test: true },
|
||||
executable: "/repo/target/release/deps/codex_provider-bbb",
|
||||
}),
|
||||
JSON.stringify({
|
||||
reason: "compiler-artifact",
|
||||
manifest_path: "/repo/packages/paperclip-runner/runner/crates/process-table/Cargo.toml",
|
||||
target: { name: "paperclip_process_table", kind: ["lib"] },
|
||||
profile: { test: true },
|
||||
executable: "/repo/target/release/deps/paperclip_process_table-ccc",
|
||||
}),
|
||||
].join("\n");
|
||||
|
||||
const { testBinaries, binEnv } = parseCargoTestArtifacts(jsonLines);
|
||||
assert.deepEqual(binEnv, {
|
||||
"CARGO_BIN_EXE_paperclip-runnerd": "/repo/target/release/paperclip-runnerd",
|
||||
});
|
||||
assert.equal(testBinaries.length, 3);
|
||||
assert.equal(testBinaries[0].label, "paperclip_runner_core (lib)");
|
||||
assert.equal(testBinaries[0].manifestDir, "/repo/packages/paperclip-runner/runner/crates/runner-core");
|
||||
assert.equal(testBinaries[2].manifestDir, "/repo/packages/paperclip-runner/runner/crates/process-table");
|
||||
});
|
||||
|
||||
test("orderTestBinariesLpt puts slowest Rust test binaries first", () => {
|
||||
const ordered = orderTestBinariesLpt([
|
||||
{ name: "oom_score", label: "oom_score" },
|
||||
{ name: "acpx_park_preparation", label: "acpx_park_preparation" },
|
||||
{ name: "codex_provider", label: "codex_provider" },
|
||||
{ name: "acpx_sidecar_stopped_time", label: "acpx_sidecar_stopped_time" },
|
||||
]);
|
||||
assert.deepEqual(
|
||||
ordered.map((entry) => entry.name),
|
||||
["codex_provider", "acpx_sidecar_stopped_time", "acpx_park_preparation", "oom_score"],
|
||||
);
|
||||
});
|
||||
|
||||
test("verifyRequiredParityTests matches exact and prefix-filtered passing tests and fails closed when missing", () => {
|
||||
const passing = [
|
||||
"test tests::runs_the_mock_core_path_with_stable_output ... ok",
|
||||
"test replay::tests::replay_fixture_parity_happy_path ... ok",
|
||||
"test replay::tests::replay_fixture_parity_failed_run ... ok",
|
||||
].join("\n");
|
||||
assert.deepEqual(verifyRequiredParityTests(passing), []);
|
||||
|
||||
const ignored = [
|
||||
"test tests::runs_the_mock_core_path_with_stable_output ... ignored",
|
||||
"test replay::tests::replay_fixture_parity_happy_path ... ok",
|
||||
].join("\n");
|
||||
assert.deepEqual(verifyRequiredParityTests(ignored), ["runs_the_mock_core_path_with_stable_output"]);
|
||||
assert.deepEqual(verifyRequiredParityTests(""), REQUIRED_PARITY_TESTS);
|
||||
});
|
||||
|
||||
test("runWithConcurrency bounds parallelism and preserves result ordering", async () => {
|
||||
let active = 0;
|
||||
let peak = 0;
|
||||
const results = await runWithConcurrency([10, 20, 30, 40, 50], 2, async (item) => {
|
||||
active += 1;
|
||||
peak = Math.max(peak, active);
|
||||
await new Promise((resolve) => setTimeout(resolve, 5));
|
||||
active -= 1;
|
||||
return item * 2;
|
||||
});
|
||||
assert.equal(peak, 2);
|
||||
assert.deepEqual(results, [20, 40, 60, 80, 100]);
|
||||
});
|
||||
|
||||
test("formatCargoCompilerDiagnostics extracts rendered compiler messages and falls back to raw stdout", () => {
|
||||
const jsonLines = [
|
||||
JSON.stringify({ reason: "compiler-artifact", target: { name: "x" } }),
|
||||
JSON.stringify({ reason: "compiler-message", message: { rendered: "error[E0425]: cannot find value\n" } }),
|
||||
].join("\n");
|
||||
assert.equal(formatCargoCompilerDiagnostics(jsonLines), "error[E0425]: cannot find value\n");
|
||||
assert.equal(formatCargoCompilerDiagnostics("plain cargo failure\n"), "plain cargo failure\n");
|
||||
});
|
||||
@@ -175,7 +175,23 @@ function forwardSignal(signal) {
|
||||
});
|
||||
}
|
||||
|
||||
export function runCommand(step, { bufferOutput = false } = {}) {
|
||||
export function installSignalHandlers() {
|
||||
process.on("SIGINT", forwardSignal);
|
||||
process.on("SIGTERM", forwardSignal);
|
||||
process.on("SIGHUP", forwardSignal);
|
||||
}
|
||||
|
||||
export function uninstallSignalHandlers() {
|
||||
process.removeListener("SIGINT", forwardSignal);
|
||||
process.removeListener("SIGTERM", forwardSignal);
|
||||
process.removeListener("SIGHUP", forwardSignal);
|
||||
}
|
||||
|
||||
export function getShutdownPromise() {
|
||||
return shutdownPromise;
|
||||
}
|
||||
|
||||
export function runCommand(step, { bufferOutput = false, env = process.env, shell = false } = {}) {
|
||||
if (cancelSignal) {
|
||||
return Promise.resolve({
|
||||
label: step.label,
|
||||
@@ -189,7 +205,8 @@ export function runCommand(step, { bufferOutput = false } = {}) {
|
||||
return new Promise((resolvePromise) => {
|
||||
const child = spawn(step.command, step.args, {
|
||||
cwd: step.cwd,
|
||||
env: process.env,
|
||||
env,
|
||||
shell,
|
||||
detached,
|
||||
stdio: bufferOutput ? ["ignore", "pipe", "pipe"] : "inherit",
|
||||
});
|
||||
@@ -240,33 +257,33 @@ export function runCommand(step, { bufferOutput = false } = {}) {
|
||||
});
|
||||
}
|
||||
|
||||
function flushResult(result) {
|
||||
function flushResult(result, prefix) {
|
||||
for (const { stream, chunk } of result.chunks) {
|
||||
process[stream].write(chunk);
|
||||
}
|
||||
if (result.error) {
|
||||
console.error(`[check:static] ${result.label} failed to spawn: ${result.error.message}`);
|
||||
console.error(`${prefix} ${result.label} failed to spawn: ${result.error.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
async function runChain(chain, { bufferOutput = true } = {}) {
|
||||
async function runChain(chain, { bufferOutput = true, prefix = "[check:static]", verbosePhases = true } = {}) {
|
||||
const results = [];
|
||||
for (const step of chain.steps) {
|
||||
const result = await runCommand(step, { bufferOutput });
|
||||
const result = await runCommand(step, { bufferOutput, env: step.env ?? process.env, shell: Boolean(step.shell) });
|
||||
results.push(result);
|
||||
if (result.code !== 0) break;
|
||||
}
|
||||
const totalMs = results.reduce((sum, result) => sum + result.durationMs, 0);
|
||||
const failed = results.find((result) => result.code !== 0);
|
||||
console.log(`[check:static] --- chain:${chain.name} (${(totalMs / 1000).toFixed(1)}s, exit=${failed?.code ?? 0}) ---`);
|
||||
for (const result of results) flushResult(result);
|
||||
if (verbosePhases) {
|
||||
console.log(`${prefix} --- chain:${chain.name} (${(totalMs / 1000).toFixed(1)}s, exit=${failed?.code ?? 0}) ---`);
|
||||
}
|
||||
for (const result of results) flushResult(result, prefix);
|
||||
return { name: chain.name, results, failed };
|
||||
}
|
||||
|
||||
async function executePlan(phases) {
|
||||
process.on("SIGINT", forwardSignal);
|
||||
process.on("SIGTERM", forwardSignal);
|
||||
process.on("SIGHUP", forwardSignal);
|
||||
export async function executePhases(phases, { prefix = "[check:static]", verbosePhases = true } = {}) {
|
||||
installSignalHandlers();
|
||||
try {
|
||||
for (const phase of phases) {
|
||||
if (shutdownPromise) {
|
||||
@@ -274,16 +291,16 @@ async function executePlan(phases) {
|
||||
return;
|
||||
}
|
||||
const phaseStart = Date.now();
|
||||
console.log(`[check:static] phase=${phase.name} mode=${phase.mode}`);
|
||||
if (verbosePhases) console.log(`${prefix} phase=${phase.name} mode=${phase.mode}`);
|
||||
if (phase.mode === "serial") {
|
||||
for (const step of phase.steps) {
|
||||
const result = await runCommand(step, { bufferOutput: false });
|
||||
const result = await runCommand(step, { bufferOutput: false, env: step.env ?? process.env, shell: Boolean(step.shell) });
|
||||
if (shutdownPromise) {
|
||||
await shutdownPromise;
|
||||
return;
|
||||
}
|
||||
if (result.code !== 0) {
|
||||
console.error(`[check:static] FAILED ${result.label} (exit=${result.code})`);
|
||||
console.error(`${prefix} FAILED ${result.label} (exit=${result.code})`);
|
||||
process.exit(result.code);
|
||||
}
|
||||
}
|
||||
@@ -291,10 +308,12 @@ async function executePlan(phases) {
|
||||
const bufferOutput = phase.steps.length > 1;
|
||||
const results = await Promise.all(
|
||||
phase.steps.map(async (step) => {
|
||||
const result = await runCommand(step, { bufferOutput });
|
||||
const result = await runCommand(step, { bufferOutput, env: step.env ?? process.env, shell: Boolean(step.shell) });
|
||||
if (bufferOutput) {
|
||||
console.log(`[check:static] --- ${result.label} (${(result.durationMs / 1000).toFixed(1)}s, exit=${result.code}) ---`);
|
||||
flushResult(result);
|
||||
if (verbosePhases) {
|
||||
console.log(`${prefix} --- ${result.label} (${(result.durationMs / 1000).toFixed(1)}s, exit=${result.code}) ---`);
|
||||
}
|
||||
flushResult(result, prefix);
|
||||
}
|
||||
return result;
|
||||
}),
|
||||
@@ -305,30 +324,32 @@ async function executePlan(phases) {
|
||||
}
|
||||
const failed = results.find((result) => result.code !== 0);
|
||||
if (failed) {
|
||||
console.error(`[check:static] FAILED ${failed.label} (exit=${failed.code})`);
|
||||
console.error(`${prefix} FAILED ${failed.label} (exit=${failed.code})`);
|
||||
process.exit(failed.code);
|
||||
}
|
||||
} else if (phase.mode === "parallel-chains") {
|
||||
const chains = await Promise.all(phase.chains.map((chain) => runChain(chain, { bufferOutput: true })));
|
||||
const chains = await Promise.all(phase.chains.map((chain) => runChain(chain, { bufferOutput: true, prefix, verbosePhases })));
|
||||
if (shutdownPromise) {
|
||||
await shutdownPromise;
|
||||
return;
|
||||
}
|
||||
const firstFailure = chains.find((chain) => chain.failed)?.failed ?? null;
|
||||
if (firstFailure) {
|
||||
console.error(`[check:static] FAILED ${firstFailure.label} (exit=${firstFailure.code})`);
|
||||
console.error(`${prefix} FAILED ${firstFailure.label} (exit=${firstFailure.code})`);
|
||||
process.exit(firstFailure.code);
|
||||
}
|
||||
}
|
||||
console.log(`[check:static] phase=${phase.name} done (${((Date.now() - phaseStart) / 1000).toFixed(1)}s)`);
|
||||
if (verbosePhases) console.log(`${prefix} phase=${phase.name} done (${((Date.now() - phaseStart) / 1000).toFixed(1)}s)`);
|
||||
}
|
||||
} finally {
|
||||
process.removeListener("SIGINT", forwardSignal);
|
||||
process.removeListener("SIGTERM", forwardSignal);
|
||||
process.removeListener("SIGHUP", forwardSignal);
|
||||
uninstallSignalHandlers();
|
||||
}
|
||||
}
|
||||
|
||||
async function executePlan(phases) {
|
||||
await executePhases(phases, { prefix: "[check:static]", verbosePhases: true });
|
||||
}
|
||||
|
||||
async function main() {
|
||||
const args = process.argv.slice(2);
|
||||
const dryRun = args.includes("--dry-run");
|
||||
|
||||
@@ -46,6 +46,8 @@ export const PREP_TEST_FILES = [
|
||||
"scripts/install-copilot-assets.test.mjs",
|
||||
"scripts/probe-copilot-acp.test.mjs",
|
||||
"scripts/qualify-copilot-acp.test.mjs",
|
||||
"scripts/run-build.test.mjs",
|
||||
"scripts/run-check-runner.test.mjs",
|
||||
"scripts/run-check-static.test.mjs",
|
||||
];
|
||||
|
||||
|
||||
@@ -47,8 +47,14 @@ test("the shared outputs are written before dependent checks start, while emit-o
|
||||
assert.ok(prepare.some((task) => task.name === `typecheck ${name}`), name);
|
||||
assert.ok(!tasks.some((task) => task.name === `typecheck ${name}`), name);
|
||||
}
|
||||
const guidance = prepare.find((task) => task.name === "CLI guidance safety");
|
||||
const runnerTypecheck = byName.get("typecheck @paperclipai/paperclip-runner");
|
||||
assert.ok(runnerTypecheck);
|
||||
assert.deepEqual(runnerTypecheck.needs, [PREPARE_RUNNER_VENDOR]);
|
||||
assert.equal(runnerTypecheck.background, true);
|
||||
assert.ok(!prepare.some((task) => task.name === "CLI guidance safety"));
|
||||
const guidance = byName.get("CLI guidance safety");
|
||||
assert.ok(guidance.args.includes("server/src/__tests__/cli-invocation-safety.test.ts"));
|
||||
assert.equal(guidance.needs, undefined);
|
||||
assert.equal(guidance.background, undefined);
|
||||
const programs = byName.get("typecheck test programs");
|
||||
assert.ok(programs.args.includes("--skip-prepare"));
|
||||
@@ -89,11 +95,12 @@ test("every check of the sequential job is planned with exact DAG dependencies",
|
||||
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"));
|
||||
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");
|
||||
assert.equal(declarationReaders[1].name, "server layer tests");
|
||||
assert.equal(declarationReaders[2].name, "server layer test-tree-0");
|
||||
// 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") <
|
||||
@@ -132,11 +139,10 @@ test("computeResourceProfile scales concurrency, checkers, and UI GOMAXPROCS acr
|
||||
testProgramsConcurrency: 4,
|
||||
testProgramsCheckers: 1,
|
||||
});
|
||||
// 8-core / 32 GiB (m8i.2xlarge): higher checkers and concurrency.
|
||||
const m8i = computeResourceProfile({ cpus: 8, totalMemoryBytes: 32 * GiB });
|
||||
assert.deepEqual(m8i, {
|
||||
laneConcurrency: 6,
|
||||
serverDeclCheckers: 4,
|
||||
laneConcurrency: 8,
|
||||
serverDeclCheckers: 6,
|
||||
serverLayerCheckers: 2,
|
||||
testProjectCheckers: 2,
|
||||
uiGomaxprocs: 4,
|
||||
@@ -218,9 +224,11 @@ test("PR mode for a server-only change skips release registry, UI, runner, sandb
|
||||
const taskNames = tasks.map((task) => task.name);
|
||||
|
||||
assert.ok(!prepareNames.includes("build server without type checks"));
|
||||
assert.ok(prepareNames.includes("CLI guidance safety"));
|
||||
assert.ok(!prepareNames.includes("CLI guidance safety"));
|
||||
assert.ok(taskNames.includes("CLI guidance safety"));
|
||||
assert.ok(!prepareNames.includes("install test program dependencies"));
|
||||
assert.ok(!prepareNames.includes("typecheck @paperclipai/paperclip-runner"));
|
||||
assert.ok(!taskNames.includes("typecheck @paperclipai/paperclip-runner"));
|
||||
|
||||
assert.ok(taskNames.includes(PREPARE_RUNNER_VENDOR));
|
||||
assert.ok(taskNames.includes(BUILD_SERVER_EMIT_ONLY));
|
||||
@@ -272,7 +280,8 @@ test("PR mode for a pure UI component change skips server build/declarations, re
|
||||
const prepareNames = prepare.map((task) => task.name);
|
||||
const taskNames = tasks.map((task) => task.name);
|
||||
|
||||
assert.ok(prepareNames.includes("CLI guidance safety"));
|
||||
assert.ok(!prepareNames.includes("CLI guidance safety"));
|
||||
assert.ok(taskNames.includes("CLI guidance safety"));
|
||||
assert.ok(!prepareNames.includes("build server without type checks"));
|
||||
assert.ok(!prepareNames.includes("install test program dependencies"));
|
||||
assert.ok(!taskNames.includes("server declarations"));
|
||||
@@ -316,7 +325,7 @@ test("PR mode fails closed for unknown build-gap packages and global typecheck i
|
||||
changedFiles: ["tsconfig.base.json"],
|
||||
});
|
||||
assert.ok(globalPlan.prepare.some((t) => t.name === "install test program dependencies"));
|
||||
assert.ok(globalPlan.prepare.some((t) => t.name === "typecheck @paperclipai/paperclip-runner"));
|
||||
assert.ok(globalPlan.tasks.some((t) => t.name === "typecheck @paperclipai/paperclip-runner"));
|
||||
assert.ok(globalPlan.tasks.some((t) => t.name === "typecheck @paperclipai/ui"));
|
||||
assert.ok(globalPlan.tasks.some((t) => t.name === "test project tests/runner-e2e"));
|
||||
});
|
||||
@@ -433,16 +442,18 @@ test("PR mode skips Runner Rust typecheck when only shared TypeScript packages c
|
||||
testLayers: ["tests"],
|
||||
changedFiles: ["packages/shared/src/customer-success.ts"],
|
||||
});
|
||||
const runnerTask = sharedPr.prepare.find((t) => t.name === "typecheck @paperclipai/paperclip-runner");
|
||||
const runnerTask = sharedPr.tasks.find((t) => t.name === "typecheck @paperclipai/paperclip-runner");
|
||||
assert.deepEqual(runnerTask.args, ["--filter", "@paperclipai/paperclip-runner", "run", "typecheck:typescript"]);
|
||||
assert.deepEqual(runnerTask.needs, [PREPARE_RUNNER_VENDOR]);
|
||||
|
||||
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");
|
||||
const runnerFullTask = runnerPr.tasks.find((t) => t.name === "typecheck @paperclipai/paperclip-runner");
|
||||
assert.deepEqual(runnerFullTask.args, ["--filter", "@paperclipai/paperclip-runner", "typecheck"]);
|
||||
assert.deepEqual(runnerFullTask.needs, [PREPARE_RUNNER_VENDOR]);
|
||||
});
|
||||
|
||||
test("typecheckUiIncremental runs storybook catalog then incremental tsc with a portable tsBuildInfoFile", () => {
|
||||
|
||||
@@ -10,7 +10,8 @@ import { LOW_MEMORY_VARIABLE, EMIT_ONLY_VARIABLE, runTsc } from "./run-tsc.mjs";
|
||||
import { selectTestPrograms } from "./typecheck-test-programs.mjs";
|
||||
import { PROJECTS, orderProjectsLpt, selectTestProjects } from "./typecheck-test-projects.mjs";
|
||||
|
||||
export const SERIAL_BUILD_GAPS = ["@paperclipai/paperclip-runner"];
|
||||
export const SERIAL_BUILD_GAPS = [];
|
||||
const RUNNER_PACKAGE_NAME = "@paperclipai/paperclip-runner";
|
||||
export const BACKGROUND_PRIORITY = 10;
|
||||
export const DEFAULT_MAX_CONCURRENCY = 3;
|
||||
export const DEFAULT_TEST_PROGRAMS_CONCURRENCY = 3;
|
||||
@@ -64,10 +65,9 @@ export function computeResourceProfile({ cpus = availableParallelism(), totalMem
|
||||
testProgramsCheckers: 1,
|
||||
};
|
||||
}
|
||||
// 6-8+ core / >= 24 GiB (e.g. m8i.2xlarge or local dev): maximize parallelism across declarations, layers, and UI.
|
||||
return {
|
||||
laneConcurrency: Math.min(6, safeCpus),
|
||||
serverDeclCheckers: Math.min(4, Math.max(3, Math.floor(safeCpus / 2))),
|
||||
laneConcurrency: Math.min(8, safeCpus),
|
||||
serverDeclCheckers: Math.min(6, Math.max(4, safeCpus - 2)),
|
||||
serverLayerCheckers: 2,
|
||||
testProjectCheckers: 2,
|
||||
uiGomaxprocs: 4,
|
||||
@@ -373,22 +373,11 @@ export function planLane({
|
||||
prepare.push({ name: "install test program dependencies", command: "node", args: prepareArgs });
|
||||
}
|
||||
|
||||
prepare.push(
|
||||
...selectedBuildGaps.filter((name) => SERIAL_BUILD_GAPS.includes(name)).map((name) => typecheckPackage(name, false)),
|
||||
{
|
||||
name: CLI_GUIDANCE_SAFETY,
|
||||
command: "pnpm",
|
||||
args: ["exec", "vitest", "run", "--project", "@paperclipai/server", "server/src/__tests__/cli-invocation-safety.test.ts"],
|
||||
},
|
||||
);
|
||||
|
||||
const needsRunnerVendor = [PREPARE_RUNNER_VENDOR];
|
||||
const needsDeclarations = [SERVER_DECLARATIONS];
|
||||
const tasks = [];
|
||||
|
||||
if (runServer) {
|
||||
// Ensure packages/paperclip-runner/dist is current once in parallel with UI / non-runner checks,
|
||||
// then fan out server declarations and emit-only server build without racing on runner dist.
|
||||
tasks.push(
|
||||
{
|
||||
name: PREPARE_RUNNER_VENDOR,
|
||||
@@ -409,6 +398,12 @@ export function planLane({
|
||||
);
|
||||
}
|
||||
|
||||
tasks.push({
|
||||
name: CLI_GUIDANCE_SAFETY,
|
||||
command: "pnpm",
|
||||
args: ["exec", "vitest", "run", "--project", "@paperclipai/server", "server/src/__tests__/cli-invocation-safety.test.ts"],
|
||||
});
|
||||
|
||||
if (runReleaseRegistry) {
|
||||
tasks.push({ name: "release registry tests", command: "pnpm", args: ["run", "test:release-registry"] });
|
||||
}
|
||||
@@ -418,6 +413,10 @@ export function planLane({
|
||||
tasks.push(typecheckPackage("@paperclipai/ui", true));
|
||||
}
|
||||
|
||||
if (selectedBuildGaps.includes(RUNNER_PACKAGE_NAME)) {
|
||||
tasks.push(typecheckPackage(RUNNER_PACKAGE_NAME, true, runServer ? needsRunnerVendor : undefined));
|
||||
}
|
||||
|
||||
if (programSelection.programs.length > 0 || programSelection.checkCoverage) {
|
||||
const programArgs = [
|
||||
"scripts/typecheck-test-programs.mjs",
|
||||
@@ -452,21 +451,22 @@ 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.
|
||||
const heavyProjects = selectedProjects.filter((project) => project === "tests/runner-e2e");
|
||||
const lighterProjects = selectedProjects.filter((project) => project !== "tests/runner-e2e");
|
||||
const makeProjectTask = (project) => ({
|
||||
name: `test project ${project}`,
|
||||
command: "node",
|
||||
args: [
|
||||
"scripts/typecheck-test-projects.mjs",
|
||||
"--checkers",
|
||||
String(resources.testProjectCheckers),
|
||||
"--reuse-declarations",
|
||||
project,
|
||||
],
|
||||
needs: needsDeclarations,
|
||||
});
|
||||
tasks.push(
|
||||
...selectedProjects.map((project) => ({
|
||||
name: `test project ${project}`,
|
||||
command: "node",
|
||||
args: [
|
||||
"scripts/typecheck-test-projects.mjs",
|
||||
"--checkers",
|
||||
String(resources.testProjectCheckers),
|
||||
"--reuse-declarations",
|
||||
project,
|
||||
],
|
||||
needs: needsDeclarations,
|
||||
})),
|
||||
...heavyProjects.map(makeProjectTask),
|
||||
...testLayers.map((layer) => ({
|
||||
name: `server layer ${layer}`,
|
||||
command: "node",
|
||||
@@ -479,6 +479,7 @@ export function planLane({
|
||||
],
|
||||
needs: needsDeclarations,
|
||||
})),
|
||||
...lighterProjects.map(makeProjectTask),
|
||||
{
|
||||
name: BUILD_SERVER_EMIT_ONLY,
|
||||
command: "pnpm",
|
||||
@@ -501,7 +502,7 @@ export function planLane({
|
||||
|
||||
tasks.push(
|
||||
...selectedBuildGaps
|
||||
.filter((name) => !SERIAL_BUILD_GAPS.includes(name) && name !== "@paperclipai/ui")
|
||||
.filter((name) => !SERIAL_BUILD_GAPS.includes(name) && name !== "@paperclipai/ui" && name !== RUNNER_PACKAGE_NAME)
|
||||
.map((name) =>
|
||||
typecheckPackage(name, true, runServer && name === "paperclipai" ? needsRunnerVendor : undefined),
|
||||
),
|
||||
|
||||
@@ -4,6 +4,7 @@ import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { afterEach, describe, expect, it } from "vitest";
|
||||
import { computeBuildInputsDigest } from "../../../packages/paperclip-runner/scripts/build-inputs.mjs";
|
||||
import { buildRunnerBuildPlan } from "../../../packages/paperclip-runner/scripts/run-build.mjs";
|
||||
import {
|
||||
RUNNER_IMAGE_CONTEXT_INPUTS,
|
||||
RUNNER_IMAGE_INPUTS_SCHEMA,
|
||||
@@ -339,19 +340,41 @@ describe("Runner image stages", () => {
|
||||
// whole script: a new step fails here until someone decides whether the
|
||||
// image build must run it too.
|
||||
const manifest = JSON.parse(readFileSync(path.join(repoRoot, "packages/paperclip-runner/package.json"), "utf8"));
|
||||
expect((manifest.scripts.build as string).split(" && ")).toEqual([
|
||||
"node scripts/record-build-inputs.mjs --begin",
|
||||
"pnpm run check:protocol-manifest",
|
||||
"pnpm run build:typescript",
|
||||
"pnpm run check:capability-contract",
|
||||
"pnpm run check:capability-inventory",
|
||||
"pnpm run check:protocol-coverage",
|
||||
"node scripts/generate-semantic-contracts.mjs --check",
|
||||
"node scripts/check-runner-workflow-traceability.mjs",
|
||||
"node scripts/build-runner-binary.mjs",
|
||||
"node scripts/generate-replay-goldens.mjs --check",
|
||||
"node scripts/generate-semantic-action-catalog.mjs --check",
|
||||
"node scripts/record-build-inputs.mjs --finish",
|
||||
expect(manifest.scripts.build).toBe("node scripts/run-build.mjs");
|
||||
const phases = buildRunnerBuildPlan({ env: {} }) as Array<{
|
||||
steps?: Array<{ label: string }>;
|
||||
chains?: Array<{ steps: Array<{ label: string }> }>;
|
||||
}>;
|
||||
const plannedLabels = phases.flatMap((phase) =>
|
||||
phase.steps
|
||||
? phase.steps.map((step) => step.label)
|
||||
: (phase.chains ?? []).flatMap((chain) => chain.steps.map((step) => step.label)),
|
||||
);
|
||||
expect(plannedLabels).toEqual([
|
||||
"record-build-inputs:begin",
|
||||
"build:eval-kernel",
|
||||
"tsc:version",
|
||||
"tsc:tsconfig",
|
||||
"tsc:surfaces",
|
||||
"cargo:release-runnerd",
|
||||
"check:protocol-manifest",
|
||||
"check:acpx-profiles",
|
||||
"check:antigravity-models",
|
||||
"check:protocol-schema-module",
|
||||
"check:acpx-sidecar-contract",
|
||||
"check:runtime-context-contract",
|
||||
"check:provider-failure-contract",
|
||||
"check:capability-contract",
|
||||
"check:capability-inventory",
|
||||
"build:verified-entrypoints",
|
||||
"install:copilot-assets",
|
||||
"build:runner-binary",
|
||||
"check:protocol-coverage",
|
||||
"check:semantic-contracts",
|
||||
"check:replay-goldens",
|
||||
"check:semantic-action-catalog",
|
||||
"check:runner-workflow-traceability",
|
||||
"record-build-inputs:finish",
|
||||
]);
|
||||
const build = runner.find((stage) => stage.name === "runner-artifacts-build")!.lines.join("\n");
|
||||
for (const step of ["node scripts/record-build-inputs.mjs --begin;", "pnpm run build:typescript;", "pnpm run build:binary;",
|
||||
|
||||
@@ -5,6 +5,25 @@ import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { RUNNER_VENDOR_BUILD_COMMAND } from "../../scripts/prepare-runner-vendor.mjs";
|
||||
import { buildRunnerBuildPlan } from "../../../packages/paperclip-runner/scripts/run-build.mjs";
|
||||
|
||||
type RunnerBuildStep = {
|
||||
label: string;
|
||||
command: string;
|
||||
args: string[];
|
||||
};
|
||||
|
||||
type RunnerBuildPhase = {
|
||||
name: string;
|
||||
mode: string;
|
||||
steps?: RunnerBuildStep[];
|
||||
chains?: Array<{ name: string; steps: RunnerBuildStep[] }>;
|
||||
};
|
||||
|
||||
function phaseSteps(phase: RunnerBuildPhase): RunnerBuildStep[] {
|
||||
if (phase.steps) return phase.steps;
|
||||
return (phase.chains ?? []).flatMap((chain) => chain.steps);
|
||||
}
|
||||
|
||||
const packageJsonPath = fileURLToPath(
|
||||
new URL("../../package.json", import.meta.url),
|
||||
@@ -84,11 +103,21 @@ describe("server package build script", () => {
|
||||
const runner = JSON.parse(readFileSync(new URL(
|
||||
"../../../packages/paperclip-runner/package.json", import.meta.url,
|
||||
), "utf8")) as { scripts: Record<string, string> };
|
||||
const steps = runner.scripts.build.split(" && ");
|
||||
expect(steps.at(0)).toBe("node scripts/record-build-inputs.mjs --begin");
|
||||
expect(steps.at(-1)).toBe("node scripts/record-build-inputs.mjs --finish");
|
||||
expect(steps.filter((step) => step.includes("record-build-inputs"))).toHaveLength(2);
|
||||
expect(steps.length).toBeGreaterThan(2);
|
||||
expect(runner.scripts.build).toBe("node scripts/run-build.mjs");
|
||||
const phases = buildRunnerBuildPlan({ env: {} }) as RunnerBuildPhase[];
|
||||
expect(phases.length).toBeGreaterThan(2);
|
||||
expect(phases.at(0)?.mode).toBe("serial");
|
||||
expect(phaseSteps(phases.at(0)!).map((step) => step.args)).toEqual([
|
||||
["scripts/record-build-inputs.mjs", "--begin"],
|
||||
]);
|
||||
expect(phases.at(-1)?.mode).toBe("serial");
|
||||
expect(phaseSteps(phases.at(-1)!).map((step) => step.args)).toEqual([
|
||||
["scripts/record-build-inputs.mjs", "--finish"],
|
||||
]);
|
||||
const allSteps = phases.flatMap(phaseSteps);
|
||||
expect(
|
||||
allSteps.filter((step) => step.args.some((arg) => arg.includes("record-build-inputs"))),
|
||||
).toHaveLength(2);
|
||||
});
|
||||
|
||||
it("replaces an existing read-only image manifest with the build's copy step", () => {
|
||||
@@ -140,23 +169,40 @@ describe("server package build script", () => {
|
||||
const runner = JSON.parse(readFileSync(new URL(
|
||||
"../../../packages/paperclip-runner/package.json", import.meta.url,
|
||||
), "utf8")) as { scripts: Record<string, string> };
|
||||
const steps = runner.scripts.build.split(" && ");
|
||||
const wrapped = steps
|
||||
.filter((step) => step.startsWith("pnpm run "))
|
||||
.map((step) => step.slice("pnpm run ".length));
|
||||
for (const name of wrapped) {
|
||||
expect(runner.scripts[name], `build step ${name}`).toBeDefined();
|
||||
}
|
||||
const compiles = (step: string) =>
|
||||
step === "build:typescript" || (runner.scripts[step] ?? "").includes("build:typescript");
|
||||
expect(runner.scripts.build).toBe("node scripts/run-build.mjs");
|
||||
const phases = buildRunnerBuildPlan({ env: {} }) as RunnerBuildPhase[];
|
||||
const indexedSteps = phases.flatMap((phase, phaseIndex) =>
|
||||
phaseSteps(phase).map((step) => ({ phaseIndex, step })),
|
||||
);
|
||||
const tscPrimary = indexedSteps.filter(({ step }) =>
|
||||
step.args.includes("tsconfig.json") && step.args.some((arg) => arg.endsWith("/tsc")),
|
||||
);
|
||||
const tscSurfaces = indexedSteps.filter(({ step }) =>
|
||||
step.args.includes("tsconfig.surfaces.json") && step.args.some((arg) => arg.endsWith("/tsc")),
|
||||
);
|
||||
const evalKernelBuilds = indexedSteps.filter(({ step }) =>
|
||||
step.args.includes("@paperclipai/paperclip-eval-kernel") && step.args.includes("build"),
|
||||
);
|
||||
const nestedBuildTs = indexedSteps.filter(({ step }) =>
|
||||
step.args.some((arg) => arg === "build:typescript" || (runner.scripts[arg] ?? "").includes("build:typescript")),
|
||||
);
|
||||
|
||||
expect(wrapped.filter(compiles)).toEqual(["build:typescript"]);
|
||||
expect(steps).toContain("node scripts/generate-semantic-contracts.mjs --check");
|
||||
expect(steps).toContain("node scripts/check-runner-workflow-traceability.mjs");
|
||||
expect(steps.indexOf("node scripts/generate-semantic-contracts.mjs --check"))
|
||||
.toBeGreaterThan(steps.indexOf("pnpm run build:typescript"));
|
||||
expect(steps.indexOf("node scripts/check-runner-workflow-traceability.mjs"))
|
||||
.toBeGreaterThan(steps.indexOf("pnpm run build:typescript"));
|
||||
expect(tscPrimary).toHaveLength(1);
|
||||
expect(tscSurfaces).toHaveLength(1);
|
||||
expect(evalKernelBuilds).toHaveLength(1);
|
||||
expect(nestedBuildTs).toHaveLength(0);
|
||||
|
||||
const tsPhaseIndex = Math.max(tscPrimary[0].phaseIndex, tscSurfaces[0].phaseIndex);
|
||||
const semanticContracts = indexedSteps.find(({ step }) =>
|
||||
step.args[0] === "scripts/generate-semantic-contracts.mjs" && step.args[1] === "--check",
|
||||
);
|
||||
const traceability = indexedSteps.find(({ step }) =>
|
||||
step.args[0] === "scripts/check-runner-workflow-traceability.mjs",
|
||||
);
|
||||
expect(semanticContracts).toBeDefined();
|
||||
expect(traceability).toBeDefined();
|
||||
expect(semanticContracts!.phaseIndex).toBeGreaterThan(tsPhaseIndex);
|
||||
expect(traceability!.phaseIndex).toBeGreaterThan(tsPhaseIndex);
|
||||
});
|
||||
|
||||
it("ships the pinned OpenCode dependency resolved by the vendored Runner", () => {
|
||||
|
||||
Reference in new issue
Block a user