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(bar): exercise signed whole-file native lifecycle [B4,V2,H16]
Corey Olsonfd605eba6004
diff --git a/docs/formats.md b/docs/formats.mdindex 42fd8aec..062f0618 100644--- a/docs/formats.md+++ b/docs/formats.md@@ -210,6 +210,14 @@ Engine 85 also adds `recordLandingTestDefect`. A red batch whose bisection findsEngine 90 records the parent session a seat joined under and stamps each verdict with its assurance: independent when the builder's and reviewer's recorded parents differ, procedural when either is unknown (#1102). Review eligibility, next and the queue exclude any seat sharing a parent with an author. Older engines replay their recorded verdicts with no parent recorded.+`BAR_READY_ENGINE` introduces ordered `setBarReady` and `signBar` moves; its unassigned leaf is numbered by the landing merge. Readiness defaults off. `pullboard bar ready on` is coordinator-only and snapshots already-frozen bars, which remain grandfathered until their words change. Older engine moves retain their recorded behavior. Enabling readiness makes later bars require an observed main-red named case (including an absent named case), `Named test:`, `Measurements:` and `Reviewer edges:` sections, and an outside-parent signature. Section presence is enforced; the signer judges whether the methods and edge cases are adequate.++Semantic add/edit moves capture the current native author session and parent in their ordered arguments, preserving authors of unchanged fields. Signing likewise captures the current signer; replay never consults a replica's environment. A current session's explicit joined parent is used when native parent metadata is unavailable. Taking over a known helper seat without current parent metadata refuses rather than declaring that helper independent. Unknown historical identities cannot sign. These captures do not rewrite historical seat identity. Each `bar-revision` event binds the exact title, criterion, check, brief, citations, dependencies and route; `bar-sign` additionally binds its event revision, baseline digest, coverage plan, author parents, signer and note. Editing away and back still requires a new signature. Additive `board_meta` keys `bar_ready_setting`, `bar_grandfather:<id>`, `bar_revision:<id>` and `bar_sign:<id>` hold the current indexes; the events retain history.++`pullboard bar sign <id> --coverage-file <json> --note "..."` records whole-file obligations for existing committed test files in the brief's `Files` list. `claim.barTestFiles` defaults to Node test/spec filename globs; projects can explicitly provide their own globs. The file supplies `files: [{path, mode: "whole"|"landing", evidence}]`, a `named` observation, and an install observation when accepted main configures an install. Each observation retains `durationMs`, `selection` (`whole-file`, `named-check` or `install`), `ref`, `sha256`, full source commit, runtime and outcome. Whole mode requires a completed green whole-file observation. Landing mode requires a recorded whole-file duration exceeding the unchanged available review budget, explicit landing coverage in the brief and retained `namedCases`; unknown or named-only durations cannot establish that exception. Named, install and appended whole-file durations must fit the existing timeout together. References and hashes are signer-attested metadata; Pullboard validates their shape and budget, and does not independently open evidence artifacts during replay or prove the accuracy of a signer's account.++Accepted main determines the test inventory, `affectedTests` runner, install and timeout. A changed inventory or execution policy requires a new signature; unrelated main changes do not. The frozen criterion retains `sourceCheck`, `barCoverage` and `barRevision` and one effective `check`: the original shell command, grouped intact, followed by the project's own runner over signed whole-file paths. Check, submit and verification consume that same frozen command; Pullboard adds no framework or test suite to another project. With readiness enabled, normal submission also requires a committed candidate containing the exact current main used for its proof, unchanged through execution; `MAIN_NOT_COMPOSED` names the merge-and-submit recovery. Unrecorded recovered submissions cannot reuse proof from an older main snapshot.+The CLI declares its engine in every relay request's `X-Pullboard-Engine` header.A linked board requires at least engine 48 after issuing any agent token or machine credential, includingrevoked or expired ones; before engine 48 these minimums were 3 and 6. The minimum survives reopening the auth database;diff --git a/src/bar-ready-engine.js b/src/bar-ready-engine.jsindex d526a56c..25ee3bc4 100644--- a/src/bar-ready-engine.js+++ b/src/bar-ready-engine.js@@ -1,2 +1,3 @@-/** Ordered bar readiness, signing and activation [U113,H16]. */-export const BAR_READY_ENGINE = 91;+/** Ordered bar readiness, signing and activation [B4,V1,V2,H16]. */+import { unassignedEngine } from './engine-next.js';+export const BAR_READY_ENGINE = unassignedEngine();diff --git a/test/bar-native-session.test.js b/test/bar-native-session.test.jsindex 6273a702..3b1fdbcf 100644--- a/test/bar-native-session.test.js+++ b/test/bar-native-session.test.js@@ -1,7 +1,10 @@/** Real private CLI sessions prove bar signing, freezing and takeover attribution [B4,V1,V2,H16]. */import assert from 'node:assert/strict';import { after, test } from 'node:test';-import { mkdirSync, writeFileSync } from 'node:fs';+import { mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';+import { createHash } from 'node:crypto';+import { performance } from 'node:perf_hooks';+import { runFixtureChild } from './fixture-child.js';import { join } from 'node:path';import { createE2eHelpers } from './e2e-helpers.js';import * as store from '../src/board.js';@@ -16,15 +19,29 @@ function act(box, session, cwd, ...args) {}/** Keep command diagnostics attached to every successful private move. */function succeeds(result) { assert.equal(result.code,0,`${result.out}\n${result.err}`); return result; }-/** The unchanged witness is outside this item's Files list, so it needs no extra whole-file obligation. */-function setup() {+/** A real historical green whole file can be measured before the named main-red baseline is created. */+function setup(wholeCoverage = false) {const sandbox=fixtures.sandbox();delete sandbox.env.NODE_TEST_CONTEXT;sandbox.env.PULLBOARD_MODEL='Private fixture';const box=fixtures.project('true',sandbox);succeeds(act(box,'private-author-a',box.repo,'join','coordinator','--model','Private author'));mkdirSync(join(box.repo,'test'));- writeFileSync(join(box.repo,'test','witness.test.mjs'), "import { test } from 'node:test';\nimport assert from 'node:assert/strict';\nimport { existsSync } from 'node:fs';\ntest('named witness',()=>assert.ok(existsSync('web/ready.txt')));\n");- box.git(box.repo,'add','test/witness.test.mjs');box.git(box.repo,'commit','-qm','test: private named witness');+ writeFileSync(join(box.repo,'test','witness.test.mjs'), "import { test } from 'node:test';\nimport assert from 'node:assert/strict';\nimport { existsSync } from 'node:fs';\ntest('named witness',()=>assert.ok(existsSync('web/ready.txt')));\ntest('neighbor witness',()=>assert.ok(true));\n");+ if (wholeCoverage) {+ const config=JSON.parse(readFileSync(join(box.repo,'pullboard.json'),'utf8'));+ config.affectedTests='node --test';config.check={timeout:'5m'};config.shared.push('test/');+ writeFileSync(join(box.repo,'pullboard.json'),JSON.stringify(config));+ mkdirSync(join(box.repo,'web'));writeFileSync(join(box.repo,'web','ready.txt'),'ready');+ }+ box.git(box.repo,'add','-A');box.git(box.repo,'commit','-qm','test: private named witness');+ if (wholeCoverage) {+ const started=performance.now();+ const ran=runFixtureChild(process.execPath,['--test','test/witness.test.mjs'],{cwd:box.repo,env:box.env,encoding:'utf8'});+ const durationMs=performance.now()-started;assert.equal(ran.status,0,ran.failure??ran.stderr);assert.match(ran.stdout,/# pass 2/);+ const ref=join(box.dir,'whole-green.log');writeFileSync(ref,ran.stdout);+ box.wholeEvidence={durationMs,selection:'whole-file',ref,sha256:createHash('sha256').update(ran.stdout).digest('hex'),source:box.git(box.repo,'rev-parse','HEAD'),runtime:process.version,outcome:'pass'};+ rmSync(join(box.repo,'web','ready.txt'));box.git(box.repo,'add','-A');box.git(box.repo,'commit','-qm','test: reproduce missing output at main');+ }succeeds(act(box,'private-author-a',box.repo,'bar','ready','on'));return box;}@@ -32,7 +49,7 @@ function setup() {function add(box,author) {const check='node --test --test-name-pattern "named witness" test/witness.test.mjs';const result=succeeds(act(box,author,box.repo,'add','web','Ready output','--criterion','web/ready.txt exists','--specs','G1','--route','mid','--check',check,'--wait',- '--brief','Files: web/ready.txt\nTest: named witness asserts the output exists\nNamed test: named witness\nMeasurements: no quantitative bounds\nReviewer edges: absent output and restart','--json'));+ '--brief',`Files: web/ready.txt${box.wholeEvidence ? ', test/witness.test.mjs' : ''}\nTest: named witness asserts the output exists\nNamed test: named witness\nMeasurements: no quantitative bounds\nReviewer edges: absent output and restart`,'--json'));const item=JSON.parse(result.out).item;assert.equal(item.item_check_baseline.result,'red');assert.ok(item.item_check_baseline.testEvidence.failed.some(name=>name.includes('named witness')));@@ -45,7 +62,7 @@ function readItem(box,id) {}test('[B4,V1,V2,H16] real native sessions sign and freeze one bar before normal submit and review',()=>{- const box=setup();const id=add(box,'private-author-a');+ const box=setup(true);const id=add(box,'private-author-a');box.git(box.web,'merge','--ff-only','main');succeeds(act(box,'private-builder',box.web,'join','web','--model','Private builder'));const unsigned=act(box,'private-builder',box.web,'claim',String(id));@@ -54,10 +71,17 @@ test('[B4,V1,V2,H16] real native sessions sign and freeze one bar before normalassert.notEqual(self.code,0);assert.match(self.err,/BAR_SELF_SIGN/);const reviewer=join(box.dir,'outside-review');box.git(box.repo,'worktree','add','-qb','api/outside',reviewer,'main');succeeds(act(box,'private-reviewer',reviewer,'join','api','--model','Private reviewer'));- succeeds(act(box,'private-reviewer',reviewer,'bar','sign',String(id),'--note','Builder can meet this witness; two reviewers can grade absent and present output alike.'));+ const unknownDuration=act(box,'private-reviewer',reviewer,'bar','sign',String(id),'--note','Whole coverage still needs measured evidence.');+ assert.notEqual(unknownDuration.code,0);assert.match(unknownDuration.err,/BAR_COVERAGE/);+ const baseline=readItem(box,id).item_check_baseline;+ const baselineRef=join(box.dir,'named-red.json');const baselineText=JSON.stringify(baseline);writeFileSync(baselineRef,baselineText);+ const coverageFile=join(box.dir,'coverage.json');+ writeFileSync(coverageFile,JSON.stringify({files:[{path:'test/witness.test.mjs',mode:'whole',evidence:box.wholeEvidence}],+ named:{durationMs:baseline.seconds*1000,selection:'named-check',ref:baselineRef,sha256:createHash('sha256').update(baselineText).digest('hex'),source:baseline.main,runtime:process.version,outcome:'fail'}}));+ succeeds(act(box,'private-reviewer',reviewer,'bar','sign',String(id),'--coverage-file',coverageFile,'--note','Builder can meet this witness; measured whole-file coverage fits and two reviewers can grade absent and present output alike.'));succeeds(act(box,'private-builder',box.web,'claim',String(id)));const frozen=JSON.parse(readItem(box,id).item_frozen);- assert.match(frozen.sourceCheck,/named witness/);assert.deepEqual(frozen.barCoverage.required,[]);+ assert.match(frozen.sourceCheck,/named witness/);assert.deepEqual(frozen.barCoverage.required,['test/witness.test.mjs']);assert.match(frozen.check,/node --test '.\/test\/witness\.test\.mjs'/);assert.equal(frozen.barCoverage.files[0].evidence.sha256,box.wholeEvidence.sha256);mkdirSync(join(box.web,'web'),{recursive:true});writeFileSync(join(box.web,'web','ready.txt'),'ready');box.git(box.web,'add','web/ready.txt');box.git(box.web,'commit','-qm','feat(web): ready output [G1]');succeeds(act(box,'private-builder',box.web,'submit',String(id)));