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(proof): keep child boot reports read only [C7,H16]
Corey Olsonaec8f8d66a36
diff --git a/src/execution-environment.js b/src/execution-environment.jsindex 9ba128e6..37ba869b 100644--- a/src/execution-environment.js+++ b/src/execution-environment.js@@ -53,8 +53,7 @@ export function runtimeCaptureSource(directory) {import { randomUUID } from 'node:crypto';const directory=${JSON.stringify(directory)};const file=directory+'/runtime-'+process.pid+'-'+randomUUID()+'.json';-process.env.PULLBOARD_RUNTIME_CAPTURE_RECORD=file;-writeFileSync(file,JSON.stringify({pid:process.pid,environment:{platform:process.platform,arch:process.arch,node:process.version.slice(1)},file:null}),{flag:'wx',mode:0o600});+writeFileSync(file,JSON.stringify({pid:process.pid,environment:{platform:process.platform,arch:process.arch,node:process.version.slice(1)},file:null}),{flag:'wx',mode:0o400});`;}@@ -66,11 +65,13 @@ export function bindTestRuntime(pid, file) {const names = readdirSync(directory).filter(name => name.startsWith('runtime-' + pid + '-') && name.endsWith('.json'));if (names.length !== 1) return false;const path = join(directory, names[0]);+ const stat = lstatSync(path);+ if (!stat.isFile() || stat.mode & 0o222) return false;const own = JSON.parse(readFileSync(path, 'utf8'));- if (own.pid !== pid || environmentProblem(own.environment)) return false;+ if (own.pid !== pid || own.file !== null || environmentProblem(own.environment)) return false;const bound = { pid, environment: own.environment, file: relative(process.cwd(), file).replaceAll('\\', '/') };if (!testRuntimeRows([bound])) return false;- writeFileSync(path, JSON.stringify(bound), { mode: 0o600 });+ writeFileSync(join(directory, 'binding-' + pid + '.json'), JSON.stringify({ pid, file: bound.file }), { flag: 'wx', mode: 0o600 });return true;} catch { return false; /* A missing child report cannot be replaced by the parent's identity. */ }}@@ -124,8 +125,18 @@ export function captureTestRuntimes(env) {const file = join(directory, name);const stat = lstatSync(file);bytes += stat.size;- if (!stat.isFile() || stat.size > 8192 || bytes > 8 * 1024 * 1024) return null;- rows.push(JSON.parse(readFileSync(file, 'utf8')));+ if (!stat.isFile() || stat.mode & 0o222 || stat.size > 8192 || bytes > 8 * 1024 * 1024) return null;+ const row = JSON.parse(readFileSync(file, 'utf8'));+ if (row.file !== null) return null;+ const binding = join(directory, 'binding-' + row.pid + '.json');+ try {+ const boundStat = lstatSync(binding);+ if (!boundStat.isFile() || boundStat.size > 8192) return null;+ const bound = JSON.parse(readFileSync(binding, 'utf8'));+ if (Object.keys(bound).sort().join(',') !== 'file,pid' || bound.pid !== row.pid) return null;+ row.file = bound.file;+ } catch (error) { if (error.code !== 'ENOENT') return null; }+ rows.push(row);}const checked = testRuntimeRows(rows);if (!checked) return null;diff --git a/test/proof-provenance.test.js b/test/proof-provenance.test.jsindex 2f8adce0..976ce303 100644--- a/test/proof-provenance.test.js+++ b/test/proof-provenance.test.js@@ -1,6 +1,6 @@/** Native provenance rejects borrowed evidence and keeps unknown facts explicit [C7,H16]. */import assert from 'node:assert/strict';-import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';+import { chmodSync, existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from 'node:fs';import { tmpdir } from 'node:os';import { dirname, join } from 'node:path';import { test } from 'node:test';@@ -101,6 +101,23 @@ test('runtime capture binds the admitted file to its closed actual worker [C7,H1assert.notEqual(children[0].pid, process.pid);});+test('child boot reports remain read only and a writable replacement stays unknown [C7,H16]', t => {+ const capture = captureTestRuntimes(process.env);+ t.after(() => capture.finish());+ const result = runFixtureChild(process.execPath, ['-e', 'void 0'], { env: capture.env, encoding: 'utf8' });+ assert.equal(result.status, 0, result.failure || result.stderr);+ const directory = capture.env.PULLBOARD_RUNTIME_CAPTURE_DIR;+ const name = readdirSync(directory).find(name => /^runtime-/.test(name));+ assert.ok(name, 'the actual child wrote a boot report');+ const file = join(directory, name);+ assert.equal(statSync(file).mode & 0o222, 0, 'ordinary child writes cannot replace the sampled boot report');+ chmodSync(file, 0o600);+ const changed = JSON.parse(readFileSync(file, 'utf8'));+ changed.environment.node = '0.0.0';+ writeFileSync(file, JSON.stringify(changed));+ assert.equal(capture.finish(), null, 'a writable report is not accepted as native runtime evidence');+});+test('proof counters retain explicit totals and do not invent success from missing output [C7,H16]', () => {const unknown = { passed: null, failed: null, skipped: null };assert.deepEqual(proofCounts('no test reporter\n'), unknown);