Autonomous development for real products. Governed agents build from specs you approve, follow the rules you set, and nothing merges until another agent proves it. Your decisions, judgement and taste are the bar that work must clear. Declare your vision and let agents build it.
JavaScript agentic-codingai-agentsai-governanceautonomous-agentsclaude-codeclicode-reviewcodexcoding-agentsdeveloper-toolsgit-hooksllmlocal-firstmulti-agentsoftware-factoryspec-driven-developmentverificationvibe-coding
fix: keep dispatcher module dependencies static [P3,C7]
Corey Olson8f4c5819009e
diff --git a/bin/run-tests.js b/bin/run-tests.jsindex 4a85e887..8cdf8341 100644--- a/bin/run-tests.js+++ b/bin/run-tests.js@@ -7,6 +7,7 @@import { appendFileSync, chmodSync, existsSync, mkdirSync, mkdtempSync, lstatSync, realpathSync, readFileSync, readdirSync, renameSync, rmSync, writeFileSync } from 'node:fs';import { basename, delimiter, dirname, join, relative, resolve, sep } from 'node:path';import { fileURLToPath } from 'node:url';+import { pathToFileURL } from 'node:url';import { execFile, execFileSync, spawnSync } from 'node:child_process';import {devNull,@@ -268,6 +269,12 @@ function testEnvironment(sandbox, gateMarkers = {}) {return env;}+/** Load a caller-selected reporter at the CLI boundary; the dispatcher imports only its fixed dependencies. */+async function loadCustomReporter(reporter) {+ return (await import(reporter.startsWith('.') || reporter.startsWith('/')+ ? pathToFileURL(resolve(reporter)).href : reporter)).default;+}+/*** Run ordinary mode through admitted files and return its result for faithful exit handling.*@@ -282,7 +289,7 @@ async function runTests(args, env, concurrency) {const { options } = await landingTestOptions(normalized.args, env, normalized.concurrency);if (env.PULLBOARD_TEST_ACTIONS) options.reporters.push({ reporter: fileURLToPath(new URL('../src/test-action-reporter.js', import.meta.url)), destination: devNull });if (env.PULLBOARD_TEST_SELECTION) options.reporters.push({ reporter: fileURLToPath(new URL('../src/test-selection.js', import.meta.url)), destination: devNull });- return reportDispatchedTests(options, env);+ return reportDispatchedTests(options, env, loadCustomReporter);}/** Convert the Node test CLI subset to the supported node:test run() options. */diff --git a/src/test-file-dispatch.js b/src/test-file-dispatch.jsindex 0c1037f5..26d36741 100644--- a/src/test-file-dispatch.js+++ b/src/test-file-dispatch.js@@ -1,6 +1,6 @@/** Parent-controlled file admission and one structured result stream [C7]. *//** @pullboard-module-loads ** */-// Reporter modules are caller-selected, just as in bin/run-tests.js.+// Native test files are caller-selected, just as in bin/run-tests.js.import { spawnSync } from 'node:child_process';import { devNull } from 'node:os';import { fileURLToPath } from 'node:url';@@ -12,6 +12,8 @@ import { availableParallelism } from 'node:os';import { resolve } from 'node:path';import { PassThrough } from 'node:stream';import { run } from 'node:test';+import * as testReporters from 'node:test/reporters';+import { glob } from 'node:fs/promises';import { pathToFileURL } from 'node:url';import { testsNeedBrowser } from './browser-admission.js';import { takeResource } from './resources.js';@@ -215,7 +217,7 @@ export function dispatchTestFiles(options, env) {}/** Native mode keeps running after a test failure and initializes each public/internal reporter exactly once. */-export async function reportDispatchedTests(options, env) {+export async function reportDispatchedTests(options, env, loadCustomReporter) {const controller = new AbortController();const inputs = [];const ends = [];@@ -227,9 +229,7 @@ export async function reportDispatchedTests(options, env) {try {for (const entry of options.reporters) {const builtin = ['tap', 'spec', 'dot', 'junit', 'lcov'].includes(entry.reporter);- const reporter = builtin ? (await import('node:test/reporters'))[entry.reporter]- : (await import(entry.reporter.startsWith('.') || entry.reporter.startsWith('/')- ? pathToFileURL(resolve(entry.reporter)).href : entry.reporter)).default;+ const reporter = builtin ? testReporters[entry.reporter] : await loadCustomReporter(entry.reporter);if (typeof reporter !== 'function') throw new Error(`unknown test reporter: ${entry.reporter}`);const input = new PassThrough({ objectMode: true });const output = input.compose(reporter);@@ -397,7 +397,6 @@ export async function testFileOptions(args, env, concurrency, { runner, optionTaoptions.concurrency = Math.min(concurrency.files, requested);}if (selectors.length) {- const { glob } = await import('node:fs/promises');const files = [];for (const selector of selectors) {if (!/[?*[{]/u.test(selector)) {@@ -424,7 +423,6 @@ export async function testFileOptions(args, env, concurrency, { runner, optionTa}let selectedCandidates = options.files;if (!selectedCandidates) {- const { glob } = await import('node:fs/promises');const defaults = ['**/*.test.{cjs,mjs,js}', '**/*-test.{cjs,mjs,js}', '**/*_test.{cjs,mjs,js}','**/test-*.{cjs,mjs,js}', '**/test.{cjs,mjs,js}', '**/test/**/*.{cjs,mjs,js}'];const matches = new Set();