Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

ci(lanes): install node deps for rust-core-coverage on a core-only change

Ghost Scripter939e2a3af0da
diff --git a/scripts/__tests__/self-hosted-lanes.test.mjs b/scripts/__tests__/self-hosted-lanes.test.mjs
index 6a5afc2115..71f949f27a 100644
--- a/scripts/__tests__/self-hosted-lanes.test.mjs
+++ b/scripts/__tests__/self-hosted-lanes.test.mjs
@@ -97,6 +97,38 @@ test("ex63 runs the core's unit tests under nextest; hosted keeps cargo's runner
);
});
+test("a core-only change still installs the node deps rust-core-coverage's mock backend imports", () => {
+ const coreOnly = { ...NONE, rustCore: true };
+ for (const plan of [
+ buildPlan({ profile: "ex63", areas: coreOnly, env: EX63_ENV }),
+ buildPlan({ profile: "hosted", areas: coreOnly }),
+ ]) {
+ const checks = new Map(
+ plan.lanes.flatMap((l) =>
+ l.checks.map((c) => [`${l.name}:${c.name}`, c]),
+ ),
+ );
+ const cov = checks.get("rust-cov:rust-core-coverage");
+ const install = cov.needs
+ .map((n) => checks.get(n.includes(":") ? n : `rust-cov:${n}`))
+ .find((c) => c.run === "pnpm install --frozen-lockfile");
+ assert.ok(
+ install,
+ `${plan.profile}: rust-core-coverage needs a pnpm install`,
+ );
+ assert.equal(install.when, true, `${plan.profile}: that install runs`);
+ // Exactly one install per profile: ex63 lanes share one checkout.
+ const installs = [...checks.values()].filter(
+ (c) => c.when && c.run === "pnpm install --frozen-lockfile",
+ );
+ assert.equal(installs.length, 1, plan.profile);
+ }
+ const hosted = buildPlan({ profile: "hosted", areas: coreOnly });
+ const sub = selectLanes(hosted, ["rust-cov"]);
+ assert.deepEqual(validatePlan(sub), []);
+ assert.deepEqual(orderProblems(sub), []);
+});
+
test("doctests, tui coverage and module-gated tests are outside the PR lane", () => {
for (const plan of plans()) {
const cov = plan.lanes
diff --git a/scripts/ci/self-hosted/lanes-plan.mjs b/scripts/ci/self-hosted/lanes-plan.mjs
index 71e5242cd6..59f275fccf 100644
--- a/scripts/ci/self-hosted/lanes-plan.mjs
+++ b/scripts/ci/self-hosted/lanes-plan.mjs
@@ -204,7 +204,10 @@ export function buildPlan({ profile, areas, env = {}, isPullRequest = true }) {
checks: [
{
name: "pnpm-install",
- when: areas.frontend || areas.i18n || areas.scripts,
+ // ex63: also for a core change, so rust-core-coverage's mock backend
+ // (scripts/mock-api-server.mjs imports `ws`) can start when no
+ // frontend file changed. One install per VM: lanes share a checkout.
+ when: areas.frontend || areas.i18n || areas.scripts || (ex63 && core),
run: "pnpm install --frozen-lockfile",
},
{
@@ -288,6 +291,13 @@ export function buildPlan({ profile, areas, env = {}, isPullRequest = true }) {
targetDir: targetDir("cov"),
env: covEnv,
checks: [
+ // hosted: rust-cov has a runner of its own, so it installs the node
+ // deps the mock backend needs itself (ex63 reuses frontend's install).
+ {
+ name: "pnpm-install",
+ when: !ex63 && core,
+ run: "pnpm install --frozen-lockfile",
+ },
{
name: "test-modules",
when: core,
@@ -303,7 +313,10 @@ export function buildPlan({ profile, areas, env = {}, isPullRequest = true }) {
{
name: "rust-core-coverage",
when: core,
- needs: ["test-modules"],
+ needs: [
+ "test-modules",
+ ex63 ? "frontend:pnpm-install" : "pnpm-install",
+ ],
// Doctests and tui coverage run on pushes to main instead (see above).
// ex63: the core's unit tests run under cargo-nextest, one process
// per test and in parallel (the guest image ships cargo-nextest).