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(flakes): retain physical checks and integration contracts [C7,H16]
Corey Olsona3d8a9ead1cc
diff --git a/docs/formats.md b/docs/formats.mdindex d4406aed..d6d0d783 100644--- a/docs/formats.md+++ b/docs/formats.md@@ -374,6 +374,8 @@ The `event` table is a SQLite schema object governed by `SCHEMA_VERSION`; its ap| `guards` | board | `missing`, `changed`, `stale` || `rigor-notice` | rigor | `cause`, `items`, `occurrences`, `neverAgain`, `engine` || `shout` | sender | `shout`, `to`, `decision`, `request`, `answers` |+| `flake-observation` | reporting agent | `engine`, `observation` |+| `flake-repair` | reporting agent | `engine`, `key`, `item` || `health-scan` | observing agent | `active`, `engine` || `health-failure` | sentinel | `key`, `cause`, `since`, `subject`, `owner`, `commit`, `engine` || `health-resolved` | sentinel | `key`, `cause`, `since`, `subject`, `owner`, `commit`, `engine` |diff --git a/docs/formats.test.js b/docs/formats.test.jsindex 7d6cf139..5e97bee8 100644--- a/docs/formats.test.js+++ b/docs/formats.test.js@@ -7,6 +7,8 @@ import { join, relative } from 'node:path';import { DatabaseSync } from 'node:sqlite';import { test } from 'node:test';import { submitFixture } from '../test/board-submit-fixture.js';+import { syntheticFlakeObservation } from '../test/flake-observation-fixture.js';+import { recordFlakeObservation } from '../src/board.js';import { proposeSentinel } from '../src/sentinels.js';import { decideSentinel } from '../src/sentinels.js';import { beginSentinelRun } from '../src/sentinels.js';@@ -364,6 +366,10 @@ function recordEventContract() {const revision = () => events(board).at(-1)?.event_id ?? 0;recordHealthFindings(board, { agentId: coordinator, observedRevision: revision(), findings: [healthFinding] });recordHealthFindings(board, { agentId: coordinator, observedRevision: revision(), findings: [] });+ // These synthetic receipts exercise both append-only event formats, not real diagnostic execution.+ for (const id of ['format-first', 'format-second']) recordFlakeObservation(board, {+ agentId: coordinator, lane: 'docs', observation: syntheticFlakeObservation(id, true),+ });// Explicitly synthetic event-contract history; no external command or gate is claimed.const watch = proposeSentinel(board, { agentId: coordinator, row: { name: 'format-watch', check: 'false', every: 'daily', owner: 'coordinator' } });decideSentinel(board, { agentId: PERSON, channel: 'view', name: watch.name, digest: watch.digest, decision: 'approve' });@@ -642,6 +648,8 @@ test('[A5] schema, versions, event kinds and event detail fields match live behashout: 'sender',pass: 'coordinator',answer: 'answerer',+ 'flake-observation': 'reporting agent',+ 'flake-repair': 'reporting agent','health-scan': 'observing agent','health-failure': 'sentinel','health-resolved': 'sentinel',diff --git a/src/native-flakes.js b/src/native-flakes.jsindex 6d2a2930..35f3e985 100644--- a/src/native-flakes.js+++ b/src/native-flakes.js@@ -17,6 +17,7 @@ import {readFileSync,readSync,readdirSync,+ realpathSync,statSync,writeFileSync,} from 'node:fs';@@ -70,6 +71,12 @@ export function flakeSource(root, { commit, main, privateCheck = false } = {}) {load: { average: loadavg(), cpus: availableParallelism(), freeMB: Math.floor(freemem() / 1048576) } };}+/** Resolve live aliases; deleted private checks already carry their physical execution root. */+function physicalPath(path) {+ try { return realpathSync(path); }+ catch { return path; }+}+/** Read structured Node TAP blocks only; nested selectors and cancelled parents stay unsupported. */function tapTests(output, root) {const rows = [];@@ -86,7 +93,7 @@ function tapTests(output, root) {const value = field[3].replace(/^(['"])(.*)\1$/u, '$2');if (field[2] === 'location') {const path = value.replace(/:\d+(?::\d+)?$/u, '');- const file = isAbsolute(path) ? relative(root, path) : path.replace(/^\.\//u, '');+ const file = isAbsolute(path) ? relative(physicalPath(root), physicalPath(path)) : path.replace(/^\.\//u, '');if (file && !file.startsWith('../') && !file.includes('\\')) active.file = file;} else active[field[2]] = value;}diff --git a/src/trusted-policy.js b/src/trusted-policy.jsindex 4f751867..c63bd3ed 100644--- a/src/trusted-policy.js+++ b/src/trusted-policy.js@@ -19,6 +19,7 @@ import {openSync,readFileSync,readSync,+ realpathSync,rmSync,writeSync,} from 'node:fs';@@ -195,7 +196,8 @@ export function checkAtCommit(root, item, { waitMs = 0, gateSlotHeld = false, gacatch { return checkResult('unverified', 'policy', '', '', { root, item }); }const install = config.check.install;const timeout = config.check.timeoutMs;- const scratch = mkdtempSync(join(tmpdir(), 'pullboard-criterion-'));+ // Retain the physical root before cleanup; Node TAP resolves symlinks in test locations.+ const scratch = realpathSync(mkdtempSync(join(tmpdir(), 'pullboard-criterion-')));const copy = join(scratch, 'repo');const home = join(scratch, 'home');mkdirSync(home, { mode: 0o700 });diff --git a/test/flake-observation-fixture.js b/test/flake-observation-fixture.jsnew file mode 100644index 00000000..c2e86ae1--- /dev/null+++ b/test/flake-observation-fixture.js@@ -0,0 +1,15 @@+/** Synthetic receipt metadata for public format/credential contracts; no test execution is claimed. */+import { createHash } from 'node:crypto';++/** Make a bounded synthetic observation; confirmed values exercise the repair-link event contract. */+export function syntheticFlakeObservation(id, confirmed = false) {+ const receipt = green => {+ const body = Buffer.from(green ? 'synthetic paired receipt' : 'synthetic original receipt');+ return { green, sha256: createHash('sha256').update(body).digest('hex'), bytes: body.length,+ artifact: 'flake-evidence/' + id + '/' + (green ? 'paired' : 'original') + '.log', profileSha256: null };+ };+ return { id, file: 'test/synthetic.test.js', name: 'synthetic contract target', head: 'a'.repeat(40), tree: 'b'.repeat(40), main: 'a'.repeat(40),+ kind: 'check', classification: confirmed ? 'flake' : 'unclassified', reason: 'Synthetic contract metadata only; no gate run is claimed.',+ commandSha256: 'c'.repeat(64), at: '2026-10-20T00:00:00.000Z', diagnosticMs: 0,+ load: { average: [0, 0, 0], cpus: 1, freeMB: 100 }, original: receipt(false), paired: confirmed ? receipt(true) : null, mainReceipt: null };+}diff --git a/test/flakes.test.js b/test/flakes.test.jsindex 6224522a..d2e4cfa9 100644--- a/test/flakes.test.js+++ b/test/flakes.test.js@@ -295,8 +295,15 @@ test('a red submit records diagnostics without submitting the item [C7,V4,H16]',assertReceipts(box, observation);});-test('an independent private verification check stays red after its one passing pair [C7,V4,H16]', t => {+for (const linkedTemp of [false, true]) test(linkedTemp+ ? 'a private verification pair uses physical paths through a symlinked temporary root [C7,V4,H16]'+ : 'an independent private verification check stays red after its one passing pair [C7,V4,H16]', t => {const box = flakyProject(t, { alwaysPass: 'controlled' });+ if (linkedTemp) {+ const alias = join(box.scratch, 'temporary-alias');+ symlinkSync(box.scratch, alias, 'dir');+ box.env.TMPDIR = alias;+ }const id = checkedItem(box);const builder = privateBuilder(box);const claimed = builder.cli('claim', String(id));diff --git a/test/machine.test.js b/test/machine.test.jsindex 95e9a757..4d91fa8f 100644--- a/test/machine.test.js+++ b/test/machine.test.js@@ -114,8 +114,9 @@ const CALLBACKS = { 'board.js': { freeze: 'cli.js#freezer' } };* reads committed doctrine rules leniently: a doctrine it cannot parse carries no check [D1].*/const CAUGHT = {- 'cli.js#submitHere': ['cli.js#freezer', 'main-red.js#compareMainFailures', 'main-red.js#matchingReworks', 'doctrine-checks.js#checkRulesAt'],- 'cli.js#verifyHere': ['cli.js#freezer'],+ 'cli.js#submitHere': ['native-flakes.js#observeFailure', 'cli.js#freezer', 'main-red.js#compareMainFailures', 'main-red.js#matchingReworks', 'doctrine-checks.js#checkRulesAt'],+ // observeNativeFailure catches its optional pair/recording errors; they cannot become lifecycle refusals.+ 'cli.js#verifyHere': ['cli.js#freezer', 'native-flakes.js#observeFailure'],// Historical decline metadata is parsed inside a non-throwing boundary, covered by the Rigor history control.'board.js#reopen': ['rigor-notices.js#declinedRigorSource'],};diff --git a/test/relay-credential.test.js b/test/relay-credential.test.jsindex e78c4010..0511c77d 100644--- a/test/relay-credential.test.js+++ b/test/relay-credential.test.js@@ -7,6 +7,7 @@ import { ENGINE_OPERATIONS } from '../src/engine.js';import { ENGINE_VERSION } from '../src/machine.js';import { decodeBoardKey, unseal } from '../src/seal.js';import { relayClientFixture } from './relay-client-fixture.js';+import { syntheticFlakeObservation } from './flake-observation-fixture.js';test('every current operation selects its native actor credential without a second authorization policy [H2,H9,H16]', async (t) => {const box = await relayClientFixture(t);@@ -24,6 +25,7 @@ test('every current operation selects its native actor credential without a secoif (['claim', 'refreeze'].includes(operation)) args = [box.before.tables.item[0].item_id, options];if (operation === 'reserveNextReview') args = [options];if (operation === 'recordHealthFindings') args = [{ agentId: actor, observedRevision: 0, findings: [] }];+ if (operation === 'recordFlakeObservation') args = [{ agentId: actor, lane: box.lane, observation: syntheticFlakeObservation('credential-fixture') }];if (operation === 'proposeSentinel') args = [{ agentId: actor,row: { name: 'credential-watch', check: 'true', every: 'hourly', owner: actor } }];if (['beginSentinelRun', 'finishSentinelRun'].includes(operation)) {@@ -50,6 +52,7 @@ test('every current operation selects its native actor credential without a seco});cases.push({ operation: 'recordHealthFindings', args: [{ observedRevision: 0, findings: [] }], kind: 'agent', sent: false, expected: 'RELAY_ACTOR' },+ { operation: 'recordFlakeObservation', args: [{ lane: box.lane, observation: syntheticFlakeObservation('missing-actor') }], kind: 'agent', sent: false, expected: 'RELAY_ACTOR' },{ operation: 'submit', args: [999999, options], kind: 'agent', sent: false, expected: 'SUBMISSION_PROOF' },{ operation: 'answerDecision', args: [999999, { ...options, asPerson: true, channel: 'terminal' }], kind: 'person', sent: false },{ operation: 'holdLane', args: [box.lane, { ...options, asPerson: true, channel: 'terminal' }], kind: 'person', sent: false },