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(core): place opaque test loaders on runners [C7]
Corey Olson05a69469acf4
diff --git a/docs/api.md b/docs/api.mdindex 58d576d9..74585165 100644--- a/docs/api.md+++ b/docs/api.md@@ -678,7 +678,7 @@ A board-recorded item merge covers its introduced commits only when its exact suThe JSON result includes `verification` entries with PR number, exact head, state, assurance, receipt identities, and any unverified commit IDs. GitHub statuses are shared by PRs with the same head: if an outside or unproven PR shares a commit with a proven proposal, the shared status stays red rather than lending the proposal's green status to it. Publishing observes and posts statuses; it never merges a PR or requires outside authors to use Pullboard.-A Node test that intentionally generates CPU load declares `{ cpuLoad: true }` in its test options. `bin/run-tests.js` discovers declarations without running the module and places the selected files on a registered runner, even with local-first admission or an inherited coordinator lease. While runners are registered it waits for a compatible runner instead of using local or short capacity; browser and GUI requirements still apply. A runner failure never permits this load to fall back locally. With no runners registered it uses the ordinary local admission and prints the reason. Source must be clean and committed for remote execution. Discovery conservatively places the whole selected file, including when a name filter selects only some cases; comments and string/template examples do not declare load. Options that cannot be read statically count as declared load: computed property names, object spreads, opaque option expressions, unresolved test-function uses and unreadable test-context member uses and unresolved CommonJS registration paths require runner placement. Readable direct subtests and ordinary context lifecycle hooks retain their ordinary classification. Discovery never evaluates those expressions. A directly readable literal `cpuLoad: false` remains ordinary work.+A Node test that intentionally generates CPU load declares `{ cpuLoad: true }` in its test options. `bin/run-tests.js` discovers declarations without running the module and places the selected files on a registered runner, even with local-first admission or an inherited coordinator lease. While runners are registered it waits for a compatible runner instead of using local or short capacity; browser and GUI requirements still apply. A runner failure never permits this load to fall back locally. With no runners registered it uses the ordinary local admission and prints the reason. Source must be clean and committed for remote execution. Discovery conservatively places the whole selected file, including when a name filter selects only some cases; comments and string/template examples do not declare load. Options that cannot be read statically count as declared load: computed property names, object spreads, opaque option expressions, unresolved test-function uses and unreadable test-context member uses, unresolved CommonJS registration paths, dynamic imports, executable `eval`/`Function` references and `node:vm`/`node:module` imports require runner placement. Readable direct subtests and ordinary context lifecycle hooks retain their ordinary classification. Discovery never evaluates those expressions. A directly readable literal `cpuLoad: false` remains ordinary work.`pullboard why <file>[:<line>] --json` uses the `why file` catalog shape; this names the file form, not a literal `file` argument. It traces commits on the repository's actual primary branch, then resolves their item trailers, served row IDs and answered decisions in one board query. The legacy `why <id>` shape is unchanged. Answered decisions carry their recorded origin, statement, rationale, decider and relayer; absent historical provenance remains `unknown`. Row and item origins are also `unknown` unless recorded, rather than inferred from a related decision. An agent may label a relayed or inherited answer but cannot use that label to mint a person-origin record. Unproven original decider identities remain unknown, with the answering relay seat recorded separately.diff --git a/src/module-imports.js b/src/module-imports.jsindex 8e6d0a2a..55865ff4 100644--- a/src/module-imports.js+++ b/src/module-imports.js@@ -158,6 +158,26 @@ export function commonJsIn(sources) {});}+/** Fail closed for executable module loading or code generation whose registrations are not statically known. */+function opaqueLoadingIn(sources) {+ const occurrences = sources.map(source => [+ ...[...source.matchAll(IMPORT)].filter(match => pastGap(source, match.index + match[0].length).startsWith('(')),+ ...source.matchAll(/(?<![\p{ID_Continue}$\u200c\u200d#])(?:eval|Function)(?![\p{ID_Continue}$\u200c\u200d])/gu),+ ].map(match => match.index));+ const variants = sources.flatMap((source, index) => occurrences[index].map(at =>+ source.slice(0, at) + '\u0000' + source.slice(at)));+ const parsed = look([...sources, ...variants]);+ let next = sources.length;+ return sources.map((source, index) => {+ let found = !parsed[index].compiles || parsed[index].imports.some(name => ['node:vm', 'vm', 'node:module', 'module'].includes(name));+ for (const _at of occurrences[index]) {+ if (!parsed[next].compiles) found = true;+ next += 1;+ }+ return found;+ });+}+/** Decode bounded quoted keys by compiling static imports; repository expressions are never evaluated. */function quotedProperties(source) {const candidates = [];@@ -321,6 +341,7 @@ function unreadableTestOptions(source, quoted) {/** Find CPU-load options without evaluating a test module; unknown identifier values require runner admission. */export function cpuLoadOptionsIn(sources) {const commonJs = commonJsIn(sources);+ const opaqueLoading = opaqueLoadingIn(sources);const quoted = sources.map(quotedProperties);const occurrences = sources.map((source, index) => [...source.matchAll(/(?:\bcpuLoad\b|["']cpuLoad["'])/gu), ...source.matchAll(UNICODE_ESCAPE),@@ -341,7 +362,7 @@ export function cpuLoadOptionsIn(sources) {const parsed = look([...sources, ...variants]);let next = sources.length;return sources.map((source, index) => {- let found = !parsed[index].compiles || commonJs[index] || unreadableTestOptions(source, quoted[index]);+ let found = !parsed[index].compiles || commonJs[index] || opaqueLoading[index] || unreadableTestOptions(source, quoted[index]);for (const { disabled } of occurrences[index]) {if (!parsed[next].compiles && !disabled) found = true;next += 1;diff --git a/test/cpu-load-test-fixture.js b/test/cpu-load-test-fixture.jsindex b2386050..b01606ba 100644--- a/test/cpu-load-test-fixture.js+++ b/test/cpu-load-test-fixture.js@@ -9,7 +9,7 @@ import { HOST, installSshStandIn } from './runner-ssh-fixture.js';const SOURCE = resolve(import.meta.dirname, '..');/** Build an ordinary CLI fixture whose declared test reports its actual checkout and live holder. */-export function cpuLoadFixture(e2e, { declaration = '{ cpuLoad: true }', binding = 'test', subtest = null, commonjs = false } = {}) {+export function cpuLoadFixture(e2e, { declaration = '{ cpuLoad: true }', binding = 'test', subtest = null, commonjs = false, dynamicImport = false } = {}) {const probeFile = `cpu-probe.test.${commonjs ? 'cjs' : 'js'}`;const box = e2e.project(`node bin/run-tests.js test/${probeFile}`);const bin = join(box.dir, 'ssh-bin');@@ -22,7 +22,9 @@ export function cpuLoadFixture(e2e, { declaration = '{ cpuLoad: true }', bindingwriteFileSync(join(box.repo, 'package.json'), JSON.stringify({ name: 'pullboard', version: '1.0.0', type: 'module' }) + '\n');writeFileSync(join(box.repo, 'test', probeFile), `${commonjs? `const { test: ${binding}, after: finish } = require('node:test');\nconst { DatabaseSync } = require('node:sqlite');`- : `import { test${binding === 'test' ? '' : ` as ${binding}`}, after as finish } from 'node:test';\nimport { DatabaseSync } from 'node:sqlite';`}+ : dynamicImport+ ? `const { default: ${binding}, after: finish } = await import('node:test');\nimport { DatabaseSync } from 'node:sqlite';`+ : `import { test${binding === 'test' ? '' : ` as ${binding}`}, after as finish } from 'node:test';\nimport { DatabaseSync } from 'node:sqlite';`}// Example text is not a declaration: { cpuLoad: true }const example = '{ cpuLoad: true }';finish(() => {});diff --git a/test/cpu-load-tests.test.js b/test/cpu-load-tests.test.jsindex c4bc2937..1b0ba9ce 100644--- a/test/cpu-load-tests.test.js+++ b/test/cpu-load-tests.test.js@@ -175,3 +175,15 @@ test('opaque CommonJS registration uses its genuine runner and browser lease [C7assert.equal(remote.executor?.browserLease, true, 'the conservative CommonJS browser requirement has a real private holder');assert.notEqual(remote.executor?.cwd, box.repo);});+++// AFTER-only: dynamic module loading cannot hide a registration alias with executable options.+test('dynamic node:test registration with opaque options uses its runner [C7]', async () => {+ const box = cpuLoadFixture(e2e, { dynamicImport: true, binding: 'register',+ declaration: 'Object.fromEntries([[ ["cpu", "Load"].join(""), true ]])' });+ const remote = await box.runGate();+ assert.equal(remote.result.status, 0, remote.result.context);+ assert.equal(box.requestsMade().length, 1);+ assert.equal(remote.executor?.runnerExecution, true);+ assert.notEqual(remote.executor?.cwd, box.repo);+});