You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maka.apache.org by as...@apache.org on 2026/09/01 13:05:10 UTC

(maka) 01/04: test(ci): give the install-free lane a name and a contract

This is an automated email from the ASF dual-hosted git repository.

Astro-Han pushed a commit to branch ci/4451-reduce-runner-occupancy
in repository https://gitbox.apache.org/repos/asf/maka.git

commit 7c8e9240369e679c0fdff98bf3cbd04eddf5bc39
Author: AstroHan <le...@outlook.com>
AuthorDate: Tue Sep 1 21:00:20 2026 +0800

    test(ci): give the install-free lane a name and a contract
    
    `ci-test-plan.test.mjs` was the only suite running before `npm ci`, so
    every assertion that needed a bare checkout accreted there regardless of
    subject: 66 tests, of which 35 read `.github/workflows/*.yml` and had
    nothing to do with the test planner. The file name carried no hint that
    its one hard rule is "import nothing that is not installed yet", which is
    how a closure assertion needing esbuild was very nearly added to it. That
    import would have thrown `ERR_MODULE_NOT_FOUND` in the sole required
    context and frozen every merge in the repository.
    
    Split by what a test reads. `ci-test-plan.test.mjs` keeps the 30 tests
    that exercise the planner against an in-memory graph; the 36 that read a
    workflow move to `ci-workflow-policy.test.mjs`, beside the two policy
    suites that already follow that name.
    
    Naming the constraint is not enforcing it, so derive it: the new suite
    reads which files the steps above `setup-node` run and walks their
    transitive local imports, failing on any specifier that is neither a
    `node:` builtin nor a repository module holding the same rule. Moving a
    step below the install lifts the constraint and adding one above imposes
    it, with no list to maintain.
    
    The closure assertion itself now lives in
    `windows-package-source-closure.test.mjs`, which `check:release` runs
    after installing, and `windows-recovery.yml` joined the release-contract
    inputs so editing that filter selects the gate that checks it.
    
    Two app-icon tests iterated a hand-written `APP_ICON_INPUTS`; the derived
    test computes that same set from the suites the step runs, so they folded
    into it and the list is gone. `prepare-windows-upgrade-baseline.test.mjs`
    joined `check:release` without joining the planner's release set — the
    guardrail that exists for exactly that caught it.
    
    Generated-by: Claude Code
---
 .github/workflows/ci.yml                           |   4 +-
 .github/workflows/windows-recovery.yml             |   5 +-
 package.json                                       |   2 +-
 scripts/ci-test-plan.mjs                           |   2 +
 scripts/ci-test-plan.test.mjs                      | 786 +--------------------
 ...t-plan.test.mjs => ci-workflow-policy.test.mjs} | 530 ++------------
 scripts/windows-package-source-closure.mjs         |   8 +-
 scripts/windows-package-source-closure.test.mjs    |  49 ++
 8 files changed, 143 insertions(+), 1243 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 15cd6334e0..60e432e9e3 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -66,7 +66,9 @@ jobs:
           fi
 
       - name: Test CI planner
-        run: node --test --test-concurrency=1 scripts/ci-test-plan.test.mjs scripts/verify-windows-harness.test.mjs
+        run: >-
+          node --test --test-concurrency=1 scripts/ci-test-plan.test.mjs
+          scripts/ci-workflow-policy.test.mjs scripts/verify-windows-harness.test.mjs
 
       # Pure Node like the planner test, and the labelling workflow imports this
       # module directly, so a tier or exclusion change is caught here rather
diff --git a/.github/workflows/windows-recovery.yml b/.github/workflows/windows-recovery.yml
index c81c82c50d..cbf1ea3791 100644
--- a/.github/workflows/windows-recovery.yml
+++ b/.github/workflows/windows-recovery.yml
@@ -63,8 +63,9 @@ on:
       - 'scripts/windows-runtime-host-local-ipc-trust.ps1'
       # Every file in the import closure of the suites below that branches on
       # `process.platform === 'win32'`. Generated, not curated:
-      # `scripts/ci-test-plan.test.mjs` recomputes this set from the dist tests
-      # the steps run and fails on any difference in either direction.
+      # `scripts/windows-package-source-closure.test.mjs` recomputes this set
+      # from the dist tests the steps run and fails on any difference in either
+      # direction.
       - 'packages/core/src/diagnostic-log.ts'
       - 'packages/runtime-host/src/__tests__/control-endpoint.test.ts'
       - 'packages/runtime-host/src/__tests__/fixtures/endpoint-hygiene.ts'
diff --git a/package.json b/package.json
index d2c7cc144f..08a3131b68 100644
--- a/package.json
+++ b/package.json
@@ -74,7 +74,7 @@
     "check:runtime-host-peer-dependencies": "node scripts/generate-runtime-host-peer-dependencies.mjs --check",
     "generate:runtime-host-peer-notices": "node scripts/generate-runtime-host-peer-notices.mjs",
     "check:runtime-host-peer-notices": "node scripts/generate-runtime-host-peer-notices.mjs --check",
-    "check:release": "npm run check:stale && npm run check:third-party-notices && npm run check:cli-third-party-notices && npm run check:model-metadata && npm run check:product-release-identity && npm run check:asf-npm && node --test scripts/product-nightly.test.mjs scripts/desktop-nightly.test.mjs scripts/desktop-nightly-stage.test.mjs scripts/desktop-nightly-release.test.mjs scripts/desktop-nightly-workflow-policy.test.mjs scripts/product-release.test.mjs scripts/product-release-author [...]
+    "check:release": "npm run check:stale && npm run check:third-party-notices && npm run check:cli-third-party-notices && npm run check:model-metadata && npm run check:product-release-identity && npm run check:asf-npm && node --test scripts/product-nightly.test.mjs scripts/desktop-nightly.test.mjs scripts/desktop-nightly-stage.test.mjs scripts/desktop-nightly-release.test.mjs scripts/desktop-nightly-workflow-policy.test.mjs scripts/product-release.test.mjs scripts/product-release-author [...]
     "package:macos-arm64": "node scripts/package-macos-arm64.mjs",
     "verify:macos-arm64": "node scripts/verify-macos-arm64-dmg.mjs",
     "package:macos-autoupdate-next": "node scripts/package-macos-autoupdate-next.mjs",
diff --git a/scripts/ci-test-plan.mjs b/scripts/ci-test-plan.mjs
index 19c90b7a5f..149dd30152 100644
--- a/scripts/ci-test-plan.mjs
+++ b/scripts/ci-test-plan.mjs
@@ -49,12 +49,14 @@ const RELEASE_CONTRACT_FILES = new Set([
   '.github/workflows/release-cli-stage.yml',
   '.github/workflows/release.yml',
   '.github/workflows/release-windows-check.yml',
+  '.github/workflows/windows-recovery.yml',
   'scripts/package-macos-arm64.mjs',
   'scripts/package-macos-autoupdate-next.mjs',
   'scripts/package-macos-arm64-cli.mjs',
   'scripts/package-windows-autoupdate-next.mjs',
   'scripts/package-windows-x64.mjs',
   'scripts/prepare-windows-upgrade-baseline.mjs',
+  'scripts/prepare-windows-upgrade-baseline.test.mjs',
   'scripts/generate-third-party-notices.test.mjs',
   'scripts/product-release.test.mjs',
   'scripts/qualify-released-cli-state-root.test.mjs',
diff --git a/scripts/ci-test-plan.test.mjs b/scripts/ci-test-plan.test.mjs
index fefd9f2841..a9d03ddeb0 100644
--- a/scripts/ci-test-plan.test.mjs
+++ b/scripts/ci-test-plan.test.mjs
@@ -17,19 +17,26 @@
  * under the License.
  */
 
+/**
+ * Behaviour of the test planner itself: which lanes a set of changed files
+ * selects. Assertions about the workflows that consume those selections live in
+ * `ci-workflow-policy.test.mjs`.
+ *
+ * This suite runs before `npm ci` installs anything, so it may import only
+ * `node:` builtins and repository modules that do the same.
+ * `ci-workflow-policy.test.mjs` asserts that constraint for every suite the
+ * install-free steps run.
+ */
 import assert from 'node:assert/strict';
-import { existsSync, readdirSync, readFileSync } from 'node:fs';
+import { existsSync, readFileSync } from 'node:fs';
 import test from 'node:test';
-import { fileURLToPath } from 'node:url';
 
 import {
   changedFilesBetween,
   formatGitHubOutputs,
-  loadWorkspaceGraph,
   planTests,
   requiresHeavyValidation,
 } from './ci-test-plan.mjs';
-import { collectWorkspaceSourceClosure } from './windows-package-source-closure.mjs';
 
 const dirs = [
   'packages/core',
@@ -401,188 +408,10 @@ test('ordinary changes do not pay for the released forward roll', () => {
   assert.equal(plan.stateRootCompat, false);
 });
 
-test('GitHub output matches the selections consumed by CI', () => {
-  const output = formatGitHubOutputs(planTests([], { graph, forceFull: true }));
-  const outputKeys = new Set(output.split('\n').map((line) => line.split('=', 1)[0]));
-  const workflow = readWorkflow('ci.yml');
-
-  // The planner writes one step's outputs and every later step gates on them,
-  // so what it emits and what CI reads are the same set. A key nothing reads,
-  // or a gate on a key the planner never writes, is a dead lane either way.
-  const consumedKeys = new Set(
-    [...workflow.matchAll(/steps\.plan\.outputs\.([a-z0-9_]+)/gu)].map((match) => match[1]),
-  );
-
-  assert.deepEqual(outputKeys, consumedKeys);
-});
-
-test('one unconditional job carries the required context on every pull request', () => {
-  const workflow = readWorkflow('ci.yml');
-
-  // `.asf.yaml` requires `test`. A paths filter would stop the workflow and
-  // leave that check pending forever, and a second job would make the same
-  // pull request queue for a scarce runner twice to reach one verdict.
-  assert.doesNotMatch(triggerBlock('ci.yml'), /\bpaths(-ignore)?:/u);
-
-  const jobsBlock = workflow.slice(workflow.indexOf('\njobs:'));
-  const jobs = [...jobsBlock.matchAll(/^ {2}([a-z0-9_-]+):$/gmu)].map((match) => match[1]);
-  assert.deepEqual(jobs, ['test']);
-  assert.doesNotMatch(jobsBlock, /^ {4}needs:/mu);
-  assert.doesNotMatch(jobsBlock, /^ {4}if:/mu);
-});
-
-test('planning runs first and every later step gates on its outputs', () => {
-  const workflow = readWorkflow('ci.yml');
-
-  // With the job split gone there is no `needs` context to read. GitHub
-  // resolves a leftover `needs.plan.outputs.x` to the empty string rather
-  // than failing, so the step it guards would silently never run again.
-  assert.doesNotMatch(workflow, /needs\.plan\.outputs/u);
-
-  const planStep = workflow.indexOf('      - id: plan\n');
-  assert.ok(planStep >= 0, 'no planning step');
-  assert.ok(planStep < workflow.indexOf('steps.plan.outputs'));
-  assert.match(
-    workflow,
-    /- name: Check renderer architecture\n\s+if: steps\.plan\.outputs\.code == 'true'/u,
-  );
-});
-
-test('core CI validates pull requests and the resulting main branch state', () => {
-  const workflow = readWorkflow('ci.yml');
-
-  assert.match(workflow, /pull_request:\n\s+branches: \[main\]/u);
-  assert.match(workflow, /push:\n\s+branches: \[main\]/u);
-  assert.match(
-    workflow,
-    /BASE_SHA: \$\{\{ github\.event_name == 'push' && github\.event\.before \|\| github\.event\.pull_request\.base\.sha \}\}/u,
-  );
-  assert.match(
-    workflow,
-    /HEAD_SHA: \$\{\{ github\.event_name == 'push' && github\.sha \|\| github\.event\.pull_request\.head\.sha \}\}/u,
-  );
-  assert.match(workflow, /\[\[ "\$BASE_SHA" =~ \^0\+\$ \]\]/u);
-});
-
-test('core CI uses the Windows inventory package-script authority', () => {
-  const workflow = readWorkflow('ci.yml');
-
-  assert.match(workflow, /run: npm run windows:inventory/u);
-  assert.doesNotMatch(workflow, /run: node scripts\/windows-test-inventory\.mjs --check/u);
-});
-
-test('contract checks run before dependency setup and can fail the job', () => {
-  const workflow = readWorkflow('ci.yml');
-  const setupNodeStart = workflow.indexOf('      - uses: actions/setup-node@');
-
-  // These contracts need nothing but the checkout, so they run on every change
-  // rather than behind a surface flag — and a gate that cannot fail the job is
-  // not a gate.
-  for (const name of [
-    'Test CI planner',
-    'Check Windows test inventory',
-    'Verify ASF npm preflight policy',
-  ]) {
-    const start = workflow.indexOf(`      - name: ${name}\n`);
-    assert.ok(start >= 0, name);
-    assert.ok(start < setupNodeStart, name);
-
-    const step = workflow.slice(start, workflow.indexOf('\n      - ', start + 1));
-    assert.doesNotMatch(step, /\n\s+if:/u, name);
-    assert.doesNotMatch(step, /continue-on-error/u, name);
-  }
-});
-
-/** Every file the two app-icon drift tests read. */
-const APP_ICON_INPUTS = [
-  'apps/desktop/assets/app-icons/sky.png',
-  // Read by path in the drift test, so pointing it at a different icon that
-  // happens to exist would otherwise package cleanly with the assertion unrun.
-  'apps/desktop/electron-builder.config.mjs',
-  'packages/core/src/settings.ts',
-  'scripts/generate-app-icons.py',
-  'scripts/generate-app-icons.test.mjs',
-  'scripts/verify-packaged-app.mjs',
-  'scripts/verify-packaged-app-icons.test.mjs',
-];
-
-test('every selection that gates an installed step is one heavy validation covers', () => {
-  const workflow = readWorkflow('ci.yml');
-
-  // `heavy` decides whether the toolchain is installed at all, so any later
-  // step gated on a selection outside that disjunction would run against a
-  // runner with no dependencies — or, if the step is a `run:` that tolerates
-  // it, report green having done nothing. Derived from the workflow rather
-  // than restated, so a new plan output cannot gate a step without joining
-  // the disjunction first.
-  const [, installed] = workflow.split(/\n\s+- uses: actions\/setup-node[^\n]*\n/u);
-  assert.ok(installed, 'ci.yml no longer installs a toolchain');
-
-  const gating = [
-    ...new Set([...installed.matchAll(/steps\.plan\.outputs\.(\w+) ==/gu)].map(([, name]) => name)),
-  ].sort();
-  assert.ok(gating.length > 0, 'no installed step is gated on a selection');
-
-  // The planner names selections in camelCase and publishes them in snake_case.
-  const source = readFileSync(new URL('./ci-test-plan.mjs', import.meta.url), 'utf8');
-  const disjunction = source.match(/export function requiresHeavyValidation[\s\S]*?\n\}/u)?.[0];
-  assert.ok(disjunction, 'requiresHeavyValidation is no longer a single expression');
-
-  for (const output of gating) {
-    if (output === 'heavy') continue;
-    const camel = output.replace(/_(\w)/gu, (_, letter) => letter.toUpperCase());
-    assert.match(
-      disjunction,
-      new RegExp(`plan\\.${camel}\\b`, 'u'),
-      `${output} gates an installed step but does not select the install`,
-    );
-  }
-});
-
-test('the app icon gate selects every file its own tests open', () => {
-  // Derived from the step, not from a memory of it: whatever `App icon artwork
-  // drift` runs is the authority on what has to select it. The list this
-  // replaces was assembled by reading those tests, which is how the packaging
-  // config — opened by path rather than imported — stayed off it while the
-  // drift assertion it feeds could be skipped silently.
-  const step = readWorkflow('ci.yml').match(
-    /if: steps\.plan\.outputs\.app_icons == 'true'\n\s+run: node --test ([^\n]+)/u,
-  );
-  assert.ok(step, 'no step is gated on the app icon selection');
-  const suites = step[1].trim().split(/\s+/u);
-  assert.ok(suites.length > 0);
-
-  for (const suite of suites) {
-    assert.equal(planTests([suite], { graph }).appIcons, true, suite);
-    const source = readFileSync(new URL(`../${suite}`, import.meta.url), 'utf8');
-
-    // Every repository path those suites name, however they reach it: a
-    // `new URL` read, a relative import, or a directory of artwork.
-    const named = [
-      ...[...source.matchAll(/new URL\('([^']+)'/gu)].map((match) => match[1]),
-      ...[...source.matchAll(/from '(\.[^']+)'/gu)].map((match) => match[1]),
-    ].map((path) => new URL(path, new URL(`../${suite}`, import.meta.url)).pathname);
-
-    const root = new URL('..', import.meta.url).pathname;
-    for (const absolute of named) {
-      // A trailing slash names a directory, so probe inside it as well: the
-      // artwork is selected by prefix rather than file by file.
-      const path = absolute.slice(root.length).replace(/\/$/u, '');
-      const selects = [path, `${path}/probe`].some(
-        (candidate) => planTests([candidate], { graph }).appIcons,
-      );
-      assert.ok(selects, `${suite} reads ${path}`);
-    }
-  }
-});
-
-test('app icon drift selects the artwork and whatever derives or names it', () => {
-  for (const path of APP_ICON_INPUTS) {
-    assert.equal(planTests([path], { graph }).appIcons, true, path);
-  }
-
-  // Regenerating the artwork costs about a minute. Ordinary product code is
-  // exactly what must stop paying it.
+// Which files select the app icon gate is derived in `ci-workflow-policy.test.mjs`
+// from the suites the step runs. What stays here is the complement: regenerating
+// the artwork costs about a minute, and ordinary product code must stop paying it.
+test('ordinary product code does not pay for app icon drift', () => {
   for (const path of [
     'apps/desktop/src/renderer/app-shell.tsx',
     'packages/core/src/artifacts.ts',
@@ -591,588 +420,3 @@ test('app icon drift selects the artwork and whatever derives or names it', () =
     assert.equal(planTests([path], { graph }).appIcons, false, path);
   }
 });
-
-test('an app icon selection always brings the build those tests need', () => {
-  // `generate-app-icons.test.mjs` imports `APP_ICONS` from built `@maka/core`
-  // and the step runs after Build, which gates on `code`. Every input above
-  // lives in a workspace or under `scripts/`, so `code` follows rather than
-  // needing its own gate — an entry that broke that would fail here.
-  for (const path of APP_ICON_INPUTS) {
-    assert.equal(planTests([path], { graph }).code, true, path);
-  }
-});
-
-test('core CI gates app icon drift on the artwork surface', () => {
-  assert.match(
-    readWorkflow('ci.yml'),
-    /- name: App icon artwork drift\n\s+if: steps\.plan\.outputs\.app_icons == 'true'/u,
-  );
-});
-
-test('core CI checks the Astryx inventory for every code change before building', () => {
-  const workflow = readWorkflow('ci.yml');
-  const inventoryStart = workflow.indexOf('      - name: Astryx surface inventory\n');
-  const inventoryEnd = workflow.indexOf('\n      - ', inventoryStart + 1);
-  const buildStart = workflow.indexOf('      - name: Build\n');
-
-  assert.ok(inventoryStart >= 0);
-  assert.ok(inventoryStart < buildStart);
-
-  const inventoryStep = workflow.slice(inventoryStart, inventoryEnd);
-  assert.match(
-    inventoryStep,
-    /if: steps\.plan\.outputs\.code == 'true' \|\| steps\.plan\.outputs\.astryx_surface == 'true'/u,
-  );
-  assert.doesNotMatch(inventoryStep, /continue-on-error/u);
-});
-
-test('CI installs dependencies whenever the Astryx surface inventory runs', () => {
-  const workflow = readWorkflow('ci.yml');
-  // The inventory step imports the generator, which resolves @astryxdesign/core
-  // and parses the @maka/ui barrel. An inventory-doc-only PR is `astryx_surface`
-  // without `code`, so the `npm ci` step must gate on astryx_surface too — else
-  // the generator runs with no dependencies installed and fails closed.
-  const npmCi = workflow.indexOf('run: npm ci');
-  assert.ok(npmCi >= 0, 'expected an `npm ci` install step');
-  const stepStart = workflow.lastIndexOf('\n      - name:', npmCi) + 1;
-  const stepEnd = workflow.indexOf('\n      - ', npmCi);
-  const installStep = workflow.slice(stepStart, stepEnd);
-  assert.match(installStep, /steps\.plan\.outputs\.astryx_surface == 'true'/u);
-});
-
-test('core CI validates affected installed CLI packages on the heavy runner', () => {
-  const workflow = readWorkflow('ci.yml');
-  const toolchain = workflow.indexOf(
-    'npm install --global --no-audit --no-fund "$(node -p \'require("./package.json").packageManager\')"',
-  );
-  const pack = workflow.indexOf('run: npm run release:cli:pack');
-
-  assert.match(workflow, /if: steps\.plan\.outputs\.cli_package == 'true'/u);
-  assert.ok(toolchain >= 0);
-  assert.ok(toolchain < pack);
-  assert.match(workflow, /run: npm run release:cli:smoke/u);
-});
-
-test('Rust build caches publish immutable source generations only from the default branch', () => {
-  const workflows = readdirSync(WORKFLOW_DIR)
-    .filter((name) => name.endsWith('.yml'))
-    .map((name) => [name, readWorkflow(name)])
-    .filter(([, workflow]) => workflow.includes('tool: kache@0.16.0'));
-
-  assert.equal(workflows.length, 5);
-  for (const [name, workflow] of workflows) {
-    assert.match(workflow, /echo "revision=\$\(git rev-parse HEAD\)"/u, name);
-    const primaryKeys = [...workflow.matchAll(/^\s+key: (kache-[^\n]+)$/gmu)].map(([, key]) => key);
-    assert.ok(primaryKeys.length > 0, name);
-    const restoreKeys = [...workflow.matchAll(/^\s+(kache-[^\n]+-)$/gmu)].map(([, key]) => key);
-    assert.equal(restoreKeys.length, primaryKeys.length, name);
-    primaryKeys.forEach((key) => {
-      assert.match(key, /\$\{\{ steps\.[^.]+\.outputs\.revision \}\}$/u, name);
-      assert.ok(
-        restoreKeys.includes(key.replace(/\$\{\{ steps\.[^.]+\.outputs\.revision \}\}$/u, '')),
-        name,
-      );
-    });
-    assert.match(
-      workflow,
-      /name: Save [^\n]*Rust build cache\n\s+if: [^\n]*github\.event\.repository\.default_branch/u,
-      name,
-    );
-    assert.doesNotMatch(workflow, /kache report [^\n]*--since/u, name);
-  }
-});
-
-test('release contracts run against built CLI outputs', () => {
-  const workflow = readWorkflow('ci.yml');
-  const buildIndex = workflow.indexOf('      - name: Build\n');
-  const buildEnd = workflow.indexOf('\n      - ', buildIndex + 1);
-  const releaseIndex = workflow.indexOf('      - name: Release contracts\n');
-
-  assert.ok(buildIndex >= 0);
-  assert.match(workflow.slice(buildIndex, buildEnd), /release_contract == 'true'/u);
-  assert.ok(buildIndex < releaseIndex);
-  assert.match(
-    workflow.slice(releaseIndex),
-    /if: steps\.plan\.outputs\.release_contract == 'true'/u,
-  );
-});
-
-test('pull request triggers stay on an explicit allowlist', () => {
-  // Naming the lanes that must not run on pull requests only covers the ones
-  // someone remembered to name; W0 kept an unbounded trigger that way.
-  const onPullRequests = readdirSync(WORKFLOW_DIR).filter(hasPullRequestTrigger).sort();
-
-  assert.deepEqual(onPullRequests, [
-    'ci.yml',
-    'cli-package-validation.yml',
-    'copilot-auto-review.yml',
-    'dependency-audit.yml',
-    'gitoxide-helper-admission.yml',
-    'pr-effort-label.yml',
-    'release-windows-check.yml',
-    'runtime-host-owner-platform.yml',
-    'runtime-host-peer-admission.yml',
-    'windows-recovery.yml',
-    'windows-sandbox-w0.yml',
-  ]);
-});
-
-test('every pull request lane holds a scarce runner for the same bounded time', () => {
-  // One tier, not per-lane values. The worst observed successful runs are 19
-  // minutes (ci.yml) and 20 (release-windows-check), so 45 is about 2.3x the
-  // slowest lane: enough headroom for a cold cache and a flake retry, and far
-  // short of the 120 and 90 a hung job used to hold. A lane with no limit at
-  // all inherits GitHub's 360 and fails here.
-  // `pull_request` only: a `pull_request_target` lane reads the pull request
-  // rather than gating it, so it is not competing for a runner the author is
-  // waiting on and keeps its own tighter limit.
-  // Granularity is the file, not the job: a job inside a gating workflow that
-  // opts out of pull requests still carries the tier, because reading a job's
-  // `if:` would need the YAML parser this file cannot install.
-  const gates = readdirSync(WORKFLOW_DIR).filter(hasPullRequestGate);
-  assert.ok(gates.length > 0, 'no pull request lane found');
-
-  for (const name of gates) {
-    // From `jobs:` on, with comment lines stripped, so prose above the triggers
-    // cannot be read as a job.
-    const workflow = readWorkflow(name).replaceAll(/^[ \t]*#.*$/gmu, '');
-    const start = workflow.indexOf('\njobs:');
-    assert.ok(start >= 0, `${name}: no jobs block`);
-    const jobs = workflow.slice(start);
-
-    const limits = [...jobs.matchAll(/^ {4}timeout-minutes: (\d+)$/gmu)].map((match) => match[1]);
-    // Counted by `runs-on`, one per job that consumes a runner, rather than by
-    // job id: a quoted id escapes an id pattern, and a two-space line inside a
-    // `run: |` block satisfies one.
-    const runners = [...jobs.matchAll(/^ {4}runs-on:/gmu)].length;
-    assert.ok(runners > 0, `${name}: no job consumes a runner`);
-    assert.deepEqual(
-      limits,
-      Array.from({ length: runners }, () => '45'),
-      name,
-    );
-  }
-});
-
-test('the recovery lane pairs its path filter with a nightly run and a main push', () => {
-  // Read from the `on:` block with comments stripped, so documenting a trigger
-  // cannot break its contract.
-  const triggers = triggerBlock('windows-recovery.yml');
-
-  // Same contract as the sandbox lane: the filter is a pre-filter, not the
-  // lane's import closure, so dropping the schedule would silently lose every
-  // transitive edit it cannot match, and dropping the filter would put every
-  // Windows recovery run back on every pull request. The main push carries no
-  // filter because `strict: false` lets a stale-base pull request go green,
-  // and because a paths filter only sees the first 300 files of a diff.
-  // Stripped comment lines survive as blank ones, so the gap between the
-  // trigger and its list is any mix of blank and four-space lines.
-  assert.match(triggers, /\n {2}pull_request:\n(?:(?: {4}[^\n]*)?\n)* {4}paths:/u);
-  assert.match(triggers, /\n {2}push:\n {4}branches: \[main\]\n/u);
-  assert.doesNotMatch(
-    triggers.match(/\n {2}push:\n(?:(?: {4}[^\n]*)?\n)*/u)?.[0] ?? '',
-    /\bpaths(-ignore)?:/u,
-  );
-  assert.match(triggers, /\n {2}schedule:\n/u);
-  assert.match(triggers, /\n {2}workflow_dispatch:/u);
-  assert.match(readWorkflow('windows-recovery.yml'), /\n {4}name: windows_recovery/u);
-});
-
-test('the recovery lane keeps every run kind out of one shared concurrency group', () => {
-  const workflow = readWorkflow('windows-recovery.yml');
-
-  // github.head_ref is a bare branch name, so two forks pushing their own
-  // `main` would share a group and cancel each other; github.ref is
-  // refs/heads/main for the nightly, a dispatch and a main push alike, so a
-  // ref-keyed group made a dispatch queue behind the nightly and let the next
-  // dispatch discard it while pending.
-  assert.match(
-    workflow,
-    /group: windows-recovery-\$\{\{ github\.event\.pull_request\.number \|\| github\.run_id \}\}/u,
-  );
-  assert.match(workflow, /\n {2}cancel-in-progress: true/u);
-});
-
-test('the recovery lane leaves the suites it executes to the required test lane', () => {
-  const workflow = readWorkflow('windows-recovery.yml');
-  const filtered = new Set(pullRequestPathFilter('windows-recovery.yml'));
-
-  // Derived from the dist paths the steps run, then widened along the workspace
-  // dependency graph the planner selects with. The separator class matches the
-  // backslash form too, because these steps run under pwsh where both are
-  // legal.
-  const executed = [
-    ...new Set(
-      [...workflow.matchAll(/packages[/\\]([^/\\]+)[/\\]dist[/\\]/gu)].map((match) => match[1]),
-    ),
-  ].sort();
-  assert.deepEqual(executed, ['runtime', 'runtime-host', 'storage']);
-
-  // None of that closure belongs in the filter. These suites are ordinary
-  // TypeScript, so `test` runs them on Linux on every pull request and fails
-  // first; naming their sources here only bought a second, slower red. Listing
-  // one again would put this lane back on most merges, so it fails here.
-  const closure = dependencyClosure(executed.map((workspace) => `packages/${workspace}`));
-  assert.ok(closure.includes('packages/core'), 'dependency closure must reach core');
-  for (const dir of closure) {
-    for (const entry of [`${dir}/src/**`, `${dir}/tsconfig.json`, `${dir}/package.json`]) {
-      assert.ok(!filtered.has(entry), `${entry} belongs to the required test lane`);
-    }
-  }
-
-  // What the Windows runner proves instead is that the suites still build and
-  // run here at all, which is why the unconditional install and build steps stay
-  // unconditional even though nothing in the filter names a workspace.
-  assert.match(workflow, /\n {6}- name: Install dependencies\n {8}run: npm\.cmd ci\n/u);
-  assert.match(workflow, /\n {8}run: npm\.cmd run build:test\n/u);
-});
-
-test('the recovery lane filter follows the postinstall launcher chain', () => {
-  const filtered = new Set(pullRequestPathFilter('windows-recovery.yml'));
-  const manifest = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8'));
-  // Derived from postinstall itself, then one hop into whatever those entry
-  // points launch, because a launcher the filter cannot see still decides what
-  // `npm ci` produces on Windows. A restated list missed exactly that hop.
-  const entrypoints = [...manifest.scripts.postinstall.matchAll(/node (scripts\/[\w.-]+)/gu)].map(
-    (match) => match[1],
-  );
-  assert.ok(entrypoints.length > 0, 'postinstall runs no script');
-
-  for (const entrypoint of entrypoints) {
-    assert.ok(filtered.has(entrypoint), entrypoint);
-    const source = readFileSync(new URL(`../${entrypoint}`, import.meta.url), 'utf8');
-    for (const launched of source.matchAll(/new URL\('\.\/([\w.-]+)'/gu)) {
-      assert.ok(filtered.has(`scripts/${launched[1]}`), `${entrypoint} launches ${launched[1]}`);
-    }
-  }
-});
-
-test('the recovery filter is exactly the Windows-branching closure of its tests', async () => {
-  const workflow = readWorkflow('windows-recovery.yml');
-  const filtered = pullRequestPathFilter('windows-recovery.yml').filter((path) =>
-    path.startsWith('packages/'),
-  );
-
-  // Derived from the dist tests the steps actually execute, mapped back to
-  // source. A suite added to a step joins this set without anyone remembering
-  // to widen the filter.
-  const entrypoints = [
-    ...new Set(
-      [...workflow.matchAll(/packages\/([\w-]+)\/dist\/__tests__\/([\w.-]+)\.test\.js/gu)].map(
-        ([, workspace, name]) => `packages/${workspace}/src/__tests__/${name}.test.ts`,
-      ),
-    ),
-  ].sort();
-  assert.ok(entrypoints.length > 0, 'no executed suite was recognised');
-  for (const entrypoint of entrypoints) {
-    assert.ok(existsSync(new URL(`../${entrypoint}`, import.meta.url)), entrypoint);
-  }
-
-  // Set equality, not containment, and in both directions on purpose. A subset
-  // check cannot see an omission, which is how `stable-storage.ts` — reached
-  // through the two listed lock authorities — sat outside a filter that was
-  // supposed to cover exactly it. A superset check cannot see a file that
-  // stopped branching and now schedules a Windows runner for nothing.
-  const closure = await collectWorkspaceSourceClosure(
-    entrypoints,
-    fileURLToPath(new URL('..', import.meta.url)),
-  );
-  const windowsBranching = closure
-    .filter((path) =>
-      readFileSync(new URL(`../${path}`, import.meta.url), 'utf8').includes('win32'),
-    )
-    .sort();
-
-  assert.deepEqual(filtered.sort(), windowsBranching);
-});
-
-test('the recovery lane filters pull requests by what only Windows can prove', () => {
-  const filtered = new Set(pullRequestPathFilter('windows-recovery.yml'));
-
-  // What is left after the workspace sources came out: how `npm.cmd ci` resolves
-  // and what it produces on Windows, what `npm.cmd run build:test` cleans up
-  // there, and a PowerShell script this lane is the only caller of. Each of
-  // these can be green on Linux and red here, which is the whole test for
-  // membership in this list.
-  for (const path of [
-    'package-lock.json',
-    'patches/**',
-    'scripts/apply-dependency-patches.mjs',
-    'scripts/install-electron-with-retry.mjs',
-    'scripts/run-electron-installer.cjs',
-    'scripts/clean-build.mjs',
-    'scripts/clean-paths.mjs',
-    'scripts/windows-runtime-host-local-ipc-trust.ps1',
-    '.github/workflows/windows-recovery.yml',
-  ]) {
-    assert.ok(filtered.has(path), path);
-  }
-});
-
-test('the sandbox lane pairs its path filter with a nightly run', () => {
-  const workflow = readWorkflow('windows-sandbox-w0.yml');
-
-  // The filter is a pre-filter, not the lane's import closure, so dropping the
-  // schedule would silently lose every transitive edit it cannot match, and
-  // dropping the filter would put the whole runtime back on pull requests.
-  assert.match(workflow, /\n {2}pull_request:\n {4}paths:/u);
-  assert.match(workflow, /\n {2}schedule:/u);
-});
-
-test('the packaged Windows gate owns Runtime Host candidate election changes', () => {
-  const workflow = readWorkflow('release-windows-check.yml');
-
-  assert.match(workflow, /'packages\/runtime-host\/src\/client\/connect-or-spawn\.ts'/u);
-  assert.match(workflow, /'packages\/runtime-host\/src\/client\/launcher\.ts'/u);
-});
-
-test('the packaged Windows gate triggers on release orchestration changes', () => {
-  const workflow = readWorkflow('release-windows-check.yml');
-
-  assert.match(workflow, /'\.github\/workflows\/release\.yml'/u);
-});
-
-test('the packaged Windows gate workflow is itself a release-contract input', () => {
-  assert.equal(
-    planTests(['.github/workflows/release-windows-check.yml'], { graph }).releaseContract,
-    true,
-  );
-  assert.match(
-    readWorkflow('release-windows-check.yml'),
-    /'\.github\/workflows\/release-windows-check\.yml'/u,
-  );
-});
-
-test('the packaged Windows gate triggers on packaged sandbox inputs', () => {
-  const workflow = readWorkflow('release-windows-check.yml');
-
-  for (const path of [
-    'apps/desktop/scripts/copy-runtime-filesystem-worker.mjs',
-    'packages/runtime/scripts/build-filesystem-worker.mjs',
-    'packages/runtime/src/filesystem-worker/**',
-    'packages/runtime/src/sandbox/**',
-    'packages/runtime/src/path-containment.ts',
-    'packages/runtime/src/sandbox-boundary-path.ts',
-    'packages/core/src/permission-profile.ts',
-    'packages/core/src/permission-profile-compiler.ts',
-  ]) {
-    assert.ok(workflow.includes(`      - '${path}'`), path);
-  }
-});
-
-test('pull-request and release lanes share the packaged sandbox lifecycle verifier', () => {
-  for (const name of ['release-windows-check.yml', 'release.yml']) {
-    assert.match(readWorkflow(name), /npm run verify:windows-x64/u, name);
-  }
-
-  const verifier = readFileSync(new URL('verify-windows-x64.mjs', import.meta.url), 'utf8');
-  assert.match(
-    verifier,
-    /await verifyPackagedWindowsSandboxLifecycle\(sandboxExecutable, \{ run \}\)/u,
-  );
-});
-
-test('the Gitoxide gate owns repository admission changes', () => {
-  const workflow = readWorkflow('gitoxide-helper-admission.yml');
-
-  assert.match(
-    workflow,
-    /'packages\/runtime-host\/src\/server\/gitoxide-repository-admission-authority-internal\.ts'/u,
-  );
-  assert.match(
-    workflow,
-    /'packages\/runtime-host\/src\/__tests__\/gitoxide-repository-admission-authority-internal\.test\.ts'/u,
-  );
-});
-
-test('specialized platform workflows stay reachable without pull requests', () => {
-  const cli = readWorkflow('cli-package-validation.yml');
-  const baseline = readWorkflow('windows-baseline.yml');
-  const recovery = readWorkflow('windows-recovery.yml');
-
-  for (const workflow of [cli, baseline, recovery]) {
-    assert.match(workflow, /\n  workflow_dispatch:/u);
-  }
-  assert.match(cli, /\n  workflow_call:/u);
-  assert.match(baseline, /\n  schedule:/u);
-});
-
-test('Windows recovery executes the exact managed dependency ADS regressions', () => {
-  const recovery = readWorkflow('windows-recovery.yml');
-
-  assert.match(recovery, /name: Verify managed dependency alternate streams/u);
-  assert.match(recovery, /--test-name-pattern="NTFS alternate stream"/u);
-  assert.match(
-    recovery,
-    /packages\/storage\/dist\/__tests__\/managed-dependency-environment\.test\.js/u,
-  );
-  assert.match(recovery, /# tests 3/u);
-  assert.match(recovery, /# pass 3/u);
-  assert.match(recovery, /# skipped 0/u);
-});
-
-test('Windows recovery executes the root initialization replacement race', () => {
-  const recovery = readWorkflow('windows-recovery.yml');
-
-  assert.match(recovery, /name: Verify root initialization replacement race/u);
-  assert.match(
-    recovery,
-    /--test-name-pattern="rejects replacement before opening the temporary marker"/u,
-  );
-  assert.match(recovery, /packages\/storage\/dist\/__tests__\/root-authority\.test\.js/u);
-  assert.match(recovery, /# tests 1/u);
-  assert.match(recovery, /# pass 1/u);
-  assert.match(recovery, /# skipped 0/u);
-});
-
-test('Windows recovery executes the complete Skill catalog suite', () => {
-  const recovery = readWorkflow('windows-recovery.yml');
-
-  assert.match(recovery, /skill-catalog-coordinator\.test\.js/u);
-  assert.match(recovery, /skill-catalog-protocol\.test\.js/u);
-  assert.match(recovery, /skill-catalog-repository\.test\.js/u);
-  assert.match(recovery, /skill-catalog-transaction\.test\.js/u);
-  assert.match(recovery, /skill-catalog-two-client-uds\.test\.js/u);
-  assert.match(recovery, /# tests 91/u);
-  assert.match(recovery, /# pass 91/u);
-  assert.match(recovery, /# skipped 0/u);
-});
-
-test('workflows never persist the job credential into the checkout', () => {
-  for (const name of readdirSync(WORKFLOW_DIR)) {
-    for (const step of checkoutSteps(name)) {
-      assert.match(step, /persist-credentials: false/u, `${name}: ${step.trim()}`);
-    }
-  }
-});
-
-test('a pull_request_target checkout is pinned to the trusted base commit', () => {
-  // This event hands the job a writable token while the pull request is fork
-  // controlled, so what gets checked out is what decides whether that token can
-  // reach author-supplied code. `github.sha` is the base branch commit here;
-  // `head.sha` and a bare checkout under a merge-ref event are both the pull
-  // request's own tree. Nothing else in CI would notice that edit, which is why
-  // the rule lives here rather than in a comment.
-  for (const name of readdirSync(WORKFLOW_DIR)) {
-    if (!/\bpull_request_target\b/u.test(triggerBlock(name))) continue;
-
-    for (const step of checkoutSteps(name)) {
-      assert.match(step, /\n\s+ref: \$\{\{ github\.sha \}\}\n/u, `${name}: ${step.trim()}`);
-    }
-  }
-});
-
-test('core CI runs the live Eval proxy lifecycle when Eval is selected', () => {
-  const workflow = readWorkflow('ci.yml');
-  const evalPackage = JSON.parse(
-    readFileSync(new URL('../packages/eval/package.json', import.meta.url), 'utf8'),
-  );
-
-  assert.match(
-    workflow,
-    /if: contains\(steps\.plan\.outputs\.standard_workspaces, 'packages\/eval'\)/u,
-  );
-  assert.match(workflow, /MAKA_EVAL_EGRESS_PROXY_TEST: '1'/u);
-  assert.match(workflow, /docker build[\s\S]*maka-eval-egress-proxy:12\.2\.3/u);
-  assert.match(workflow, /npm --workspace @maka\/eval run test:egress-proxy:live/u);
-  assert.equal(
-    evalPackage.scripts['test:egress-proxy:live'],
-    'python3 harbor/test_egress_filter_live.py',
-  );
-  assert.doesNotMatch(evalPackage.scripts['test:dist'], /test_egress_filter_live\.py/u);
-});
-
-const WORKFLOW_DIR = new URL('../.github/workflows/', import.meta.url);
-
-/**
- * Reads the `paths` list belonging to a workflow's `pull_request` trigger.
- * Anchoring to the trigger, instead of matching entry text anywhere in the
- * file, is what makes the filter assertions fail when entries move under
- * `paths-ignore`, under another trigger, or out of `on:` altogether.
- */
-function pullRequestPathFilter(name) {
-  // Reads the `on:` block with comments already stripped, so a comment between
-  // the trigger and its list cannot end the scan, and accepts the quoting and
-  // spacing YAML allows, so a legal rewrite reports the entries it really has
-  // instead of an empty list that reads as a missing filter.
-  const lines = triggerBlock(name).split('\n');
-  const start = lines.findIndex((line) => /^ {2}pull_request:\s*$/u.test(line));
-  assert.ok(start >= 0, `${name}: no pull_request trigger`);
-
-  const paths = [];
-  let inPaths = false;
-  for (const line of lines.slice(start + 1)) {
-    if (line.trim() === '') continue;
-    if (/^ {0,2}\S/u.test(line)) break;
-    if (/^ {4}\S/u.test(line)) {
-      inPaths = /^ {4}paths:\s*$/u.test(line);
-      continue;
-    }
-    const entry = inPaths ? /^\s+-\s+['"]?(.+?)['"]?\s*$/u.exec(line) : null;
-    if (entry) paths.push(entry[1]);
-  }
-  return paths;
-}
-
-/**
- * Workspace dirs `seeds` depend on, transitively, read off the same graph the
- * planner selects with rather than a second definition of the same edges. The
- * graph stores dependents, so a dependency is any dir listing one of ours.
- */
-function dependencyClosure(seeds) {
-  const graph = loadWorkspaceGraph();
-  const selected = new Set(seeds);
-  const pending = [...seeds];
-  while (pending.length > 0) {
-    const dir = pending.shift();
-    for (const [dependency, dependents] of graph.dependents) {
-      if (!dependents.has(dir) || selected.has(dependency)) continue;
-      selected.add(dependency);
-      pending.push(dependency);
-    }
-  }
-  return [...selected].sort();
-}
-
-function readWorkflow(name) {
-  return readFileSync(new URL(name, WORKFLOW_DIR), 'utf8');
-}
-
-/**
- * Reads the `on:` block only, so a workflow cannot escape a trigger contract by
- * writing `on: [pull_request]`, and prose elsewhere in the file cannot fake one.
- */
-function triggerBlock(name) {
-  const withoutComments = readWorkflow(name).replaceAll(/^[ \t]*#.*$/gmu, '');
-
-  return withoutComments.match(/^on:(.*(?:\n(?![^\s#]).*)*)/mu)?.[1] ?? '';
-}
-
-function hasPullRequestTrigger(name) {
-  const block = triggerBlock(name);
-  if (!/\bpull_request(_target)?\b/u.test(block)) return false;
-
-  // Event-only maintenance workflows may listen for a lifecycle action without
-  // becoming a normal pull-request validation lane. They do not belong in the
-  // scarce-runner allowlist or its timeout tier.
-  return !/pull_request(?:_target)?:\s*\n\s+types:\s*\[\s*reopened\s*\]/u.test(block);
-}
-
-function hasPullRequestGate(name) {
-  const block = triggerBlock(name);
-  return /^\s*pull_request:\s*$/mu.test(block) && hasPullRequestTrigger(name);
-}
-
-/**
- * Slices each checkout step from its `uses:` line to the next step, so the
- * assertion is per checkout: a bare one cannot be balanced out by a sibling
- * step that opts out, or by the string appearing in a comment.
- */
-function checkoutSteps(name) {
-  const withoutComments = readWorkflow(name).replaceAll(/^[ \t]*#.*$/gmu, '');
-
-  return (
-    withoutComments.match(/^[ \t]*- uses: actions\/checkout@.*\n(?:(?![ \t]*- )[ \t]+.*\n)*/gmu) ??
-    []
-  );
-}
diff --git a/scripts/ci-test-plan.test.mjs b/scripts/ci-workflow-policy.test.mjs
similarity index 62%
copy from scripts/ci-test-plan.test.mjs
copy to scripts/ci-workflow-policy.test.mjs
index fefd9f2841..452be63866 100644
--- a/scripts/ci-test-plan.test.mjs
+++ b/scripts/ci-workflow-policy.test.mjs
@@ -17,392 +17,24 @@
  * under the License.
  */
 
+/**
+ * What the workflows themselves must say: which triggers a lane carries, which
+ * steps a selection gates, and where a lane's path filter has to come from.
+ * Behaviour of the planner these assertions refer to lives in
+ * `ci-test-plan.test.mjs`.
+ *
+ * This suite runs before `npm ci` installs anything, so it may import only
+ * `node:` builtins and repository modules that do the same. The last test in
+ * this file asserts exactly that, for every suite the install-free steps run.
+ */
 import assert from 'node:assert/strict';
 import { existsSync, readdirSync, readFileSync } from 'node:fs';
 import test from 'node:test';
-import { fileURLToPath } from 'node:url';
-
-import {
-  changedFilesBetween,
-  formatGitHubOutputs,
-  loadWorkspaceGraph,
-  planTests,
-  requiresHeavyValidation,
-} from './ci-test-plan.mjs';
-import { collectWorkspaceSourceClosure } from './windows-package-source-closure.mjs';
-
-const dirs = [
-  'packages/core',
-  'packages/storage',
-  'packages/runtime',
-  'packages/runtime-host',
-  'packages/cli',
-  'packages/ui',
-  'apps/desktop',
-];
-
-const graph = {
-  dirs,
-  dependents: new Map([
-    ['packages/core', new Set(['packages/storage', 'packages/runtime'])],
-    ['packages/storage', new Set(['packages/runtime', 'packages/runtime-host'])],
-    ['packages/runtime', new Set(['packages/runtime-host', 'packages/cli', 'apps/desktop'])],
-    ['packages/runtime-host', new Set(['packages/cli', 'apps/desktop'])],
-    ['packages/cli', new Set()],
-    ['packages/ui', new Set(['apps/desktop'])],
-    ['apps/desktop', new Set()],
-  ]),
-  testDirs: new Set(dirs),
-};
-
-test('documentation-only changes do not select code validation', () => {
-  const plan = planTests(['docs/ci.md'], { graph });
-
-  assert.equal(plan.code, false);
-  assert.equal(plan.asfSource, false);
-  assert.equal(plan.astryxSurface, false);
-  assert.equal(requiresHeavyValidation(plan), false);
-  assert.deepEqual(plan.workspaces, []);
-});
-
-test('documentation inside workspaces does not select heavy validation', () => {
-  for (const path of ['packages/runtime/README.md', 'apps/desktop/README.md']) {
-    const plan = planTests([path], { graph });
-
-    assert.equal(plan.code, false, path);
-    assert.equal(requiresHeavyValidation(plan), false, path);
-    assert.deepEqual(plan.workspaces, [], path);
-  }
-});
-
-test('mixed documentation and code changes still select heavy validation', () => {
-  const plan = planTests(['README.md', 'packages/core/src/index.ts'], { graph });
-
-  assert.equal(plan.code, true);
-  assert.equal(requiresHeavyValidation(plan), true);
-});
-
-test('documentation with a dedicated contract still selects heavy validation', () => {
-  for (const path of [
-    'LICENSE',
-    'docs/astryx-surface-file-inventory.md',
-    'apps/desktop/resources/licenses/renderer/SIMPLE_ICONS_LICENSE.md',
-  ]) {
-    const plan = planTests([path], { graph });
-
-    assert.equal(plan.code, false, path);
-    assert.equal(requiresHeavyValidation(plan), true, path);
-  }
-});
-
-test('changed files are derived from the PR merge base', () => {
-  const calls = [];
-  const exec = (_command, args) => {
-    calls.push(args);
-    if (args[0] === 'merge-base') return 'fork-point\n';
-    if (args.at(-2) === 'fork-point') return 'packages/runtime/README.md\n';
-    if (args.at(-2) === 'main-now') {
-      return 'packages/core/src/main-only.ts\npackages/runtime/README.md\n';
-    }
-    throw new Error(`Unexpected git invocation: ${args.join(' ')}`);
-  };
 
-  const changedFiles = changedFilesBetween('main-now', 'pr-head', exec);
-
-  assert.deepEqual(changedFiles, ['packages/runtime/README.md']);
-  assert.equal(requiresHeavyValidation(planTests(changedFiles, { graph })), false);
-  assert.deepEqual(calls, [
-    ['merge-base', 'main-now', 'pr-head'],
-    ['diff', '--no-renames', '--name-only', '--diff-filter=ACMRDT', 'fork-point', 'pr-head'],
-  ]);
-});
-
-test('type changes remain in the PR-owned delta', () => {
-  const exec = (_command, args) => {
-    if (args[0] === 'merge-base') return 'fork-point\n';
-    assert.ok(args.includes('--diff-filter=ACMRDT'));
-    return 'packages/runtime/src/runtime.ts\n';
-  };
-
-  const changedFiles = changedFilesBetween('main-now', 'pr-head', exec);
-
-  assert.deepEqual(changedFiles, ['packages/runtime/src/runtime.ts']);
-  assert.equal(requiresHeavyValidation(planTests(changedFiles, { graph })), true);
-});
-
-test('the Astryx inventory can run without selecting the code suite', () => {
-  const plan = planTests(['docs/astryx-surface-file-inventory.md'], { graph });
-
-  assert.equal(plan.code, false);
-  assert.equal(plan.astryxSurface, true);
-});
-
-test('desktop renderer changes retain Electron and Storybook coverage', () => {
-  const plan = planTests(['apps/desktop/src/renderer/app.tsx'], { graph });
-
-  assert.equal(plan.code, true);
-  assert.equal(plan.e2e, true);
-  assert.equal(plan.storybook, true);
-  assert.equal(plan.astryxSurface, true);
-  assert.deepEqual(plan.standardWorkspaces, ['apps/desktop']);
-});
-
-test('Storybook catalog changes avoid real-window E2E and workspace tests', () => {
-  const plan = planTests(['apps/desktop/stories/settings.stories.tsx'], { graph });
-
-  assert.equal(plan.code, true);
-  assert.equal(plan.e2e, false);
-  assert.equal(plan.storybook, true);
-  assert.deepEqual(plan.workspaces, []);
-});
-
-test('AX audit contract test edits avoid the Storybook browser pipeline', () => {
-  const plan = planTests(['scripts/ax-tree-audit.test.mjs'], { graph });
-  assert.equal(plan.storybook, false);
-  assert.equal(plan.e2e, false);
-});
-
-test('runtime changes retain the dedicated Runtime Host lane', () => {
-  const plan = planTests(['packages/runtime/src/runtime.ts'], { graph });
-
-  assert.equal(plan.runtimeHost, true);
-  assert.equal(plan.runtimeSandbox, true);
-  assert.deepEqual(plan.standardWorkspaces, ['packages/runtime', 'packages/cli', 'apps/desktop']);
-});
-
-test('CLI release inputs select installed-package validation', () => {
-  const plan = planTests(['packages/runtime/src/runtime.ts'], { graph });
-
-  assert.equal(plan.cliPackage, true);
-});
-
-test('release metadata selects only the gate that consumes it', () => {
-  for (const path of ['LICENSE', 'NOTICE']) {
-    const plan = planTests([path], { graph });
-    assert.equal(plan.cliPackage, true, path);
-    assert.equal(plan.releaseContract, true, path);
-    assert.equal(plan.asfSource, true, path);
-  }
-});
-
-test('source legal authority and generated provenance select the ASF source gate', () => {
-  for (const path of [
-    'DISCLAIMER-WIP',
-    'biome.jsonc',
-    'patches/node-pty+1.2.0-beta.15.patch',
-    'apps/desktop/src/renderer/assets/provider-brands/example.svg',
-    'apps/desktop/resources/licenses/renderer/SIMPLE_ICONS_LICENSE.md',
-    'packages/eval/harbor/deepseek-harness-profile/cordis.patch.yml',
-    'scripts/model-metadata/models-dev-api.snapshot.json',
-    'scripts/sync-model-metadata.mjs',
-  ]) {
-    assert.equal(planTests([path], { graph }).asfSource, true, path);
-  }
-});
-
-test('release authority changes select their dedicated contract gate', () => {
-  for (const path of [
-    'apps/desktop/src/main/app-update-test-context.ts',
-    'apps/desktop/build/entitlements.mac.plist',
-    'apps/desktop/electron-builder.config.mjs',
-    'apps/desktop/package.json',
-    '.github/workflows/cli-package-validation.yml',
-    '.github/workflows/desktop-nightly.yml',
-    '.github/workflows/npm-publication.yml',
-    '.github/workflows/release-cli-finalize.yml',
-    '.github/workflows/release-cli-stage.yml',
-    '.github/workflows/release.yml',
-    'scripts/package-macos-arm64.mjs',
-    'scripts/package-macos-autoupdate-next.mjs',
-    'scripts/package-macos-arm64-cli.mjs',
-    'scripts/package-windows-x64.mjs',
-    'scripts/prepare-windows-upgrade-baseline.mjs',
-    'scripts/product-release-artifacts.mjs',
-    'scripts/product-release-authority.mjs',
-    'scripts/product-release-authority.test.mjs',
-    'scripts/product-release-identity.mjs',
-    'scripts/product-release-tag.mjs',
-    'scripts/product-release.test.mjs',
-    'scripts/release-eval-smoke-sitecustomize.py',
-    'scripts/release-version.mjs',
-    'scripts/release-cli-publication.test.mjs',
-    'scripts/verify-macos-arm64-cli.mjs',
-    'scripts/verify-macos-arm64-dmg.mjs',
-    'scripts/verify-macos-autoupdate.mjs',
-    'scripts/desktop-update-contract.mjs',
-    'scripts/verify-packaged-app.mjs',
-    'scripts/verify-windows-x64.mjs',
-    'scripts/windows-upgrade-baseline.json',
-    'scripts/windows-package-source-closure.mjs',
-    'scripts/windows-package-source-closure.test.mjs',
-  ]) {
-    assert.equal(planTests([path], { graph }).releaseContract, true, path);
-  }
-  assert.equal(planTests(['.github/RELEASE_CHECKLIST.md'], { graph }).releaseContract, false);
-});
-
-// Derived from the gate scripts themselves, because the sets above are hand
-// maintained and drift silently in both directions: a test the gate runs but
-// no lane selects can be edited green, and a listed path that no longer exists
-// is dead weight nothing reports. Both had happened — three of the release
-// gate's own tests reached no lane, and the set named a
-// `prepare-windows-upgrade-baseline.test.mjs` that never existed.
-test('every test a gate script runs reaches a lane that runs that gate', () => {
-  const { scripts } = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8'));
-  const lanesByTest = new Map();
-  for (const [script, lane] of [
-    ['check:release', 'releaseContract'],
-    ['check:asf-source', 'asfSource'],
-  ]) {
-    for (const file of scripts[script].match(/scripts\/[\w.-]+\.test\.mjs/gu) ?? []) {
-      lanesByTest.set(file, (lanesByTest.get(file) ?? new Set()).add(lane));
-    }
-  }
-  assert.ok(lanesByTest.size > 0, 'no gate script names a test file');
-
-  // A test two gates share needs only one of them: either run executes it.
-  for (const [file, lanes] of lanesByTest) {
-    const plan = planTests([file], { graph });
-    assert.ok(
-      [...lanes].some((lane) => plan[lane]),
-      `${file} reaches no ${[...lanes].join('/')}`,
-    );
-  }
-});
-
-// The other direction of the same drift. Every literal path in the planner is
-// matched against a changed file, so one that no longer exists can never match
-// and nothing reports it: the phantom baseline test sat here for a month, and
-// `agent-run-store.test.ts` stayed in the storage stress set for a month after
-// #1994 deleted it.
-test('the planner names no path that no longer exists', () => {
-  const source = readFileSync(new URL('ci-test-plan.mjs', import.meta.url), 'utf8');
-  const paths = [...source.matchAll(/^ {2}'([\w.-]+(?:\/[\w.-]+)+)',$/gmu)].map(([, path]) => path);
-  assert.ok(paths.length > 0, 'the planner names no paths');
-
-  for (const path of paths) {
-    assert.ok(existsSync(new URL(`../${path}`, import.meta.url)), path);
-  }
-});
-
-test('Product Nightly authority changes select the release contract gate', () => {
-  for (const path of [
-    '.github/workflows/desktop-nightly.yml',
-    '.github/workflows/npm-publication.yml',
-    'scripts/desktop-nightly.mjs',
-    'scripts/desktop-nightly.test.mjs',
-    'scripts/desktop-nightly-stage.test.mjs',
-    'scripts/desktop-nightly-workflow-policy.test.mjs',
-    'scripts/product-nightly.mjs',
-    'scripts/product-nightly.test.mjs',
-  ]) {
-    assert.equal(planTests([path], { graph }).releaseContract, true, path);
-  }
-});
-
-// Both notices are committed generator output. A hand edit or a merge-conflict
-// resolution can corrupt either one, and `check:release` is what regenerates
-// and diffs them, so both must reach that gate — the desktop notice lives
-// outside `packages/cli/**` and would otherwise reach no gate at all.
-test('both committed third-party notices reach the release gate', () => {
-  for (const path of [
-    'apps/desktop/resources/licenses/npm/THIRD_PARTY_NOTICES.txt',
-    'packages/cli/THIRD_PARTY_NOTICES.txt',
-  ]) {
-    assert.equal(planTests([path], { graph }).releaseContract, true, path);
-  }
-});
-
-// The test only reads the generator, so it belongs to the release contract and
-// not to the CLI package gate, whose tarball build and install smoke prove
-// nothing about a test-only edit.
-test('the notice regression test selects the release gate alone', () => {
-  const plan = planTests(['scripts/generate-third-party-notices.test.mjs'], { graph });
-  assert.equal(plan.releaseContract, true);
-  assert.equal(plan.cliPackage, false);
-});
-
-test('ASF source authority changes select their dedicated gate', () => {
-  for (const path of [
-    '.gitattributes',
-    '.github/workflows/asf-source-candidate.yml',
-    'docs/code-origin-audit.md',
-    'scripts/asf-source-release.mjs',
-    'scripts/asf-source-release.test.mjs',
-  ]) {
-    assert.equal(planTests([path], { graph }).asfSource, true, path);
-  }
-  assert.equal(planTests(['.github/ASF_SOURCE_RELEASE.md'], { graph }).asfSource, false);
-  assert.equal(planTests(['scripts/audit-alignment.mjs'], { graph }).asfSource, false);
-});
-
-test('shared CLI validation changes select installed-package validation', () => {
-  const plan = planTests(['.github/workflows/cli-package-validation.yml'], { graph });
-
-  assert.equal(plan.cliPackage, true);
-});
-
-test('desktop-only changes skip installed-package validation', () => {
-  assert.equal(planTests(['apps/desktop/src/main.ts'], { graph }).cliPackage, false);
-});
-
-test('full selection covers every live surface', () => {
-  const plan = planTests([], { graph, forceFull: true });
-
-  assert.equal(plan.full, true);
-  assert.equal(plan.asfSource, true);
-  assert.equal(plan.cliPackage, true);
-  assert.equal(plan.code, true);
-  assert.equal(plan.e2e, true);
-  assert.equal(plan.storybook, true);
-  assert.equal(plan.runtimeHost, true);
-  assert.equal(plan.releaseContract, true);
-  assert.deepEqual(plan.workspaces, dirs);
-});
-
-test('unknown top-level code fails safe to full selection', () => {
-  assert.equal(planTests(['unknown.config'], { graph }).full, true);
-});
-
-test('full-suite authority files select every surface', () => {
-  for (const path of ['package-lock.json', '.github/workflows/ci.yml']) {
-    assert.equal(planTests([path], { graph }).full, true, path);
-  }
-});
-
-// The SessionTodo cutover (#4351) retired an operation and stranded every
-// workspace holding a credential issued before it (#4420). It changed the
-// vocabulary, not the decoders — so a trigger listing only decoders stays green
-// on the exact change shape this guard exists to catch.
-test('retiring an operation selects the released forward roll', () => {
-  const plan = planTests(
-    [
-      'packages/runtime-host/src/protocol/operations.ts',
-      'apps/desktop/src/renderer/features/workbar/tools/tasks/use-session-todo.ts',
-    ],
-    { graph },
-  );
-
-  assert.equal(plan.stateRootCompat, true);
-  assert.equal(plan.full, false);
-});
-
-test('a durable-state decoder selects the released forward roll', () => {
-  const plan = planTests(['packages/runtime-host/src/server/access-credential-store.ts'], {
-    graph,
-  });
-
-  assert.equal(plan.stateRootCompat, true);
-});
-
-test('ordinary changes do not pay for the released forward roll', () => {
-  const plan = planTests(['apps/desktop/src/renderer/features/workbar/ports.ts'], { graph });
-
-  assert.equal(plan.stateRootCompat, false);
-});
+import { formatGitHubOutputs, loadWorkspaceGraph, planTests } from './ci-test-plan.mjs';
 
 test('GitHub output matches the selections consumed by CI', () => {
-  const output = formatGitHubOutputs(planTests([], { graph, forceFull: true }));
+  const output = formatGitHubOutputs(planTests([], { forceFull: true }));
   const outputKeys = new Set(output.split('\n').map((line) => line.split('=', 1)[0]));
   const workflow = readWorkflow('ci.yml');
 
@@ -493,19 +125,6 @@ test('contract checks run before dependency setup and can fail the job', () => {
   }
 });
 
-/** Every file the two app-icon drift tests read. */
-const APP_ICON_INPUTS = [
-  'apps/desktop/assets/app-icons/sky.png',
-  // Read by path in the drift test, so pointing it at a different icon that
-  // happens to exist would otherwise package cleanly with the assertion unrun.
-  'apps/desktop/electron-builder.config.mjs',
-  'packages/core/src/settings.ts',
-  'scripts/generate-app-icons.py',
-  'scripts/generate-app-icons.test.mjs',
-  'scripts/verify-packaged-app.mjs',
-  'scripts/verify-packaged-app-icons.test.mjs',
-];
-
 test('every selection that gates an installed step is one heavy validation covers', () => {
   const workflow = readWorkflow('ci.yml');
 
@@ -553,7 +172,7 @@ test('the app icon gate selects every file its own tests open', () => {
   assert.ok(suites.length > 0);
 
   for (const suite of suites) {
-    assert.equal(planTests([suite], { graph }).appIcons, true, suite);
+    assert.equal(planTests([suite]).appIcons, true, suite);
     const source = readFileSync(new URL(`../${suite}`, import.meta.url), 'utf8');
 
     // Every repository path those suites name, however they reach it: a
@@ -568,37 +187,16 @@ test('the app icon gate selects every file its own tests open', () => {
       // A trailing slash names a directory, so probe inside it as well: the
       // artwork is selected by prefix rather than file by file.
       const path = absolute.slice(root.length).replace(/\/$/u, '');
-      const selects = [path, `${path}/probe`].some(
-        (candidate) => planTests([candidate], { graph }).appIcons,
+      const selecting = [path, `${path}/probe`].find(
+        (candidate) => planTests([candidate]).appIcons,
       );
-      assert.ok(selects, `${suite} reads ${path}`);
-    }
-  }
-});
+      assert.ok(selecting, `${suite} reads ${path}`);
 
-test('app icon drift selects the artwork and whatever derives or names it', () => {
-  for (const path of APP_ICON_INPUTS) {
-    assert.equal(planTests([path], { graph }).appIcons, true, path);
-  }
-
-  // Regenerating the artwork costs about a minute. Ordinary product code is
-  // exactly what must stop paying it.
-  for (const path of [
-    'apps/desktop/src/renderer/app-shell.tsx',
-    'packages/core/src/artifacts.ts',
-    'packages/runtime/src/edit-replace.ts',
-  ]) {
-    assert.equal(planTests([path], { graph }).appIcons, false, path);
-  }
-});
-
-test('an app icon selection always brings the build those tests need', () => {
-  // `generate-app-icons.test.mjs` imports `APP_ICONS` from built `@maka/core`
-  // and the step runs after Build, which gates on `code`. Every input above
-  // lives in a workspace or under `scripts/`, so `code` follows rather than
-  // needing its own gate — an entry that broke that would fail here.
-  for (const path of APP_ICON_INPUTS) {
-    assert.equal(planTests([path], { graph }).code, true, path);
+      // The step runs after Build and `generate-app-icons.test.mjs` imports
+      // `APP_ICONS` from built `@maka/core`, so an input that selected the
+      // drift check without selecting the build would run against no build.
+      assert.equal(planTests([selecting]).code, true, `${selecting} skips the build`);
+    }
   }
 });
 
@@ -847,45 +445,6 @@ test('the recovery lane filter follows the postinstall launcher chain', () => {
   }
 });
 
-test('the recovery filter is exactly the Windows-branching closure of its tests', async () => {
-  const workflow = readWorkflow('windows-recovery.yml');
-  const filtered = pullRequestPathFilter('windows-recovery.yml').filter((path) =>
-    path.startsWith('packages/'),
-  );
-
-  // Derived from the dist tests the steps actually execute, mapped back to
-  // source. A suite added to a step joins this set without anyone remembering
-  // to widen the filter.
-  const entrypoints = [
-    ...new Set(
-      [...workflow.matchAll(/packages\/([\w-]+)\/dist\/__tests__\/([\w.-]+)\.test\.js/gu)].map(
-        ([, workspace, name]) => `packages/${workspace}/src/__tests__/${name}.test.ts`,
-      ),
-    ),
-  ].sort();
-  assert.ok(entrypoints.length > 0, 'no executed suite was recognised');
-  for (const entrypoint of entrypoints) {
-    assert.ok(existsSync(new URL(`../${entrypoint}`, import.meta.url)), entrypoint);
-  }
-
-  // Set equality, not containment, and in both directions on purpose. A subset
-  // check cannot see an omission, which is how `stable-storage.ts` — reached
-  // through the two listed lock authorities — sat outside a filter that was
-  // supposed to cover exactly it. A superset check cannot see a file that
-  // stopped branching and now schedules a Windows runner for nothing.
-  const closure = await collectWorkspaceSourceClosure(
-    entrypoints,
-    fileURLToPath(new URL('..', import.meta.url)),
-  );
-  const windowsBranching = closure
-    .filter((path) =>
-      readFileSync(new URL(`../${path}`, import.meta.url), 'utf8').includes('win32'),
-    )
-    .sort();
-
-  assert.deepEqual(filtered.sort(), windowsBranching);
-});
-
 test('the recovery lane filters pull requests by what only Windows can prove', () => {
   const filtered = new Set(pullRequestPathFilter('windows-recovery.yml'));
 
@@ -933,10 +492,7 @@ test('the packaged Windows gate triggers on release orchestration changes', () =
 });
 
 test('the packaged Windows gate workflow is itself a release-contract input', () => {
-  assert.equal(
-    planTests(['.github/workflows/release-windows-check.yml'], { graph }).releaseContract,
-    true,
-  );
+  assert.equal(planTests(['.github/workflows/release-windows-check.yml']).releaseContract, true);
   assert.match(
     readWorkflow('release-windows-check.yml'),
     /'\.github\/workflows\/release-windows-check\.yml'/u,
@@ -1082,6 +638,48 @@ test('core CI runs the live Eval proxy lifecycle when Eval is selected', () => {
   assert.doesNotMatch(evalPackage.scripts['test:dist'], /test_egress_filter_live\.py/u);
 });
 
+test('every suite that runs before dependency setup imports only node builtins', () => {
+  // The steps above `setup-node` run against a bare checkout, so a suite there
+  // that imports a devDependency throws `ERR_MODULE_NOT_FOUND` and turns the
+  // one required context red on every pull request — no merge, anywhere, until
+  // someone notices. Nothing about the file says so, which is how a closure
+  // assertion needing esbuild was very nearly added to one of them.
+  //
+  // Derived from the workflow: whichever suites those steps name are the ones
+  // that carry the constraint, so moving a step below the install lifts it and
+  // adding a step above imposes it, without anyone editing this test.
+  const workflow = readWorkflow('ci.yml');
+  const [installFree] = workflow.split(/\n\s+- uses: actions\/setup-node[^\n]*\n/u);
+  const suites = [
+    ...new Set(
+      [...installFree.matchAll(/(scripts\/[\w.-]+\.test\.mjs)/gu)].map(([, path]) => path),
+    ),
+  ].sort();
+  assert.ok(suites.length > 0, 'no suite runs before dependency setup');
+
+  // The constraint is transitive: a local module may be imported only if it too
+  // stays inside `node:`.
+  const pending = [...suites];
+  const seen = new Set(pending);
+  while (pending.length > 0) {
+    const path = pending.shift();
+    const source = readFileSync(new URL(`../${path}`, import.meta.url), 'utf8');
+    for (const [, specifier] of source.matchAll(/^import[^'"]*['"]([^'"]+)['"]/gmu)) {
+      if (specifier.startsWith('node:')) continue;
+      assert.ok(
+        specifier.startsWith('.'),
+        `${path} imports ${specifier}, which is not installed when it runs`,
+      );
+      const resolved = new URL(specifier, new URL(`../${path}`, import.meta.url)).pathname.slice(
+        new URL('..', import.meta.url).pathname.length,
+      );
+      if (seen.has(resolved)) continue;
+      seen.add(resolved);
+      pending.push(resolved);
+    }
+  }
+});
+
 const WORKFLOW_DIR = new URL('../.github/workflows/', import.meta.url);
 
 /**
diff --git a/scripts/windows-package-source-closure.mjs b/scripts/windows-package-source-closure.mjs
index 68f7f928b3..f006863e85 100644
--- a/scripts/windows-package-source-closure.mjs
+++ b/scripts/windows-package-source-closure.mjs
@@ -65,11 +65,15 @@ export async function collectWorkspaceSourceClosure(entryPoints, repoRoot = defa
 }
 
 export function readWindowsReleasePathPatterns(repoRoot = defaultRepoRoot) {
-  const workflowPath = join(repoRoot, '.github', 'workflows', 'release-windows-check.yml');
+  return readPullRequestPathPatterns('release-windows-check.yml', repoRoot);
+}
+
+export function readPullRequestPathPatterns(workflowName, repoRoot = defaultRepoRoot) {
+  const workflowPath = join(repoRoot, '.github', 'workflows', workflowName);
   const workflow = parseYaml(readFileSync(workflowPath, 'utf8'));
   const paths = workflow?.on?.pull_request?.paths;
   if (!Array.isArray(paths) || !paths.every((path) => typeof path === 'string')) {
-    throw new Error('Release Windows check must declare pull_request.paths as strings.');
+    throw new Error(`${workflowName} must declare pull_request.paths as strings.`);
   }
   return paths;
 }
diff --git a/scripts/windows-package-source-closure.test.mjs b/scripts/windows-package-source-closure.test.mjs
index 9c39cb28fa..a5a1c01cc5 100644
--- a/scripts/windows-package-source-closure.test.mjs
+++ b/scripts/windows-package-source-closure.test.mjs
@@ -18,9 +18,12 @@
  */
 
 import assert from 'node:assert/strict';
+import { existsSync, readFileSync } from 'node:fs';
 import test from 'node:test';
 import {
   collectWindowsPackageSourceClosure,
+  collectWorkspaceSourceClosure,
+  readPullRequestPathPatterns,
   readWindowsReleasePathPatterns,
   windowsReleasePatternCoversSource,
 } from './windows-package-source-closure.mjs';
@@ -51,3 +54,49 @@ test('the Windows package workflow path list has no duplicate entries', () => {
   const patterns = readWindowsReleasePathPatterns();
   assert.equal(new Set(patterns).size, patterns.length);
 });
+
+/**
+ * This belongs beside the other closure contract rather than with the planner
+ * tests, because computing a closure needs esbuild and the planner tests run
+ * before `npm ci` installs it. `.github/workflows/windows-recovery.yml` is in
+ * `RELEASE_CONTRACT_FILES` so that editing the filter selects the gate that
+ * checks it.
+ */
+test('the recovery filter is exactly the Windows-branching closure of its tests', async () => {
+  const workflow = readFileSync(
+    new URL('../.github/workflows/windows-recovery.yml', import.meta.url),
+    'utf8',
+  );
+  const filtered = readPullRequestPathPatterns('windows-recovery.yml')
+    .filter((path) => path.startsWith('packages/'))
+    .sort();
+
+  // Derived from the dist tests the steps actually execute, mapped back to
+  // source. A suite added to a step joins this set without anyone remembering
+  // to widen the filter.
+  const entrypoints = [
+    ...new Set(
+      [...workflow.matchAll(/packages\/([\w-]+)\/dist\/__tests__\/([\w.-]+)\.test\.js/gu)].map(
+        ([, workspace, name]) => `packages/${workspace}/src/__tests__/${name}.test.ts`,
+      ),
+    ),
+  ].sort();
+  assert.ok(entrypoints.length > 0, 'no executed suite was recognised');
+  for (const entrypoint of entrypoints) {
+    assert.ok(existsSync(new URL(`../${entrypoint}`, import.meta.url)), entrypoint);
+  }
+
+  // Set equality, not containment, and in both directions on purpose. A subset
+  // check cannot see an omission, which is how `stable-storage.ts` — reached
+  // through the two listed lock authorities — sat outside a filter that was
+  // supposed to cover exactly it. A superset check cannot see a file that
+  // stopped branching and now schedules a Windows runner for nothing.
+  const closure = await collectWorkspaceSourceClosure(entrypoints);
+  const windowsBranching = closure
+    .filter((path) =>
+      readFileSync(new URL(`../${path}`, import.meta.url), 'utf8').includes('win32'),
+    )
+    .sort();
+
+  assert.deepEqual(filtered, windowsBranching);
+});


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org