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
feat(publish): show independent PR proof status [B3,R3]
Corey Olsonb017f1d7bd7c
diff --git a/docs/api.md b/docs/api.mdindex 7251b33a..40d36aba 100644--- a/docs/api.md+++ b/docs/api.md@@ -648,3 +648,11 @@ Verification output, current item detail and the ledger qualify affected accepteRun `pullboard handoff` from the outgoing agent worktree. It creates or finds one hand-off item and prints its claims, recent moves, asks and answers, worktree state and existing facts. Record unfinished ownership, principles and taste, open threads, outside files and context only that chat knows with `pullboard fact <id> note "..."`. Pullboard carries board records, not a chat transcript.The incoming agent joins a new worktree and runs `pullboard handoff --take <id>`. It reads the same hand-off and outgoing work card, and records a timed takeover fact. The first incoming seat wins; its repeat is idempotent. Claims are reported rather than silently reassigned. After takeover, the outgoing seat cannot make board moves except `pullboard shout --item <id> "..."` on that exact hand-off. Both seats read and answer that item channel. The command ends with that same sign-off command. The main checkout retains its separate coordinator takeover flow.++## Pull request proof status++When `publish.pullRequest` is enabled, `pullboard publish` reconciles the GitHub commit status `pullboard/verified-by-second-agent` for its proposals and open outside pull requests. Teams can require that context in their GitHub branch protection. A passing status requires complete commit coverage by recorded independent ACCEPT receipts with green checks; procedural or historical unknown provenance reads `not verified` and names the unproven independence. A local green gate, a PR description, or a trailer alone never substitutes for a receipt.++A board-recorded item merge covers its introduced commits only when its exact submitted commit has that receipt and is an ancestor of the recorded merge. `Pullboard-Companion: #N` is covered only on a board-recorded trunk containing item N's landing. Unreceipted commits, including release bumps and synthetic publication commits, remain unverified. An outside PR is allowed and initially reads `not verified`; the JSON result's `verification[].intake` names the existing `pullboard intake` command that files it for review. Outside intake can cover only its exact accepted head, never its earlier commits by inference.++The 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.diff --git a/src/pr-github.js b/src/pr-github.jsindex ee8f9403..49a78b98 100644--- a/src/pr-github.js+++ b/src/pr-github.js@@ -39,6 +39,10 @@ export function githubPullClient(root, repository) {throw new Refused('PUBLISH_GITHUB', 'GitHub evidence exceeds the bounded page limit; narrow this release before publishing.');}return {+ open: () => pages('pulls?state=open'),+ commits: number => pages(`pulls/${number}/commits`),+ statuses: head => api('GET', `commits/${head}/status`).statuses ?? [],+ setStatus: (head, body) => api('POST', `statuses/${head}`, body),list: head => pages(`pulls?state=open&head=${encodeURIComponent(repository.split('/')[0] + ':' + head)}`),read: number => api('GET', `pulls/${number}`),readIssue: number => api('GET', `issues/${number}`),diff --git a/src/pr-publish.js b/src/pr-publish.jsindex d94c3462..9e92e6f7 100644--- a/src/pr-publish.js+++ b/src/pr-publish.js@@ -25,6 +25,7 @@ import {githubPullClient,githubRepository,} from './pr-github.js';+import { publishVerificationStatuses } from './pr-verification.js';import { Refused } from './refused.js';/** Keep publisher-local transport state distinct from the shared board and legacy push state. */@@ -179,6 +180,7 @@ export async function publishPullRequests({ root, board, config, branch, remote,const repository = githubRepository(root, remote);const client = githubPullClient(root, repository);const state = readState(root);+ let verification = publishVerificationStatuses({ root, board, client, state, repository, trustedHead: head });const releases = [];const findings = [];const unattributed = [];@@ -197,7 +199,7 @@ export async function publishPullRequests({ root, board, config, branch, remote,await saveState(root, state);const releasedItems = new Set(state.proposals.filter(p => p.released).flatMap(p => p.entries.map(e => `${e.id}:${e.commit}`)));const entries = releaseEntries(root, board, published, head).filter(e => !releasedItems.has(`${e.id}:${e.commit}`));- if (tryGit(root, ['merge-base', '--is-ancestor', head, published]).status === 0) return { head, published: true, red: [], releases, findings, unattributed };+ if (tryGit(root, ['merge-base', '--is-ancestor', head, published]).status === 0) return { head, published: true, red: [], releases, findings, unattributed, verification };const digest = createHash('sha256').update(branch).digest('hex').slice(0, 12);const repairRoots = new Map(store.events(board).filter(e => e.event_kind === 'pr-ci-finding').map(e => {const detail = JSON.parse(e.event_detail); return [detail.repair, detail.item];@@ -205,7 +207,7 @@ export async function publishPullRequests({ root, board, config, branch, remote,const groups = config.publish.pullRequest === 'item' ? [...new Set(entries.map(e => repairRoots.get(e.id) ?? e.id))].map(id => ({ key: `item-${id}`, entries: entries.filter(e => (repairRoots.get(e.id) ?? e.id) === id) })) : [{ key: 'release', entries }];const proposed = [];- if (!groups.length) return { head, published: false, waiting: true, red: [], releases, findings, unattributed,+ if (!groups.length) return { head, published: false, waiting: true, red: [], releases, findings, unattributed, verification,reason: 'No unpublished accepted item remains; per-item mode does not certify unrelated local commits.' };for (const group of groups) {const name = `pullboard/${group.key}-${digest}`;@@ -226,7 +228,8 @@ export async function publishPullRequests({ root, board, config, branch, remote,url: `https://github.com/${repository}/pull/${pull.number}`, entries: group.entries, released: false };if (old) state.proposals.splice(state.proposals.indexOf(old), 1, proposal); else state.proposals.push(proposal);await saveState(root, state); proposed.push(proposal);+ verification = publishVerificationStatuses({ root, board, client, state, repository, trustedHead: head });}say(`proposed ${proposed.length} pull request(s); only a person can merge them`);- return { head, published: false, waiting: true, proposed: true, pullRequests: proposed.map(p => ({ number: p.number, url: p.url, head: p.head, items: p.entries.map(e => e.id) })), red: [], releases, findings, unattributed };+ return { head, published: false, waiting: true, proposed: true, pullRequests: proposed.map(p => ({ number: p.number, url: p.url, head: p.head, items: p.entries.map(e => e.id) })), red: [], releases, findings, unattributed, verification };}diff --git a/src/pr-verification.js b/src/pr-verification.jsnew file mode 100644index 00000000..ffce0ed8--- /dev/null+++ b/src/pr-verification.js@@ -0,0 +1,120 @@+/** Publish only exact native independent review coverage, never a PR author's proof claims [B3,R3]. */+import * as store from './board.js';+import { git, tryGit } from './git.js';+import { Refused } from './refused.js';+import { outsideSource } from './outside-source.js';++export const PR_VERIFICATION_CONTEXT = 'pullboard/verified-by-second-agent';+const COMMIT = /^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u;++/** Unknown historical provenance or a different criterion cannot become independent proof later. */+function itemReceipt(board, item) {+ if (item.item_status !== 'verified' || item.item_verdict !== 'ACCEPT') return null;+ const verdict = store.acceptedVerdict(board, item);+ const assurance = board.db.prepare('SELECT meta_value FROM board_meta WHERE meta_key=?')+ .get(`verdict_assurance:${verdict?.verdict_id}`)?.meta_value;+ if (!verdict || assurance !== 'independent' || verdict.check !== 'green'+ || verdict.verdict_digest !== item.item_frozen_digest || verdict.verdict_by === item.item_built_by+ || verdict.review?.commit !== item.item_commit || !COMMIT.test(verdict.review?.head ?? '')+ || !verdict.environment || ['platform', 'arch', 'node'].some(key => typeof verdict.environment[key] !== 'string' || !verdict.environment[key])) return null;+ return { item: item.item_id, commit: item.item_commit, reviewer: verdict.verdict_by,+ verdict: verdict.verdict_id, assurance, checked: verdict.review.head };+}++/** Only one unambiguous Git trailer can identify an item; prose and PR descriptions are not authority. */+function trailerItem(root, commit, key) {+ const values = git(root, ['show', '-s', `--format=%(trailers:key=${key},valueonly)`, commit]).split('\n').filter(Boolean);+ const match = values.length === 1 && /^#([1-9][0-9]*)$/u.exec(values[0]);+ return match && Number.isSafeInteger(Number(match[1])) ? Number(match[1]) : null;+}++/** Resolve actual board-recorded landings, and companions only on the coordinator's trusted source history. */+function coverage(root, board, commits, trustedHead) {+ const items = store.listItems(board, { all: true });+ const receipts = new Map(items.map(item => [item.item_id, itemReceipt(board, item)]).filter(([, receipt]) => receipt));+ const recordedTrunks = [...items.map(item => item.item_merged_commit),+ ...store.landingBatches(board).filter(batch => ['trunk', 'landed', 'pushed'].includes(batch.state)).map(batch => batch.tip)]+ .filter(commit => COMMIT.test(commit ?? '') && tryGit(root, ['merge-base', '--is-ancestor', commit, trustedHead]).status === 0);+ const covered = new Map([...receipts.values()].map(receipt => [receipt.commit, receipt]));+ for (const commit of commits) {+ const id = trailerItem(root, commit, 'Pullboard-Item');+ const item = id && items.find(item => item.item_id === id);+ const receipt = receipts.get(id);+ if (receipt && item.item_merged_commit === commit+ && git(root, ['show', '-s', '--format=%P', commit]).split(' ').length > 1+ && tryGit(root, ['merge-base', '--is-ancestor', receipt.commit, commit]).status === 0) {+ for (const introduced of git(root, ['rev-list', `${commit}^1..${commit}`]).split('\n').filter(Boolean)) covered.set(introduced, receipt);+ }+ const companion = receipts.get(trailerItem(root, commit, 'Pullboard-Companion'));+ const companionItem = companion && items.find(item => item.item_id === companion.item);+ if (companion && COMMIT.test(companionItem.item_merged_commit ?? '') && recordedTrunks.some(trunk =>+ tryGit(root, ['merge-base', '--is-ancestor', commit, trunk]).status === 0+ && tryGit(root, ['merge-base', '--is-ancestor', companionItem.item_merged_commit, trunk]).status === 0)) covered.set(commit, companion);+ }+ return covered;+}++/** A missing or procedural receipt explains a red status without exporting private notes or machine paths. */+function unverifiedReason(board, commits) {+ for (const item of store.listItems(board, { all: true }).filter(item => commits.includes(item.item_commit))) {+ const verdict = store.acceptedVerdict(board, item);+ const assurance = verdict && board.db.prepare('SELECT meta_value FROM board_meta WHERE meta_key=?')+ .get(`verdict_assurance:${verdict.verdict_id}`)?.meta_value;+ if (verdict && assurance !== 'independent') return "second agent's independence is unproven (" + (assurance ?? 'unknown') + ')';+ }+ return 'one or more commits lack an exact independent green receipt';+}++/** Check the complete provider range against Git objects and immutable native receipts, not merely its head. */+export function pullRequestVerification({ root, board, client, pull, proposal, repository, trustedHead }) {+ const head = pull.head?.sha;+ const outside = store.listItems(board, { all: true }).find(item => {+ const source = outsideSource(board, item.item_id);+ return source?.repository === repository && source.kind === 'pull-request' && source.number === pull.number && source.commit === head;+ });+ const knownProposal = proposal && proposal.head === head;+ if (!knownProposal && !outside) return { state: 'failure', description: 'not verified: outside pull request; use pullboard intake', assurance: 'unknown', receipts: [] };+ if (!COMMIT.test(head ?? '') || !COMMIT.test(pull.base?.sha ?? '')) {+ return { state: 'failure', description: 'not verified: exact pull request range is unavailable', assurance: 'unknown', receipts: [] };+ }+ // GitHub's PR-commits endpoint stops at 250; a larger open range is read from exact local Git objects.+ const rows = pull.commits <= 250 ? client.commits(pull.number) : null;+ const range = rows ? null : tryGit(root, ['rev-list', `${pull.base.sha}..${head}`]);+ const commits = rows ? rows.map(row => row.sha) : range.status === 0 ? range.stdout.trim().split('\n').filter(Boolean) : [];+ if (!Number.isSafeInteger(pull.commits) || pull.commits < 1 || commits.length !== pull.commits+ || commits.some(commit => !COMMIT.test(commit ?? '')) || new Set(commits).size !== commits.length+ || !commits.includes(head) || commits.some(commit => tryGit(root, ['merge-base', '--is-ancestor', commit, head]).status !== 0)) {+ return { state: 'failure', description: 'not verified: complete exact commit range is unavailable', assurance: 'unknown', receipts: [] };+ }+ const covered = coverage(root, board, commits, trustedHead);+ const missing = commits.filter(commit => !covered.has(commit));+ if (missing.length) return { state: 'failure', description: 'not verified: ' + unverifiedReason(board, missing), assurance: 'unproven', receipts: [], unverified: missing };+ const receipts = [...new Map(commits.map(commit => { const receipt = covered.get(commit); return [receipt.verdict, receipt]; })).values()];+ return { state: 'success', description: 'verified by a second agent (independent)', assurance: 'independent', receipts };+}++/** Reconcile open PRs, including outside contributions, without posting comments or merging anyone's work. */+export function publishVerificationStatuses({ root, board, client, state, repository, trustedHead }) {+ const numbers = [...new Set([...client.open().map(pull => pull.number),+ ...state.proposals.filter(proposal => proposal.repository === repository).map(proposal => proposal.number)])];+ const results = numbers.map(number => {+ if (!Number.isSafeInteger(number) || number < 1) throw new Refused('PUBLISH_GITHUB', 'the pull request lacks an exact provider identity; refresh it before publishing');+ const pull = client.read(number);+ if (pull.number !== number || !COMMIT.test(pull.head?.sha ?? '')) throw new Refused('PUBLISH_GITHUB', 'the pull request lacks an exact head; refresh it before publishing');+ const proposal = state.proposals.find(entry => entry.repository === repository && entry.number === pull.number);+ const verification = pullRequestVerification({ root, board, client, pull, proposal, repository, trustedHead });+ return { number: pull.number, head: pull.head.sha, ...verification,+ ...(proposal ? {} : { intake: `pullboard intake https://github.com/${repository}/pull/${pull.number} --criterion "behavior" --check "command"` }) };+ });+ // GitHub statuses belong to a commit, not a PR: an outside PR sharing a head must never borrow green.+ for (const head of new Set(results.map(result => result.head))) {+ const sharing = results.filter(result => result.head === head);+ const red = sharing.find(result => result.state !== 'success');+ const status = { state: red ? 'failure' : 'success', context: PR_VERIFICATION_CONTEXT,+ description: red?.description ?? 'verified by a second agent (independent)' };+ const old = client.statuses(head).find(entry => entry.context === status.context);+ if (!old || old.state !== status.state || old.description !== status.description) client.setStatus(head, status);+ for (const result of sharing) { result.statusState = status.state; result.statusDescription = status.description; }+ }+ return results;+}diff --git a/test/pr-bridge-fixture.js b/test/pr-bridge-fixture.jsindex d45e45da..d17e16e5 100644--- a/test/pr-bridge-fixture.js+++ b/test/pr-bridge-fixture.js@@ -4,6 +4,7 @@ import { once } from 'node:events';import { createServer } from 'node:http';import { chmodSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';import { join } from 'node:path';+import * as store from '../src/board.js';import { createE2eHelpers } from './e2e-helpers.js';import { startFixtureChild } from './fixture-child.js';@@ -30,7 +31,7 @@ export function bridgeProject(t, mode = 'release') {"import { readFileSync, appendFileSync } from 'node:fs';","import { execFileSync } from 'node:child_process';",`appendFileSync(${JSON.stringify(gateCalls)}, JSON.stringify({ head: execFileSync('git', ['rev-parse', 'HEAD'], { encoding: 'utf8' }).trim() }) + '\\n');`,- "let red = false; for (const file of ['web/one.js', 'web/two.js']) { try { if (readFileSync(file, 'utf8').includes('RED')) red = true; } catch (error) { if (error.code !== 'ENOENT') throw error; } }",+ "let red = false; for (const file of ['web/one.js', 'web/two.js', 'web/three.js']) { try { if (readFileSync(file, 'utf8').includes('RED')) red = true; } catch (error) { if (error.code !== 'ENOENT') throw error; } }","console.log('TAP version 13'); console.log((red ? 'not ok' : 'ok') + ' 1 - bridge project content stays green');","console.log('1..1'); console.log('# tests 1'); console.log('# pass ' + (red ? 0 : 1)); console.log('# fail ' + (red ? 1 : 0)); console.log('# skipped 0'); process.exitCode = red ? 1 : 0;",].join('\n'));@@ -47,8 +48,18 @@ export function bridgeProject(t, mode = 'release') {return { ...box, ...helpers, remote, published, gateCalls, mode };}+/** Opt in through a real committed coordinator configuration, optionally tied to its native item. */+function enableBridgeMode(box, companion) {+ const configPath = join(box.repo, 'pullboard.json');+ const config = JSON.parse(readFileSync(configPath, 'utf8'));+ writeFileSync(configPath, JSON.stringify({ ...config, publish: { pullRequest: box.mode }, approvers: ['fixture-person'] }, null, 2));+ box.git(box.repo, 'add', 'pullboard.json');+ box.git(box.repo, 'commit', '-q', '-m', 'chore: opt in to private pull request bridge [G1]',+ ...(companion ? ['-m', `Pullboard-Companion: #${companion}`] : []));+}+/** Build, verify and locally land two real items before enabling the opt-in publisher. */-export function landBridgeItems(box) {+export function landBridgeItems(box, { independent = false } = {}) {const entries = [];for (const [index, name] of ['one', 'two'].entries()) {const path = index === 0 ? box.web : join(box.dir, 'web-two');@@ -56,6 +67,13 @@ export function landBridgeItems(box) {box.git(box.repo, 'worktree', 'add', '-q', '-b', 'web/two', path, 'main');assert.equal(box.run(path, 'join', 'web').code, 0);}+ if (independent) {+ const board = store.openBoard(join(box.repo, '.git/pullboard/board.sqlite'));+ try {+ store.register(board, { lane: 'coordinator', path: box.repo, parent: 'fixture-pr-reviewer' });+ store.register(board, { lane: 'web', path, parent: `fixture-pr-builder-${index}` });+ } finally { store.closeBoard(board); }+ }const add = box.run(box.repo, 'add', 'web', `private bridge ${name}`, '--specs', 'G1','--criterion', `private ${name} remains correct`, '--check', 'test ! -f RED', '--json');assert.equal(add.code, 0, add.err);@@ -71,16 +89,13 @@ export function landBridgeItems(box) {const reviewed = box.run(box.repo, 'verify', String(id), 'accept', '--as', 'coordinator', '--note', 'private bridge proof passed');assert.equal(reviewed.code, 0, reviewed.err);} finally { box.git(box.repo, 'switch', '-q', 'main'); }- box.git(box.repo, 'merge', '-q', '--no-ff', '-m', `chore(merge): private bridge ${name} [G1]`, commit);+ box.git(box.repo, 'merge', '-q', '--no-ff', '-m', `chore(merge): private bridge ${name} [G1]`, ...(independent ? ['-m', `Pullboard-Item: #${id}`] : []), commit);const merged = box.run(box.repo, 'merged', String(id), box.git(box.repo, 'rev-parse', 'HEAD'));assert.equal(merged.code, 0, merged.err);entries.push({ id, commit, file });+ if (independent && index === 0) enableBridgeMode(box, id);}- const configPath = join(box.repo, 'pullboard.json');- const config = JSON.parse(readFileSync(configPath, 'utf8'));- writeFileSync(configPath, JSON.stringify({ ...config, publish: { pullRequest: box.mode }, approvers: ['fixture-person'] }, null, 2));- box.git(box.repo, 'add', 'pullboard.json');- box.git(box.repo, 'commit', '-q', '-m', 'chore: opt in to private pull request bridge [G1]');+ if (!independent) enableBridgeMode(box);return entries;}@@ -102,10 +117,24 @@ export async function bridgeProvider(t, box) {const head = box.git(box.remote, 'rev-parse', `refs/heads/${body.head}`);const pull = { number: state.next++, html_url: `https://github.com/fixture/repository/pull/${state.next - 1}`,title: body.title, body: body.body, state: 'open', merged: false,- head: { ref: body.head, sha: head }, base: { ref: body.base }, merged_by: null, merge_commit_sha: null };+ head: { ref: body.head, sha: head }, base: { ref: body.base, sha: box.git(box.remote, 'rev-parse', body.base) }, merged_by: null, merge_commit_sha: null };state.pulls.push(pull); return reply(201, pull);}}+ const commitsRoute = /^\/repos\/fixture\/repository\/pulls\/(\d+)\/commits$/u.exec(url.pathname);+ if (commitsRoute) {+ const pull = state.pulls.find(p => p.number === Number(commitsRoute[1]));+ const commits = box.git(box.repo, 'rev-list', `${pull.base.sha}..${pull.head.sha}`).split('\n').filter(Boolean);+ return reply(200, commits.slice((Number(url.searchParams.get('page') ?? 1) - 1) * 100,+ Number(url.searchParams.get('page') ?? 1) * 100).map(sha => ({ sha })));+ }+ if (/\/issues\/\d+\/comments$/u.test(url.pathname) || /\/pulls\/\d+\/reviews$/u.test(url.pathname)) return reply(200, []);+ const filesRoute = /\/pulls\/(\d+)\/files$/u.exec(url.pathname);+ if (filesRoute) {+ const pull = state.pulls.find(p => p.number === Number(filesRoute[1]));+ const files = box.git(box.repo, 'diff', '--name-only', `${pull.base.sha}...${pull.head.sha}`).split('\n').filter(Boolean);+ return reply(200, files.map(filename => ({ filename })));+ }const pullRoute = /^\/repos\/fixture\/repository\/pulls\/(\d+)$/u.exec(url.pathname);if (pullRoute) {const pull = state.pulls.find(p => p.number === Number(pullRoute[1]));@@ -114,6 +143,7 @@ export async function bridgeProvider(t, box) {Object.assign(pull, { title: body.title, body: body.body });pull.head.sha = box.git(box.remote, 'rev-parse', `refs/heads/${pull.head.ref}`);}+ pull.commits = box.git(box.repo, 'rev-list', `${pull.base.sha}..${pull.head.sha}`).split('\n').filter(Boolean).length;return reply(200, pull);}const statusRoute = /^\/repos\/fixture\/repository\/statuses\/([a-f0-9]+)$/u.exec(url.pathname);@@ -124,7 +154,11 @@ export async function bridgeProvider(t, box) {if (/\/commits\/[a-f0-9]+\/check-runs$/u.test(url.pathname)) return reply(200, { total_count: state.checks.length, check_runs: state.checks });const annotations = /\/check-runs\/(\d+)\/annotations$/u.exec(url.pathname);if (annotations) return reply(200, state.annotationsByRun[annotations[1]] ?? state.annotations);- if (/\/commits\/[a-f0-9]+\/status$/u.test(url.pathname)) return reply(200, { state: 'success', statuses: [] });+ if (/\/commits\/[a-f0-9]+\/status$/u.test(url.pathname)) {+ const sha = url.pathname.split('/').at(-2);+ const statuses = [...new Map(state.statuses.filter(status => status.sha === sha).map(status => [status.context, status])).values()];+ return reply(200, { state: statuses.some(status => status.state !== 'success') ? 'failure' : 'success', statuses });+ }return reply(404, { message: 'unexpected private provider endpoint' });});server.listen(0, '127.0.0.1');@@ -146,10 +180,15 @@ export async function bridgeProvider(t, box) {}/** Fix only the linked private repair through the same real item lifecycle. */-export function landBridgeRepair(box, id, file) {+export function landBridgeRepair(box, id, file, { independent = false } = {}) {const path = join(box.dir, `repair-${id}`);box.git(box.repo, 'worktree', 'add', '-q', '-b', `web/repair-${id}`, path, 'main');assert.equal(box.run(path, 'join', 'web').code, 0);+ if (independent) {+ const board = store.openBoard(join(box.repo, '.git/pullboard/board.sqlite'));+ try { store.register(board, { lane: 'web', path, parent: 'fixture-pr-repair-builder' }); }+ finally { store.closeBoard(board); }+ }const edited = box.run(box.repo, 'edit', String(id), '--criterion', 'the private CI finding is repaired','--check', 'test ! -f RED', '--brief', 'Change the named private web fixture and retain the linked finding.');assert.equal(edited.code, 0, edited.err);@@ -163,7 +202,7 @@ export function landBridgeRepair(box, id, file) {const accepted = box.run(box.repo, 'verify', String(id), 'accept', '--as', 'coordinator', '--note', 'private repair proof passed');assert.equal(accepted.code, 0, accepted.err);} finally { box.git(box.repo, 'switch', '-q', 'main'); }- box.git(box.repo, 'merge', '-q', '--no-ff', '-m', 'chore(merge): land private CI repair [G1]', commit);+ box.git(box.repo, 'merge', '-q', '--no-ff', '-m', 'chore(merge): land private CI repair [G1]', ...(independent ? ['-m', `Pullboard-Item: #${id}`] : []), commit);const merged = box.run(box.repo, 'merged', String(id), box.git(box.repo, 'rev-parse', 'HEAD'));assert.equal(merged.code, 0, merged.err);return commit;diff --git a/test/pr-bridge.test.js b/test/pr-bridge.test.jsindex e6e9ce4e..5500c6b6 100644--- a/test/pr-bridge.test.js+++ b/test/pr-bridge.test.js@@ -77,7 +77,68 @@ test('a pull request carries a verified-by-a-second-agent status and an outside&& entry.context === 'pullboard/verified-by-second-agent');assert.equal(status?.state, 'failure','the actual PR must carry not verified while its unreceipted configuration/merge commits lack second-agent proof');- assert.equal(status.description, 'not verified');+ assert.match(status.description, /^not verified/u);+ assert.match(status.description, /independence is unproven/u, 'procedural receipts are explicitly unproven');++ const proven = bridgeProject(t);+ const entries = landBridgeItems(proven, { independent: true });+ assert.ok(onBoard(proven, board => entries.every(entry => store.acceptedVerdict(board, store.getItem(board, entry.id)).assurance === 'independent')),+ 'the positive uses actual CLI checks and immutable independently registered fixture parent receipts');+ const github = await bridgeProvider(t, proven);+ const opened = await runBridgeCLI(proven, 'publish', '--json');+ assert.equal(opened.code, 0, opened.err);+ const native = github.pulls[0];+ const latest = head => github.statuses.findLast(entry => entry.sha === head && entry.context === 'pullboard/verified-by-second-agent');+ assert.equal(latest(native.head.sha).state, 'success', 'recorded item merges, introduced commits and trusted companion are covered');+ assert.match(latest(native.head.sha).description, /independent/u);+ const beforeRepeat = github.statuses.length;+ assert.equal((await runBridgeCLI(proven, 'publish', '--json')).code, 0);+ assert.equal(github.statuses.length, beforeRepeat, 'unchanged receipt state does not create duplicate provider statuses');++ // A real Git merge object can forge both trailers, but cannot manufacture its board landing.+ const forged = proven.git(proven.repo, 'commit-tree', proven.git(proven.repo, 'rev-parse', 'HEAD^{tree}'),+ '-p', native.head.sha, '-p', proven.published, '-m', 'chore: outside wrapper',+ '-m', `Pullboard-Item: #${entries[0].id}\nPullboard-Companion: #${entries[0].id}`);+ proven.git(proven.repo, 'push', '-q', 'origin', `${forged}:refs/pull/70/head`);+ const outside = { ...structuredClone(native), number: 70, head: { ref: 'outside-forged', sha: forged },+ user: { login: 'outside-author' }, updated_at: '2026-10-24T00:00:00Z' };+ github.pulls.push(outside);+ const collision = { ...structuredClone(native), number: 71, user: { login: 'outside-author' } };+ github.pulls.push(collision);+ const discovered = await runBridgeCLI(proven, 'publish', '--json');+ assert.equal(discovered.code, 0, discovered.err);+ assert.equal(latest(forged).state, 'failure');+ assert.equal(latest(native.head.sha).state, 'failure', 'an outside PR sharing a head cannot borrow the native PR green status');+ assert.ok(JSON.parse(discovered.out).verification.find(entry => entry.number === 70).intake.includes('pullboard intake'));+ collision.state = 'closed';+ const filed = await runBridgeCLI(proven, 'intake', 'https://github.com/fixture/repository/pull/70',+ '--lane', 'web', '--criterion', 'the outside contribution behaves correctly', '--check', 'test ! -f RED', '--json');+ assert.equal(filed.code, 0, filed.err);+ const intake = JSON.parse(filed.out).item;+ assert.equal(intake.item_status, 'submitted', 'the bridge files outside work for another agent, without certifying it');+ assert.equal(intake.item_commit, forged);+ const reconciled = await runBridgeCLI(proven, 'publish', '--json');+ assert.equal(reconciled.code, 0, reconciled.err);+ const outsideProof = JSON.parse(reconciled.out).verification.find(entry => entry.number === 70);+ assert.equal(outsideProof.state, 'failure');+ assert.ok(outsideProof.unverified.includes(forged), 'a forged item or companion trailer cannot borrow an unrelated native receipt');+ assert.equal(latest(native.head.sha).state, 'success', 'closing the unverified sharing PR restores the independently proven head');++ // A later independently checked item cannot hide an earlier unverified commit in the same PR.+ proven.git(proven.repo, 'commit', '--allow-empty', '-q', '-m', 'chore: unreviewed release bump');+ const unreviewed = proven.git(proven.repo, 'rev-parse', 'HEAD');+ const added = proven.run(proven.repo, 'add', 'web', 'independently checked later work', '--specs', 'G1',+ '--criterion', 'the later work remains correct', '--check', 'test ! -f RED', '--json');+ assert.equal(added.code, 0, added.err);+ const later = JSON.parse(added.out).item.item_id;+ landBridgeRepair(proven, later, 'web/three.js', { independent: true });+ const complete = await runBridgeCLI(proven, 'publish', '--json');+ assert.equal(complete.code, 0, complete.err);+ const proof = JSON.parse(complete.out).verification.find(entry => entry.number === native.number);+ assert.equal(proof.state, 'failure');+ assert.ok(proof.unverified.includes(unreviewed), 'every commit is checked, not only the newly verified head');+ assert.equal(latest(native.head.sha).state, 'failure');+ assert.equal(github.requests.some(request => request.path.endsWith('/merge') && request.method !== 'GET'), false);});