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
test(runner): execute the canonical copied runner in controls [C7]
Corey Olsone53eb24bbd8b
diff --git a/bin/run-tests.js b/bin/run-tests.jsindex 565f190a..f17bbf94 100644--- a/bin/run-tests.js+++ b/bin/run-tests.js@@ -16,10 +16,6 @@ import { after, afterEach, beforeEach } from 'node:test';import { Worker } from 'node:worker_threads';import { randomUUID } from 'node:crypto';import { channel } from 'node:diagnostics_channel';-import {- selectedTestResult,- testSelectionPatterns,-} from '../src/test-selection.js';import { AGENT_SHELL_MARKERS, SSH_SHELL_MARKERS } from '../src/person.js';import { isLandingWorkerIdentityTimeout, landingWorkerIdentityQuery, parseLandingWorkerIdentity } from '../src/landing-worker-identity.js';import { foreignNodeOptions, isolateTestMachine } from '../src/test-isolation.js';@@ -307,15 +303,6 @@ function runTests(args, env, concurrency) {} else selectors.push(argument);}const reporter = args.some((argument) => argument === '--test-reporter' || argument.startsWith('--test-reporter='));- const selectionReporter = [];- if (env.PULLBOARD_TEST_SELECTION) {- const reporters = placed.filter(argument => /^--test-reporter(?:=|$)/u.test(argument)).length;- const destinations = placed.filter(argument => /^--test-reporter-destination(?:=|$)/u.test(argument)).length;- if (destinations && destinations !== reporters) throw new Error('each --test-reporter requires a matching --test-reporter-destination');- if (reporter && !destinations) for (let index = 0; index < reporters; index++) selectionReporter.push('--test-reporter-destination=stdout');- if (!reporter && !env.PULLBOARD_TEST_ACTIONS) selectionReporter.push('--test-reporter-destination=stdout');- selectionReporter.push(`--test-reporter=${fileURLToPath(new URL('../src/test-selection.js', import.meta.url))}`, `--test-reporter-destination=${devNull}`);- }const nodeArgs = ['--disable-warning=ExperimentalWarning','--test',@@ -324,7 +311,6 @@ function runTests(args, env, concurrency) {'--import',runner,...placed,- ...selectionReporter,...selectors,];return spawnSync(process.execPath, nodeArgs, { env, stdio: 'inherit' });@@ -908,7 +894,6 @@ async function runLandingTests(args, env, concurrency) {delete options.selectedFiles;const reporterEntries = options.reporters;if (process.env.PULLBOARD_TEST_ACTIONS) reporterEntries.push({ reporter: fileURLToPath(new URL('../src/test-action-reporter.js', import.meta.url)), destination: devNull });- if (testEnv.PULLBOARD_TEST_SELECTION) reporterEntries.push({ reporter: fileURLToPath(new URL('../src/test-selection.js', import.meta.url)), destination: devNull });delete options.reporters;const loadedReporters = [];for (const entry of reporterEntries) {@@ -1399,9 +1384,6 @@ function shardArguments(args) {/** Run tests in the disposable environment, preserving a marker only when a parent holds the slot. */async function executeTests(args, sandbox, gateMarkers, fullSuite, concurrency) {const env = testEnvironment(sandbox, gateMarkers);- const patterns = testSelectionPatterns(args);- if (patterns.length) env.PULLBOARD_TEST_SELECTION = join(sandbox, 'selected-tests.json');- else delete env.PULLBOARD_TEST_SELECTION;// This is an inner file limit; the real machine gate/browser lease remains unchanged.env.PULLBOARD_TEST_BROWSER_RESOURCE = 'test-browser-files:' + randomUUID();env.PULLBOARD_TEST_BROWSER_CAPACITY = String(concurrency.browser);@@ -1433,7 +1415,7 @@ async function executeTests(args, sandbox, gateMarkers, fullSuite, concurrency)? await runLandingTests(selectedArgs, env, concurrency): runTests(selectedArgs, env, concurrency);if (result.error) throw result.error;- return selectedTestResult(result, env.PULLBOARD_TEST_SELECTION, patterns, explicitTestFiles(selectedArgs));+ return result;}/**diff --git a/src/test-selection.js b/src/test-selection.jsdeleted file mode 100644index c9f0c35f..00000000--- a/src/test-selection.js+++ /dev/null@@ -1,39 +0,0 @@-/** Count selected native cases independently of the caller's public reporter [C7,S13]. */-import {- readFileSync,- writeFileSync,-} from 'node:fs';--/** Read the same name-pattern spellings the ordinary runner accepts. */-export function testSelectionPatterns(args) {- const patterns = [];- for (let index = 0; index < args.length && args[index] !== '--'; index++) {- if (!/^--test[-_]name[-_]pattern(?:=|$)/u.test(args[index])) continue;- const value = args[index].includes('=') ? args[index].slice(args[index].indexOf('=') + 1) : args[++index];- if (value !== undefined) patterns.push(value);- }- return patterns;-}--/** A successful Node process cannot turn missing native selection evidence into a green check. */-export function selectedTestResult(result, record, patterns, files) {- if (result.status !== 0 || !patterns.length) return result;- let cases = 0;- try { cases = JSON.parse(readFileSync(record, 'utf8')).cases; }- catch { /* A missing or malformed internal reporter result fails closed. */ }- if (Number.isSafeInteger(cases) && cases > 0) return result;- process.stderr.write(`run-tests: NO_TESTS_MATCHED: patterns ${JSON.stringify(patterns)} selected no proven test case in ${JSON.stringify(files)}\n`);- return { ...result, status: 1 };-}--/** Only child-file summaries contain native case counts; the parent aggregate includes file wrappers. */-export default async function* recordSelectedTests(events) {- let cases = 0;- for await (const event of events) {- if (event.type !== 'test:summary' || !event.data.file) continue;- const count = event.data.counts?.tests;- if (!Number.isSafeInteger(count) || count < 0 || !Number.isSafeInteger(cases + count)) throw new Error('native selected-test counts are unavailable');- cases += count;- }- writeFileSync(process.env.PULLBOARD_TEST_SELECTION, JSON.stringify({ cases }), { mode: 0o600 });-}diff --git a/test/test-runner.test.js b/test/test-runner.test.jsindex 241cbe9b..a102a7c2 100644--- a/test/test-runner.test.js+++ b/test/test-runner.test.js@@ -1,7 +1,7 @@/** Test the CI-like test runner against real Git and PATH behavior [C7, S13]. */import assert from 'node:assert/strict';import { runFixtureExecFile as execFileSync, runFixtureChild as spawnSync } from './fixture-child.js';-import { chmodSync, copyFileSync, cpSync, existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';+import { chmodSync, copyFileSync, cpSync, existsSync, mkdirSync, mkdtempSync, readFileSync, realpathSync, rmSync, writeFileSync } from 'node:fs';import { tmpdir } from 'node:os';import { delimiter, dirname, isAbsolute, join, relative, resolve, sep } from 'node:path';import { fileURLToPath } from 'node:url';@@ -121,7 +121,7 @@ function copyRunnerImports(sourceRoot, root) {/** Build the runner-discovery fixture from a source checkout. */function discoveryFixture(t, sourceRoot = fileURLToPath(new URL('../', import.meta.url))) {- const root = mkdtempSync(join(tmpdir(), 'pullboard-runner-discovery-'));+ const root = realpathSync(mkdtempSync(join(tmpdir(), 'pullboard-runner-discovery-')));t.after(() => rmSync(root, { recursive: true, force: true }));const bin = join(root, 'bin');const tests = join(root, 'test');