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(verdict): carry acceptance across proved merges [V1,V4,H16]
Corey Olson8f3b21f3f230
diff --git a/docs/lifecycle.md b/docs/lifecycle.mdindex 112a4ac0..0018d90d 100644--- a/docs/lifecycle.md+++ b/docs/lifecycle.md@@ -20,6 +20,7 @@ stateDiagram-v2claimed --> open: releaseclaimed --> open: lapse (clock)claimed --> submitted: submit+ claimed --> verified: submit-mergesubmitted --> submitted: reservesubmitted --> verified: acceptverified --> verified: accept@@ -59,7 +60,8 @@ Each move checks its guards in this order and refuses with the first one that do| claim | open, claimed | claimed | agent, coordinator | joined (NOT_JOINED or AGENT_REPLACED or SESSION_LEDGER), itemExists (NO_ITEM), inState (NOT_CLAIMABLE), checkProvesSomething (CRITERION_PROVES_NOTHING), barReady (BAR_NOT_READY), itemNotHeld (ITEM_HELD), inLane (WRONG_LANE or OUTSIDE_NATIVE_BUILD), routeAllows (ROUTE), dependenciesVerified (BLOCKED), notHeldByAnother (HELD), builderFirstRefusal (REOPEN_HELD_FOR_BUILDER), correctionRefrozen (PENDING_REFREEZE), laneOpen (LANE_HELD), lineCapacity (LINE_WIP_LIMIT or LINE_SETTING_RANGE), oneLiveClaim (ONE_CLAIM), rowsInForce (UNKNOWN_SPEC or A5_GRAMMAR_VERSION or NO_POLICY or BAD_CONFIG or SPEC_BEHIND_MAIN or AGENT_APPROVAL_REQUIRED or BAR_NOT_READY) || release | open, claimed | open | agent, coordinator | joined (NOT_JOINED or AGENT_REPLACED or SESSION_LEDGER), itemExists (NO_ITEM), inState (NOT_YOURS), releaseOwnsWork (NOT_YOURS), reviewReleaseExplained (NOTE_REQUIRED) || lapse | claimed | open | clock, when its lease runs out | none |-| submit | claimed | submitted | agent, coordinator | joined (NOT_JOINED or AGENT_REPLACED or SESSION_LEDGER), itemExists (NO_ITEM), inState (NOT_YOURS), isHolder (NOT_YOURS or OUTSIDE_NATIVE_BUILD), correctionRefrozen (PENDING_REFREEZE), checkProvesSomething (CRITERION_PROVES_NOTHING), barReady (BAR_NOT_READY), criterionUnchanged (CRITERIA_CHANGED), treeClean (DIRTY), nothingUntracked (UNTRACKED), hasCommit (NO_COMMIT or HOST_NAME), withinLane (OUTSIDE_LANE or NO_POLICY or BAD_CONFIG or GIT_GRAFTS), trunkMergeClean (MERGE_CONFLICT or MERGE_CHECK_FAILED or NO_POLICY or NO_TRUNK), trunkInCandidate (MAIN_NOT_COMPOSED), noUnverifiedStack (STACKED_ON_UNVERIFIED), infraExplained (INFRA_NOTE_REQUIRED), doctrineHolds (RATCHET_ROSE or RATCHET_UNCOUNTED), gateConfigured (NO_GATE), queuedItemLease (ITEM_LEASE_LOST or A5_GRAMMAR_VERSION or SPEC_BEHIND_MAIN or NOT_A_REPO or NO_CONFIG), gateGreen (GATE_RED or RUNNER_GUI_SESSION_REQUIRED or LAND_TIMEOUT_CUSTODY or LAND_GATE_OUTPUT or SLOT_DB_LOCKED or TIMING_SLOT_REQUIRED or RUNNER_BROWSER_SLOT_REQUIRED or PIPEFAIL_UNAVAILABLE), treeStillDuringGate (MOVED_DURING_GATE), submissionProofValid (SUBMISSION_PROOF), childrenDone (CHILDREN_OPEN), headIsNew (HEAD_NOT_NEW), result (LINE_SETTING_RANGE) |+| submit | claimed | submitted | agent, coordinator | joined (NOT_JOINED or AGENT_REPLACED or SESSION_LEDGER), itemExists (NO_ITEM), inState (NOT_YOURS), isHolder (NOT_YOURS or OUTSIDE_NATIVE_BUILD), correctionRefrozen (PENDING_REFREEZE), checkProvesSomething (CRITERION_PROVES_NOTHING), barReady (BAR_NOT_READY), criterionUnchanged (CRITERIA_CHANGED), treeClean (DIRTY), nothingUntracked (UNTRACKED), hasCommit (NO_COMMIT or HOST_NAME), withinLane (OUTSIDE_LANE or NO_POLICY or BAD_CONFIG or GIT_GRAFTS), trunkMergeClean (MERGE_CONFLICT or MERGE_CHECK_FAILED or NO_POLICY or NO_TRUNK), trunkInCandidate (MAIN_NOT_COMPOSED), noUnverifiedStack (STACKED_ON_UNVERIFIED), infraExplained (INFRA_NOTE_REQUIRED), doctrineHolds (RATCHET_ROSE or RATCHET_UNCOUNTED), gateConfigured (NO_GATE), queuedItemLease (ITEM_LEASE_LOST or A5_GRAMMAR_VERSION or SPEC_BEHIND_MAIN or NOT_A_REPO or NO_CONFIG), gateGreen (GATE_RED or RUNNER_GUI_SESSION_REQUIRED or LAND_TIMEOUT_CUSTODY or LAND_GATE_OUTPUT or SLOT_DB_LOCKED or TIMING_SLOT_REQUIRED or RUNNER_BROWSER_SLOT_REQUIRED or PIPEFAIL_UNAVAILABLE), treeStillDuringGate (MOVED_DURING_GATE), submissionProofValid (SUBMISSION_PROOF), childrenDone (CHILDREN_OPEN), headIsNew (HEAD_NOT_NEW), result (LINE_SETTING_RANGE), result (MERGE_ONLY_PROOF), result (SELF_VERIFY), result (SELF_SESSION_VERIFY), result (VERIFIER_STANDING), result (PROOF_REQUIRED) |+| submit-merge | claimed | verified | agent, coordinator, when only an unchanged accepted bar and a proved trunk-only merge; no new reviewer verdict is created | joined (NOT_JOINED or AGENT_REPLACED or SESSION_LEDGER), itemExists (NO_ITEM), inState (NOT_YOURS), isHolder (NOT_YOURS or OUTSIDE_NATIVE_BUILD), correctionRefrozen (PENDING_REFREEZE), checkProvesSomething (CRITERION_PROVES_NOTHING), barReady (BAR_NOT_READY), criterionUnchanged (CRITERIA_CHANGED), treeClean (DIRTY), nothingUntracked (UNTRACKED), hasCommit (NO_COMMIT or HOST_NAME), withinLane (OUTSIDE_LANE or NO_POLICY or BAD_CONFIG or GIT_GRAFTS), trunkMergeClean (MERGE_CONFLICT or MERGE_CHECK_FAILED or NO_POLICY or NO_TRUNK), trunkInCandidate (MAIN_NOT_COMPOSED), noUnverifiedStack (STACKED_ON_UNVERIFIED), infraExplained (INFRA_NOTE_REQUIRED), doctrineHolds (RATCHET_ROSE or RATCHET_UNCOUNTED), gateConfigured (NO_GATE), queuedItemLease (ITEM_LEASE_LOST or A5_GRAMMAR_VERSION or SPEC_BEHIND_MAIN or NOT_A_REPO or NO_CONFIG), gateGreen (GATE_RED or RUNNER_GUI_SESSION_REQUIRED or LAND_TIMEOUT_CUSTODY or LAND_GATE_OUTPUT or SLOT_DB_LOCKED or TIMING_SLOT_REQUIRED or RUNNER_BROWSER_SLOT_REQUIRED or PIPEFAIL_UNAVAILABLE), treeStillDuringGate (MOVED_DURING_GATE), submissionProofValid (SUBMISSION_PROOF), childrenDone (CHILDREN_OPEN), headIsNew (HEAD_NOT_NEW), mergeOnlyRecorded (MERGE_ONLY_PROOF), atSubmittedCommit (NOT_AT_COMMIT or OUTSIDE_LANE or NO_POLICY or BAD_CONFIG or GIT_GRAFTS), notBuilder (SELF_VERIFY or VERIFIER_STANDING or SELF_SESSION_VERIFY), proofNoted (PROOF_REQUIRED) || reserve | submitted | submitted | agent, coordinator | coordinatorSaysAs (MAIN_IS_COORDINATOR), joined (NOT_JOINED or AGENT_REPLACED or SESSION_LEDGER), roadmapReadable (MILESTONES_CORRUPT or LINE_SETTING_RANGE), itemExists (NO_ITEM), inState (NOT_SUBMITTED), reviewCooldownElapsed (REVIEW_COOLDOWN), notBuilder (SELF_VERIFY or VERIFIER_STANDING or SELF_SESSION_VERIFY), routeAllows (ROUTE), policyAllows (COORDINATOR_VERIFIES), familyAllows (O2_FAMILY_MATCH), reviewFree (REVIEW_HELD) || accept | submitted, verified | verified | agent, coordinator | coordinatorSaysAs (MAIN_IS_COORDINATOR), joined (NOT_JOINED or AGENT_REPLACED or SESSION_LEDGER), itemExists (NO_ITEM), inState (NOT_SUBMITTED), atSubmittedCommit (NOT_AT_COMMIT or OUTSIDE_LANE or NO_POLICY or BAD_CONFIG or GIT_GRAFTS), notMerged (ALREADY_MERGED), verdictReviewRecorded (BAD_VERDICT_REVIEW), reviewTreeCurrent (STALE_VERDICT or DIRTY or UNTRACKED or VERDICT_TRUNK_MOVED), notBuilder (SELF_VERIFY or VERIFIER_STANDING or SELF_SESSION_VERIFY), routeAllows (ROUTE), policyAllows (COORDINATOR_VERIFIES), familyAllows (O2_FAMILY_MATCH), reviewFree (REVIEW_HELD), criterionUnchanged (CRITERIA_CHANGED), reasonIsMet (BAD_REASON), trunkMergeClean (MERGE_CONFLICT or MERGE_CHECK_FAILED or NO_POLICY or NO_TRUNK), noUnverifiedStack (STACKED_ON_UNVERIFIED), queuedItemLease (ITEM_LEASE_LOST or A5_GRAMMAR_VERSION or SPEC_BEHIND_MAIN or NOT_A_REPO or NO_CONFIG), itemCheckGreen (CHECK_RED or RUNNER_GUI_SESSION_REQUIRED or SANDBOX_PROVIDER_REQUIRED or SANDBOX_IMAGE_REQUIRED or SANDBOX_RUNTIME or SANDBOX_EXPORT or SANDBOX_EXECUTION or SANDBOX_CLEANUP_REQUIRED or SANDBOX_CHECK_REQUIRED or CHECK_NO_PROOF or OUTSIDE_SANDBOX_REQUIRED or SLOT_DB_LOCKED or TIMING_SLOT_REQUIRED or CHECK_UNVERIFIED or GUARD_CANNOT_FAIL or GUARD_NOT_FOUND), proofNoted (PROOF_REQUIRED), result (VERDICT_ENVIRONMENT), result (LAND_HEADER), result (ENGINE_VERSION) || reject | submitted, verified | open | agent, coordinator | coordinatorSaysAs (MAIN_IS_COORDINATOR), joined (NOT_JOINED or AGENT_REPLACED or SESSION_LEDGER), itemExists (NO_ITEM), inState (NOT_SUBMITTED), atSubmittedCommit (NOT_AT_COMMIT or OUTSIDE_LANE or NO_POLICY or BAD_CONFIG or GIT_GRAFTS), notMerged (ALREADY_MERGED), verdictReviewRecorded (BAD_VERDICT_REVIEW), reviewTreeCurrent (STALE_VERDICT or DIRTY or UNTRACKED or VERDICT_TRUNK_MOVED), notBuilder (SELF_VERIFY or VERIFIER_STANDING or SELF_SESSION_VERIFY), routeAllows (ROUTE), policyAllows (COORDINATOR_VERIFIES), familyAllows (O2_FAMILY_MATCH), reviewFree (REVIEW_HELD), criterionUnchanged (CRITERIA_CHANGED), reasonCoded (BAD_REASON), noteGiven (NOTE_REQUIRED), causeWellFormed (BAD_CAUSE), result (VERDICT_ENVIRONMENT), result (LAND_HEADER), result (ENGINE_VERSION), result (NOT_YOURS), result (CLOSED) |@@ -84,6 +86,7 @@ Each move checks its guards in this order and refuses with the first one that do| NOT_CLAIMABLE | claim: the item is in open, claimed | pullboard show <id> || NOT_YOURS | release: the item is in open, claimed | pullboard show <id> || NOT_YOURS | submit: the item is in claimed | pullboard show <id> |+| NOT_YOURS | submit-merge: the item is in claimed | pullboard show <id> || NOT_SUBMITTED | reserve: the item is in submitted | pullboard show <id> || NOT_SUBMITTED | accept: the item is in submitted, verified | pullboard show <id> || NOT_SUBMITTED | reject: the item is in submitted, verified | pullboard show <id> |@@ -92,6 +95,7 @@ Each move checks its guards in this order and refuses with the first one that do| CLOSED | refreeze: the item is in open, claimed, submitted | pullboard show <id> || CLOSED | refreeze: the item is in claimed | pullboard show <id> || CLOSED | withdraw: the item is in open, claimed, submitted | pullboard show <id> |+| MERGE_ONLY_PROOF | the exact gated merge carries the unwithdrawn acceptance of the unchanged bar and its recorded conflict resolution | submit normally for outside review if the merge cannot be proved || OUTSIDE_SOURCE | an outside author and exact fetched commit/tree are recorded with a trusted frozen criterion, without pretending a native builder gated it | fetch and intake the exact GitHub pull request again || NOT_JOINED | the caller is the main checkout, or an unreplaced worktree seat that joined a lane; an agent session's claims, submits and verdicts can be checked against its local ledger | pullboard join <lane> --model "<model name>" (see: pullboard lanes) || AGENT_REPLACED | the caller is the main checkout, or an unreplaced worktree seat that joined a lane; an agent session's claims, submits and verdicts can be checked against its local ledger | read the takeover and only shout on its exact hand-off item; continue work from the incoming agent worktree |@@ -214,6 +218,11 @@ Each move checks its guards in this order and refuses with the first one that do| BAD_CONFLICT | a trunk conflict reopens an accepted item, names its files and the full trunk commit, and replays only under engine 52 or later, only for reopen --conflict | run pullboard reopen <id> --conflict <file> from the main checkout || ENGINE_VERSION | a trunk conflict reopens an accepted item, names its files and the full trunk commit, and replays only under engine 52 or later, only for reopen --conflict | upgrade Pullboard on every linked device before using --conflict || LINE_SETTING_RANGE | the recorded board line setting has a valid registry value (submit result) | restore the recorded board line setting from its ordered event history, then retry submit |+| MERGE_ONLY_PROOF | a requested carry matches the recorded conflict return, acceptance and exact gated source (submit result) | submit normally for outside review |+| SELF_VERIFY | the retained original verifier did not author the merge resubmission (submit result) | submit the changed source for outside review |+| SELF_SESSION_VERIFY | the retained verifier shares no author parent with the resubmitting builder (submit result) | submit for another parent session to review |+| VERIFIER_STANDING | the retained verifier still has independent native standing (submit result) | ask an enrolled outside verifier to review the resubmission |+| PROOF_REQUIRED | a carried acceptance records the actual resolution diff (submit result) | submit with the current CLI or get an outside review || VERDICT_ENVIRONMENT | optional recorded verdict environment contains exact platform, architecture and Node version (accept result) | run the frozen check with current Pullboard, then have an independent reviewer record a fresh verdict with its actual executor environment || LAND_HEADER | a displayed merge command fits the commit-header limit (accept result) | shorten the item title or cited rows so the merge header fits || ENGINE_VERSION | a verdict that implies items replays only under engine 20 or later (accept result) | upgrade Pullboard on every linked device before using --implies |diff --git a/src/board.js b/src/board.jsindex 38e71024..f3f4613c 100644--- a/src/board.js+++ b/src/board.js@@ -115,6 +115,8 @@ import {unreadShoutBindings,} from './shout-audience.js';import { recordVerdict } from './verdict-assurance.js';+import { mergeOnlyBasis, mergeOnlyProblem } from './merge-only-verdict.js';+import { MERGE_ONLY_VERDICT_ENGINE } from './merge-only-verdict-engine.js';import {atomic,logEvent,@@ -1128,14 +1130,20 @@ export function release(board, id, agentId, note = '') {* @param {{ agentId: string, commit: string, tree: string, files?: string[], policyCommit?: string, note?: string }} at - `files`: what the* item's own commits changed since its claim; a rework adds to what the first attempt changed.*/-export function submit(board, id, { agentId, commit, tree, files = [], policyCommit = null, note, submissionProof: proof, infra = null }) {+export function submit(board, id, { agentId, commit, tree, files = [], policyCommit = null, note, submissionProof: proof, infra = null, mergeOnly }) {let recordedProof;if (note !== undefined && (typeof note !== 'string' || !note.trim() || /[\r\n\u2028\u2029]/u.test(note))) {throw new Refused('USAGE', 'a submission note, when present, is one nonempty line');}atomic(board, () => {+ const carry = mergeOnly !== undefined;+ const basis = carry ? mergeOnlyBasis(board, getItem(board, id)) : null;+ const carriedProblem = found => (board.executionEngineVersion ?? ENGINE_VERSION) < MERGE_ONLY_VERDICT_ENGINE+ ? new Refused('MERGE_ONLY_PROOF', 'upgrade Pullboard before carrying an acceptance across a merge')+ : mergeOnlyProblem(board, found, mergeOnly, { agentId, commit, tree, policyCommit });const notYours = () => new Refused('NOT_YOURS', `item #${id} is not claimed by you; claim it first`);moveItem(board, id, 'submit', {+ ...(carry ? { transition: MOVES.find(move => move.verb === 'submit-merge') } : {}),checks: {joined: null, checkProvesSomething: null,barReady: found => barReadyProblem(board, found),@@ -1155,6 +1163,12 @@ export function submit(board, id, { agentId, commit, tree, files = [], policyComgateConfigured: null, queuedItemLease: null,gateGreen: null,treeStillDuringGate: null,+ ...(carry ? {+ mergeOnlyRecorded: carriedProblem,+ atSubmittedCommit: null, // The same post-gate HEAD check binds both submission paths.+ notBuilder: found => itemAuthorProblem(board, found, basis.by),+ proofNoted: () => typeof mergeOnly?.resolutionDiff === 'string' ? null : new Refused('PROOF_REQUIRED', 'record the actual merge resolution diff'),+ } : {}),submissionProofValid: () => {if ((board.executionEngineVersion ?? ENGINE_VERSION) >= SUBMISSION_PROOF_ENGINE) recordedProof = submissionProof(proof);return null;@@ -1177,6 +1191,7 @@ export function submit(board, id, { agentId, commit, tree, files = [], policyCom: null;},},+ before: () => { if (carry) logEvent(board, agentId, 'merge-only-accept', id, { ...mergeOnly, by: basis.by }); },set: (found) => ({item_built_by: agentId,item_builder_family: board.db.prepare('SELECT agent_family FROM agent WHERE agent_id = ?').get(agentId)?.agent_family ?? null,@@ -1186,6 +1201,7 @@ export function submit(board, id, { agentId, commit, tree, files = [], policyComitem_review_by: null,item_review_until: null,item_files: [...new Set([...(found.item_files ?? '').split('\n').filter(Boolean), ...files])].join('\n'),+ ...(carry ? { item_verdict: 'ACCEPT', item_verified_by: basis.by } : {}),}),});const engineVersion = board.executionEngineVersion ?? ENGINE_VERSION;@@ -1197,6 +1213,7 @@ export function submit(board, id, { agentId, commit, tree, files = [], policyCom...(criterionDigest ? { criterionDigest } : {}),...(note === undefined ? {} : { note: note.trim() }),...(recordedProof ? { submissionProof: recordedProof } : {}), ...(infra ? { infra } : {}),+ ...(carry ? { mergeOnly } : {}),});});}@@ -1454,7 +1471,7 @@ export function reopen(board, id, { agentId, note = '', conflict, cause, reopenFif (forWithdrawal) { supersedes = withdrawnVerdict.acceptEventId; return null; }if (found.item_status !== 'verified' || forMerge) return null;const accepted = events(board, { itemId: id }).findLast((event) => {- if (event.event_kind !== 'accept') return false;+ if (!['accept', 'merge-only-accept'].includes(event.event_kind)) return false;return JSON.parse(event.event_detail).commit === found.item_commit;});const recorded = landingBatches(board).flatMap((batch) => (batch.culprits ?? []).map((culprit) => ({ batch, culprit })))diff --git a/src/commands/submit.js b/src/commands/submit.jsindex 112325d9..9468dde6 100644--- a/src/commands/submit.js+++ b/src/commands/submit.js@@ -86,6 +86,9 @@ import {withBoard,} from '../cli.js';import { recordedRecovery } from '../recorded-recovery.js';+import { mergeOnlyBasis } from '../merge-only-verdict.js';+import { captureMergeOnly } from '../merge-only-source.js';+import { itemAuthorProblem } from '../item-authors.js';/*** Submit: a clean tree, nothing untracked, the gate green at HEAD, then the board (V4).@@ -106,7 +109,7 @@ export async function submitHere(ctx, id, infra) {if (recordedRecovery(board, recovered)) return { me, recorded: true };const item = store.getItem(board, id);const trunk = requireTrunkMerge(root, recovered.args[1].commit);- if (barReadySetting(board).enabled && (recovered.args[1].policyCommit !== trunk.commit || !contains(root, trunk.commit, recovered.args[1].commit))) {+ if ((barReadySetting(board).enabled || recovered.args[1].mergeOnly) && (recovered.args[1].policyCommit !== trunk.commit || !contains(root, trunk.commit, recovered.args[1].commit))) {throw new Refused('MAIN_NOT_COMPOSED', 'the unrecorded recovered submission has no proof for current main; run pullboard inbox to synchronize its original receipt, or ask the coordinator to resolve the pending move before a fresh submit; the original request is retained');}refuseUnverifiedStack(root, board, item, recovered.args[1].commit, trunk);@@ -219,9 +222,14 @@ export async function submitHere(ctx, id, infra) {const waivedLines = waived ? waived.map(waiverLine) : [];await withBoard(ctx, async (board) => {refuseUnverifiedStack(root, board, store.getItem(board, id), commit, currentTrunk);+ const basis = mergeOnlyBasis(board, store.getItem(board, id));+ const mergeOnly = gate.isGreen && !waived && basis && !itemAuthorProblem(board, store.getItem(board, id), basis.by)+ && currentTrunk.commit === acceptedMain.commit ? captureMergeOnly(root,+ basis, { commit, tree: headTree(root) ?? '', trunk: currentTrunk.commit }) : null;// The waived run is written to the item's thread before the submission, so no waived proof reads as green.if (waived) await ordered(ctx, board, 'appendFact', [id, { agentId: me.id, kind: 'measurement', text: `submission proof at ${commit.slice(0, 12)} was red and is recorded as waived, not green; every failure is covered by a live person waiver:\n${waivedLines.join('\n')}` }]);return await ordered(ctx, board, 'submit', [id, { agentId: me.id, commit, tree: headTree(root) ?? '', files: filesSince(root, id, claimHead, commit), policyCommit: acceptedMain.commit, ...(infraRecord ? { infra: infraRecord } : {}),+ ...(mergeOnly ? { mergeOnly } : {}),submissionProof: { version: 1, files: gate.files, full: gate.full, deferred: gate.deferred, reason: gate.reason, ...(gate.deferredFiles ? { deferredFiles: gate.deferredFiles } : {}) },...(gate.deferred ? { note: gate.deferredFiles ? deferredSelectionNote(gate.deferredFiles) : 'full suite deferred to the landing gate' } : {}) }]);});diff --git a/src/machine.js b/src/machine.jsindex d1a79f70..4d09b8cb 100644--- a/src/machine.js+++ b/src/machine.js@@ -86,8 +86,8 @@ export const STATES = [{id: 'verified', means: 'another agent accepted it at the submitted commit', requires: ['item_verified_by', 'item_commit'],proof: {- says: 'an ACCEPT at the submitted commit, on the frozen criterion, by the agent it names as verifier, who did not build it',- sql: "EXISTS (SELECT 1 FROM verdict v WHERE v.item_id = NEW.item_id AND v.verdict_decision = 'ACCEPT' AND v.verdict_commit = NEW.item_commit AND v.verdict_digest = NEW.item_frozen_digest AND v.verdict_by = NEW.item_verified_by AND v.verdict_by <> NEW.item_built_by)",+ says: 'an immutable ACCEPT on the frozen criterion by its independent verifier, at this commit or bound by an ordered merge-only receipt',+ sql: "EXISTS (SELECT 1 FROM verdict v WHERE v.item_id = NEW.item_id AND v.verdict_decision = 'ACCEPT' AND v.verdict_digest = NEW.item_frozen_digest AND v.verdict_by = NEW.item_verified_by AND v.verdict_by <> NEW.item_built_by AND (v.verdict_commit = NEW.item_commit OR EXISTS (SELECT 1 FROM event e WHERE e.item_id = NEW.item_id AND e.event_kind = 'merge-only-accept' AND json_extract(e.event_detail,'$.verdict') = v.verdict_id AND json_extract(e.event_detail,'$.commit') = NEW.item_commit AND json_extract(e.event_detail,'$.tree') = NEW.item_tree AND json_extract(e.event_detail,'$.digest') = NEW.item_frozen_digest AND json_extract(e.event_detail,'$.by') = v.verdict_by)))",},},{ id: 'withdrawn', final: true, means: 'nobody should build it; the reason stays on it', requires: ['item_withdrawn_reason'] },@@ -95,6 +95,7 @@ export const STATES = [/** @type {Guard[]} */export const GUARDS = [+ { id: 'mergeOnlyRecorded', refuse: 'MERGE_ONLY_PROOF', rule: 'the exact gated merge carries the unwithdrawn acceptance of the unchanged bar and its recorded conflict resolution', next: 'submit normally for outside review if the merge cannot be proved', source: 'board' },{ id: 'outsideSubmission', refuse: 'OUTSIDE_SOURCE', rule: 'an outside author and exact fetched commit/tree are recorded with a trusted frozen criterion, without pretending a native builder gated it', next: 'fetch and intake the exact GitHub pull request again', source: 'board' },{ id: IN_STATE, refuse: '', rule: "the move can start from the item's current state", next: 'pullboard show <id>', source: 'board' },{ id: 'joined', refuse: 'NOT_JOINED', alsoRefuses: [{ code: 'AGENT_REPLACED', next: 'read the takeover and only shout on its exact hand-off item; continue work from the incoming agent worktree' }, { code: 'SESSION_LEDGER', next: 'make the agent-session ledger named in the message readable and writable by this user, then run the command again' }], rule: 'the caller is the main checkout, or an unreplaced worktree seat that joined a lane; an agent session\'s claims, submits and verdicts can be checked against its local ledger', next: 'pullboard join <lane> --model "<model name>" (see: pullboard lanes)', source: 'cli' },@@ -174,10 +175,21 @@ export const MOVES = [{ verb: 'lapse', from: ['claimed'], to: 'open', by: ['clock'], guards: [], when: 'its lease runs out' },{verb: 'submit', from: ['claimed'], to: 'submitted', by: ['agent', 'coordinator'], refuse: 'NOT_YOURS',- alsoRefuses: [{ code: 'LINE_SETTING_RANGE', rule: 'the recorded board line setting has a valid registry value', next: 'restore the recorded board line setting from its ordered event history, then retry submit' }],+ alsoRefuses: [{ code: 'LINE_SETTING_RANGE', rule: 'the recorded board line setting has a valid registry value', next: 'restore the recorded board line setting from its ordered event history, then retry submit' },+ { code: 'MERGE_ONLY_PROOF', rule: 'a requested carry matches the recorded conflict return, acceptance and exact gated source', next: 'submit normally for outside review' },+ { code: 'SELF_VERIFY', rule: 'the retained original verifier did not author the merge resubmission', next: 'submit the changed source for outside review' },+ { code: 'SELF_SESSION_VERIFY', rule: 'the retained verifier shares no author parent with the resubmitting builder', next: 'submit for another parent session to review' },+ { code: 'VERIFIER_STANDING', rule: 'the retained verifier still has independent native standing', next: 'ask an enrolled outside verifier to review the resubmission' },+ { code: 'PROOF_REQUIRED', rule: 'a carried acceptance records the actual resolution diff', next: 'submit with the current CLI or get an outside review' }],guards: ['joined', 'itemExists', IN_STATE, 'isHolder', 'correctionRefrozen', 'checkProvesSomething', 'barReady', 'criterionUnchanged', 'treeClean', 'nothingUntracked', 'hasCommit', 'withinLane', 'trunkMergeClean', 'trunkInCandidate', 'noUnverifiedStack', 'infraExplained', 'doctrineHolds', 'gateConfigured', 'queuedItemLease', 'gateGreen', 'treeStillDuringGate', 'submissionProofValid', 'childrenDone', 'headIsNew'],sets: ['item_built_by', 'item_commit'], command: 'pullboard submit <id>',},+ {+ verb: 'submit-merge', from: ['claimed'], to: 'verified', by: ['agent', 'coordinator'], refuse: 'NOT_YOURS',+ guards: ['joined', 'itemExists', IN_STATE, 'isHolder', 'correctionRefrozen', 'checkProvesSomething', 'barReady', 'criterionUnchanged', 'treeClean', 'nothingUntracked', 'hasCommit', 'withinLane', 'trunkMergeClean', 'trunkInCandidate', 'noUnverifiedStack', 'infraExplained', 'doctrineHolds', 'gateConfigured', 'queuedItemLease', 'gateGreen', 'treeStillDuringGate', 'submissionProofValid', 'childrenDone', 'headIsNew', 'mergeOnlyRecorded', 'atSubmittedCommit', 'notBuilder', 'proofNoted'],+ sets: ['item_built_by', 'item_commit', 'item_verified_by'], command: 'pullboard submit <id>',+ when: 'only an unchanged accepted bar and a proved trunk-only merge; no new reviewer verdict is created',+ },{verb: 'reserve', from: ['submitted'], to: 'submitted', by: ['agent', 'coordinator'], refuse: 'NOT_SUBMITTED',guards: ['coordinatorSaysAs', 'joined', 'roadmapReadable', 'itemExists', IN_STATE, 'reviewCooldownElapsed', 'notBuilder', 'routeAllows', 'policyAllows', 'familyAllows', 'reviewFree'],diff --git a/src/merge-only-source.js b/src/merge-only-source.jsnew file mode 100644index 00000000..35bb9f35--- /dev/null+++ b/src/merge-only-source.js@@ -0,0 +1,75 @@+/** Bounded Git proof that a resubmission adds only trunk and actual conflict resolutions [V1,V4]. */+import { spawnSync } from 'node:child_process';+import { cleanGitEnvironment } from './git.js';++/** Read immutable objects with fixed merge rules, bounded time/output and no external diff drivers. */+function readGit(root, args, statuses = [0]) {+ const result = spawnSync('git', ['--no-replace-objects', '-c', 'merge.conflictStyle=merge',+ '-c', 'core.attributesFile=/dev/null', ...args], {+ cwd: root, env: cleanGitEnvironment(), encoding: 'utf8', timeout: 5000, maxBuffer: 2 * 1024 * 1024,+ });+ if (result.error || !statuses.includes(result.status)) throw new Error('merge source unavailable');+ return result.stdout;+}++/** Require every changed old line to lie inside a real, unambiguous generated conflict region. */+function conflictEditsOnly(source, patch, accepted, trunk) {+ const ranges = [];+ let start = null;+ let middle = false;+ for (const [index, line] of source.split('\n').entries()) {+ if (line === `<<<<<<< ${accepted}`) {+ if (start !== null) return false;+ start = index + 1; middle = false;+ } else if (line === '=======') {+ if (start === null || middle) return false;+ middle = true;+ } else if (line === `>>>>>>> ${trunk}`) {+ if (start === null || !middle) return false;+ ranges.push([start, index + 1]); start = null;+ } else if (/^(?:<<<<<<<|>>>>>>>)/u.test(line)) return false;+ }+ if (start !== null || !ranges.length) return false;+ const hunks = [...patch.matchAll(/^@@ -(\d+)(?:,(\d+))? \+\d+(?:,\d+)? @@/gmu)];+ return hunks.length > 0 && hunks.every(match => {+ const first = Number(match[1]); const count = match[2] === undefined ? 1 : Number(match[2]);+ return ranges.some(([startLine, endLine]) => count === 0+ ? first >= startLine && first < endLine : first >= startLine && first + count - 1 <= endLine);+ });+}++/** Return a replayable source receipt, or null so an uncertain/changed build gets normal review. */+export function captureMergeOnly(root, basis, { commit, tree, trunk }) {+ if (!basis) return null;+ try {+ // An external merge driver is mutable executable policy, not a proof from immutable trees.+ if (readGit(root, ['config', '--get-regexp', '^merge\\..*\\.driver$'], [0, 1]).trim()) return null;+ const parents = readGit(root, ['show', '-s', '--format=%P', commit]).trim().split(' ');+ if (parents.length !== 2 || parents[0] !== basis.acceptedHead || parents[1] !== trunk) return null;+ readGit(root, ['merge-base', '--is-ancestor', basis.conflict.trunk, trunk]);+ const acceptedTree = readGit(root, ['rev-parse', `${basis.acceptedHead}^{tree}`]).trim();+ if (readGit(root, ['rev-parse', `${commit}^{tree}`]).trim() !== tree) return null;+ const merged = readGit(root, ['merge-tree', '--write-tree', '--name-only', '-z', basis.acceptedHead, trunk], [0, 1]).split('\0');+ const mergeTree = merged.shift();+ if (!/^[a-f0-9]{40,64}$/u.test(mergeTree)) return null;+ const conflicts = merged.slice(0, merged.indexOf(''));+ const changed = readGit(root, ['diff', '--no-ext-diff', '--no-textconv', '--no-renames', '--name-only', '-z', mergeTree, tree, '--']).split('\0').filter(Boolean);+ for (const path of changed) {+ if (!conflicts.includes(path) || !basis.conflict.files.includes(path)) return null;+ const auto = readGit(root, ['ls-tree', '-z', mergeTree, '--', path]);+ const actual = readGit(root, ['ls-tree', '-z', tree, '--', path]);+ if (!/^100(?:644|755) blob /u.test(auto) || auto.slice(0, 6) !== actual.slice(0, 6)) return null;+ const source = readGit(root, ['show', `${mergeTree}:${path}`]);+ if (source.includes('\0')) return null;+ const patch = readGit(root, ['diff', '--no-ext-diff', '--no-textconv', '--no-renames', '--unified=0', mergeTree, tree, '--', path]);+ if (!conflictEditsOnly(source, patch, basis.acceptedHead, trunk)) return null;+ }+ const resolutionDiff = readGit(root, ['diff', '--no-ext-diff', '--no-textconv', '--no-renames', mergeTree, tree, '--']);+ if (resolutionDiff.length > 1024 * 1024) return null;+ const paths = [...new Set([...(basis.review?.paths ?? []), ...readGit(root,+ ['diff', '--no-renames', '--name-only', '-z', trunk, commit, '--']).split('\0').filter(Boolean)])].sort();+ return { version: 1, acceptedCommit: basis.acceptedCommit, acceptedHead: basis.acceptedHead,+ acceptedTree, commit, tree, trunk, mergeTree, digest: basis.digest, verdict: basis.verdict,+ reopen: basis.reopen, paths, resolutionDiff };+ } catch { return null; }+}diff --git a/src/merge-only-verdict-engine.js b/src/merge-only-verdict-engine.jsnew file mode 100644index 00000000..2a19559a--- /dev/null+++ b/src/merge-only-verdict-engine.js@@ -0,0 +1,3 @@+/** A carried acceptance has its own replay meaning [V1,V4,H16]. */+import { unassignedEngine } from './engine-next.js';+export const MERGE_ONLY_VERDICT_ENGINE = unassignedEngine();diff --git a/src/merge-only-verdict.js b/src/merge-only-verdict.jsnew file mode 100644index 00000000..92e81d8c--- /dev/null+++ b/src/merge-only-verdict.js@@ -0,0 +1,35 @@+/** Immutable acceptance provenance for a narrowly proved trunk merge [V1,V4,H16]. */+import { Refused } from './refused.js';+import { acceptedVerdict } from './verdict-reviews.js';++const SHA = /^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u;++/** Find only the latest conflict return and the exact unwithdrawn verdict it superseded. */+export function mergeOnlyBasis(board, item) {+ const last = board.db.prepare("SELECT event_id, event_kind, event_detail FROM event WHERE item_id = ? AND event_kind IN ('reopen','accept','reject','refreeze','merge-only-accept') ORDER BY event_id DESC LIMIT 1").get(item.item_id);+ if (last?.event_kind !== 'reopen') return null;+ const returned = JSON.parse(last.event_detail);+ if (!returned.conflict || !Number.isSafeInteger(returned.supersedes)) return null;+ const accepted = board.db.prepare("SELECT event_detail FROM event WHERE event_id = ? AND item_id = ? AND event_kind IN ('accept','merge-only-accept')").get(returned.supersedes, item.item_id);+ if (!accepted) return null;+ const detail = JSON.parse(accepted.event_detail);+ const verdict = acceptedVerdict(board, { ...item, item_commit: returned.commit });+ if (!verdict || verdict.verdict_digest !== item.item_frozen_digest || detail.commit !== returned.commit || item.item_commit !== returned.commit) return null;+ return { acceptedCommit: returned.commit, acceptedHead: verdict.review?.head ?? returned.commit,+ digest: item.item_frozen_digest, verdict: verdict.verdict_id, by: verdict.verdict_by,+ reopen: last.event_id, conflict: returned.conflict, review: verdict.review ?? null };+}++/** Validate sealed source facts against native history without consulting replica-local Git. */+export function mergeOnlyProblem(board, item, proof, { commit, tree, policyCommit }) {+ const basis = mergeOnlyBasis(board, item);+ const valid = basis && proof && proof.version === 1 && proof.reopen === basis.reopen+ && proof.verdict === basis.verdict && proof.acceptedCommit === basis.acceptedCommit+ && proof.acceptedHead === basis.acceptedHead && proof.digest === basis.digest+ && proof.commit === commit && proof.tree === tree && proof.trunk === policyCommit+ && ['acceptedCommit','acceptedHead','acceptedTree','commit','tree','trunk','mergeTree'].every(key => SHA.test(proof[key] ?? ''))+ && Array.isArray(proof.paths) && proof.paths.every(path => typeof path === 'string' && path && !path.includes('\0'))+ && JSON.stringify(proof.paths) === JSON.stringify([...new Set(proof.paths)].sort())+ && typeof proof.resolutionDiff === 'string' && proof.resolutionDiff.length <= 1024 * 1024;+ return valid ? null : new Refused('MERGE_ONLY_PROOF', 'the carried acceptance must name the current conflict return, immutable verdict, unchanged frozen bar and exact gated merge; submit normally for outside review');+}diff --git a/src/moves/submit.js b/src/moves/submit.jsindex 3600579d..c3be6f9f 100644--- a/src/moves/submit.js+++ b/src/moves/submit.js@@ -1,4 +1,5 @@import { RIGOR_AUTO_ENGINE } from '../rigor-auto-engine.js';+import { MERGE_ONLY_VERDICT_ENGINE } from '../merge-only-verdict-engine.js';/** Routing metadata owned by submit, discovered without a shared registry edit [C7,V4,H16]. */import { BAR_READY_ENGINE } from '../bar-ready-engine.js';import { barReadySetting } from '../bar-ready-setting.js';@@ -26,7 +27,8 @@ function existingEngine(args, board, at) {/** Keep outside-source isolation as the original maximum over the older engine rule. */function minimumEngine(args, board, at) {const outside = board && Boolean(outsideSource(board, args[0]));- return Math.max(outside ? OUTSIDE_INTAKE_ENGINE : 1, existingEngine(args, board, at));+ return Math.max(args[1]?.mergeOnly !== undefined ? MERGE_ONLY_VERDICT_ENGINE : 1,+ outside ? OUTSIDE_INTAKE_ENGINE : 1, existingEngine(args, board, at));}/** Read precisely the actor argument used by this operation [H2,H16]. */@@ -51,6 +53,7 @@ export default Object.freeze({ operation: "submit", order: 15, engine: 1,"LAND_GATE_OUTPUT": "inspect the retained timed gate output directory and free disk space, then start another landing","LAND_TIMEOUT_CUSTODY": "inspect the saved timed gate cleanup state and stop only its proven owned processes before starting another landing","MAIN_NOT_COMPOSED": "merge current main into the candidate, commit the composition and submit again; for an unrecorded recovered move, run pullboard inbox first or ask the coordinator to resolve the pending receipt",+ "MERGE_ONLY_PROOF": "submit the exact gated merge with the unchanged frozen criterion, or leave the new head for outside review","MERGE_CHECK_FAILED": "use Git 2.38 or newer (git --version), then retry","MERGE_CONFLICT": "merge main into your branch, resolve the conflicts, commit, and run the command again","MOVED_DURING_GATE": "leave the worktree alone until the gate finishes, then submit again",diff --git a/src/trunk-conflict.js b/src/trunk-conflict.jsindex a48a207a..9a8d8449 100644--- a/src/trunk-conflict.js+++ b/src/trunk-conflict.js@@ -115,7 +115,7 @@ export function conflictProblem(board, item, conflict, found) {return new Refused('BAD_CONFLICT', 'a trunk conflict names its files and the full trunk commit; run pullboard reopen <id> --conflict <file> from the main checkout');}if (returning) return null;- const accept = board.db.prepare("SELECT event_id FROM event WHERE item_id = ? AND event_kind = 'accept' AND json_extract(event_detail, '$.commit') = ? ORDER BY event_id DESC LIMIT 1").get(item.item_id, item.item_commit);+ const accept = board.db.prepare("SELECT event_id FROM event WHERE item_id = ? AND event_kind IN ('accept','merge-only-accept') AND json_extract(event_detail, '$.commit') = ? ORDER BY event_id DESC LIMIT 1").get(item.item_id, item.item_commit);if (!accept) return new Refused('NOT_ACCEPTED', `item #${item.item_id} has no accept at ${String(item.item_commit).slice(0, 12)}; --conflict reopens accepted work for a main merge`);found(accept.event_id);return null;@@ -153,13 +153,14 @@ export function conflictNote({ files, trunk }) {* returned: a submission sent back before any review (#807), which sets no accept aside.*/export function mainMergeFor(board, id) {- const last = board.db.prepare("SELECT event_detail, event_at FROM event WHERE item_id = ? AND event_kind IN ('reopen', 'accept', 'reject') ORDER BY event_id DESC LIMIT 1").get(id);+ const last = board.db.prepare("SELECT event_detail, event_at FROM event WHERE item_id = ? AND event_kind IN ('reopen', 'accept', 'reject', 'merge-only-accept') ORDER BY event_id DESC LIMIT 1").get(id);const detail = last ? JSON.parse(last.event_detail) : null;if (!detail?.conflict) return null;const returned = !Number.isSafeInteger(detail.supersedes);const accept = returned ? null : board.db.prepare('SELECT event_by, event_detail FROM event WHERE event_id = ?').get(detail.supersedes);+ const accepted = accept ? JSON.parse(accept.event_detail) : null;return { ...detail.conflict, commit: detail.commit, at: last.event_at, returned,- accept: accept ? { by: accept.event_by, commit: JSON.parse(accept.event_detail).commit } : null };+ accept: accept ? { by: accepted.by ?? accept.event_by, commit: accepted.commit } : null };}/**diff --git a/src/verdict-reviews.js b/src/verdict-reviews.jsindex 52051848..1cf1d59b 100644--- a/src/verdict-reviews.js+++ b/src/verdict-reviews.js@@ -37,9 +37,19 @@ export function verdictsFor(board, id) {/** The latest matching acceptance; the submission stays immutable through later re-reviews. */export function acceptedVerdict(board, item) {- const latest = verdictsFor(board, item.item_id).findLast(verdict =>+ const verdicts = verdictsFor(board, item.item_id);+ const latest = verdicts.findLast(verdict =>verdict.verdict_decision === 'ACCEPT' && verdict.verdict_commit === item.item_commit);- return latest?.withdrawn ? undefined : latest;+ if (latest) return latest.withdrawn ? undefined : latest;+ const event = board.db.prepare("SELECT event_detail FROM event WHERE item_id = ? AND event_kind = 'merge-only-accept' AND json_extract(event_detail,'$.commit') = ? ORDER BY event_id DESC LIMIT 1")+ .get(item.item_id, item.item_commit);+ if (!event) return undefined;+ const carry = JSON.parse(event.event_detail);+ const original = verdicts.find(verdict => verdict.verdict_id === carry.verdict && verdict.verdict_decision === 'ACCEPT'+ && verdict.verdict_digest === item.item_frozen_digest && verdict.verdict_by === carry.by);+ if (!original || original.withdrawn) return undefined;+ return { ...original, carried: carry, review: { commit: carry.commit, head: carry.commit,+ trunk: carry.trunk, paths: carry.paths } };}/** The exact checked composition for a new acceptance, or the historical submitted candidate. */diff --git a/src/verdict-withdrawal.js b/src/verdict-withdrawal.jsindex a9002085..a745aa84 100644--- a/src/verdict-withdrawal.js+++ b/src/verdict-withdrawal.js@@ -18,7 +18,8 @@ export function verdictWithdrawals(board, id) {const pair = pairs.find(({ verdict, event }) => verdict.verdict_id === binding.verdictId&& verdict.verdict_decision === 'ACCEPT' && event?.event_id === binding.acceptEventId&& event.event_kind === 'accept' && event.event_id < row.event_id- && verdict.verdict_commit === detail.commit);+ && (verdict.verdict_commit === detail.commit || board.db.prepare("SELECT 1 FROM event WHERE item_id = ? AND event_kind = 'merge-only-accept' AND event_id > ? AND event_id < ? AND json_extract(event_detail,'$.commit') = ? AND json_extract(event_detail,'$.verdict') = ?")+ .get(id, event.event_id, row.event_id, detail.commit, verdict.verdict_id)));if (!pair) continue;result.set(pair.verdict.verdict_id, { eventId: row.event_id, acceptEventId: pair.event.event_id,at: row.event_at, by: row.event_by, note: detail.note });@@ -30,8 +31,12 @@ export function verdictWithdrawals(board, id) {export function verdictWithdrawalTarget(board, item, agentId) {if (item.item_status !== 'verified') throw new Refused('VERDICT_WITHDRAW_STATE', 'withdraw an accepted, unmerged item; use ordinary reopen for a submitted item');const withdrawn = verdictWithdrawals(board, item.item_id);+ const carry = board.db.prepare("SELECT event_detail FROM event WHERE item_id = ? AND event_kind = 'merge-only-accept' AND json_extract(event_detail,'$.commit') = ? ORDER BY event_id DESC LIMIT 1")+ .get(item.item_id, item.item_commit);+ const carriedVerdict = carry ? JSON.parse(carry.event_detail).verdict : null;const pair = verdictPairs(board, item.item_id).findLast(({ verdict, event }) => verdict.verdict_decision === 'ACCEPT'- && verdict.verdict_commit === item.item_commit && event?.event_kind === 'accept' && !withdrawn.has(verdict.verdict_id));+ && (verdict.verdict_commit === item.item_commit || verdict.verdict_id === carriedVerdict)+ && event?.event_kind === 'accept' && !withdrawn.has(verdict.verdict_id));if (!pair) throw new Refused('VERDICT_WITHDRAW_STATE', 'this item has no current acceptance to withdraw; refresh its recorded history');if (agentId !== 'coordinator' && agentId !== pair.verdict.verdict_by) {throw new Refused('VERDICT_WITHDRAW_FORBIDDEN', 'only the accepting reviewer or coordinator can withdraw this verdict; ask that reviewer or the coordinator');diff --git a/test/merge-only-verdict.test.js b/test/merge-only-verdict.test.jsindex b7fe2f88..0f639856 100644--- a/test/merge-only-verdict.test.js+++ b/test/merge-only-verdict.test.js@@ -1,10 +1,13 @@/** Real public submission, Git conflict resolution and immutable verdict coverage [V1,V4,H16]. */import assert from 'node:assert/strict';-import { mkdirSync, writeFileSync } from 'node:fs';+import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs';+import { tmpdir } from 'node:os';import { join } from 'node:path';import { after, test } from 'node:test';import * as store from '../src/board.js';import { createE2eHelpers } from './e2e-helpers.js';+import { captureMergeOnly } from '../src/merge-only-source.js';+import { runFixtureGit, runFixtureChild } from './fixture-child.js';const e2e = createE2eHelpers();after(e2e.cleanup);@@ -76,3 +79,49 @@ test('a merge-only resubmission keeps its accept and records the resolution diffassert.match(shown.out, /verified/u);assert.doesNotMatch(shown.out, /re-review: main merge only/u);});++/** Make a small real Git conflict without pretending these synthetic identities are live reviewers. */+function sourceFixture(t) {+ const root = mkdtempSync(join(tmpdir(), 'pullboard-merge-only-'));+ t.after(() => rmSync(root, { recursive: true, force: true }));+ const env = { ...process.env, GIT_CONFIG_GLOBAL: '/dev/null', GIT_CONFIG_NOSYSTEM: '1',+ GIT_AUTHOR_NAME: 'Merge fixture', GIT_AUTHOR_EMAIL: '[email protected]',+ GIT_COMMITTER_NAME: 'Merge fixture', GIT_COMMITTER_EMAIL: '[email protected]' };+ /** Run only bounded private Git fixture commands. */+ const git = (...args) => runFixtureGit(args, { cwd: root, env, timeout: 5000 });+ /** Commit one literal private file and return its content-addressed commit. */+ const save = (choice, unrelated = 'unchanged', amend = false) => {+ writeFileSync(join(root, 'hot.js'), `const choice = '${choice}';\n${'// stable context\n'.repeat(12)}const behavior = '${unrelated}';\n`);+ git('add', 'hot.js'); git('commit', '-q', ...(amend ? ['--amend'] : []), '-m', 'fixture');+ return git('rev-parse', 'HEAD');+ };+ git('init', '-q', '-b', 'main'); save('base'); git('switch', '-q', '-c', 'candidate');+ const accepted = save('accepted'); git('switch', '-q', 'main'); const trunk = save('trunk');+ git('switch', '-q', 'candidate');+ const merge = runFixtureChild('git', ['merge', '-q', '--no-edit', 'main'], { cwd: root, env, encoding: 'utf8', timeout: 5000 });+ assert.notEqual(merge.status, 0);+ const commit = save('resolved');+ const basis = { acceptedCommit: accepted, acceptedHead: accepted, digest: 'synthetic frozen bar',+ verdict: 1, reopen: 2, conflict: { trunk, files: ['hot.js'] }, review: { paths: ['hot.js'] } };+ /** Capture the exact current commit and tree as the post-gate CLI does. */+ const capture = () => captureMergeOnly(root, basis, { commit: git('rev-parse', 'HEAD'),+ tree: git('rev-parse', 'HEAD^{tree}'), trunk });+ return { root, git, save, accepted, trunk, commit, basis, capture };+}++test('extra behavioral edits in the same conflicted file need outside review [V1,V4]', t => {+ const box = sourceFixture(t);+ assert.ok(box.capture(), 'the actual resolution is eligible');+ box.save('resolved', 'changed behavior', true);+ assert.equal(box.capture(), null, 'a merge commit cannot exempt the whole hot file');+});++test('amended non-merge and stale head or tree proofs cannot retain an accept [V1,V4]', t => {+ const box = sourceFixture(t);+ const proof = box.capture();+ assert.ok(proof);+ assert.equal(captureMergeOnly(box.root, box.basis, { commit: box.commit, tree: box.accepted, trunk: box.trunk }), null);+ box.git('reset', '--hard', box.accepted);+ box.save('resolved', 'unchanged', true);+ assert.equal(box.capture(), null, 'an amended commit without the exact merge parents needs review');+});