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
refactor(merge): separate eligibility from landing refusal [M1,V4]
Corey Olson25d6b4bdf817
diff --git a/src/board.js b/src/board.jsindex 128ee7d5..a61fabc8 100644--- a/src/board.js+++ b/src/board.js@@ -118,7 +118,7 @@ import { recordVerdict } from './verdict-assurance.js';import {mergeOnlyBasis,mergeOnlyProblem,- mergeOnlyLandingProblem,+ mergeOnlySourceValid,} from './merge-only-verdict.js';import { MERGE_ONLY_VERDICT_ENGINE } from './merge-only-verdict-engine.js';import { deriveMergeOnly } from './merge-only-source.js';@@ -1128,7 +1128,7 @@ export function prepareMergeOnlySubmit(board, id, options) {const item = getItem(board, id);const basis = options?.gateGreen === true ? mergeOnlyBasis(board, item) : null;return basis && !itemAuthorProblem(board, item, basis.by)- && !mergeOnlyLandingProblem(board.gitRoot, board, item)+ && mergeOnlySourceValid(board.gitRoot, board, item)? deriveMergeOnly(board.gitRoot, basis, options) : null;}diff --git a/src/merge-only-verdict.js b/src/merge-only-verdict.jsindex bbee7798..598362af 100644--- a/src/merge-only-verdict.js+++ b/src/merge-only-verdict.js@@ -38,23 +38,28 @@ export function mergeOnlyProblem(board, item, proof, { commit, tree, policyCommireturn 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');}-/** Re-prove a canonical carry against immutable Git before physical landing, including adoption. */-export function mergeOnlyLandingProblem(root, board, item, { seen = new Set(), deadline = Date.now() + 10000 } = {}) {+/** Prove the entire retained acceptance chain from immutable Git within one shared deadline. */+export function mergeOnlySourceValid(root, board, item, { seen = new Set(), deadline = Date.now() + 10000 } = {}) {const accepted = acceptedVerdict(board, item);- if (!accepted?.carried) return null;+ if (!accepted?.carried) return true;const proof = accepted.carried;if (seen.has(item.item_commit) || seen.size >= 32 || Date.now() >= deadline) {- return new Refused('STALE_VERDICT', `item #${item.item_id}: the retained acceptance chain cannot be proved within its Git budget; obtain an ordinary outside review`);+ return false;}seen.add(item.item_commit);- const inherited = mergeOnlyLandingProblem(root, board, { ...item, item_commit: proof.acceptedCommit,+ const inherited = mergeOnlySourceValid(root, board, { ...item, item_commit: proof.acceptedCommit,item_tree: proof.acceptedTree, item_merged_commit: null }, { seen, deadline });- if (inherited) return inherited;+ if (!inherited) return false;const event = board.db.prepare("SELECT event_id 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 basis = event && mergeOnlyBasis(board, { ...item, item_commit: proof.acceptedCommit }, { before: event.event_id });const actual = basis && basis.by === proof.by && proof.digest === item.item_frozen_digest? captureMergeOnly(root, basis, { commit: item.item_commit, tree: item.item_tree, trunk: proof.trunk, deadline }) : null;- return actual && Object.entries(actual).every(([key, value]) => JSON.stringify(value) === JSON.stringify(proof[key]))- ? null : new Refused('STALE_VERDICT', `item #${item.item_id}: the recorded merge-only acceptance does not match real Git heads, trees and resolution diff; obtain an ordinary outside review before landing`);+ return Boolean(actual && Object.entries(actual).every(([key, value]) => JSON.stringify(value) === JSON.stringify(proof[key])));+}++/** Convert an invalid local source proof to the landing-only refusal; submit simply needs ordinary review. */+export function mergeOnlyLandingProblem(root, board, item) {+ return mergeOnlySourceValid(root, board, item) ? null+ : new Refused('STALE_VERDICT', `item #${item.item_id}: the recorded merge-only acceptance does not match real Git heads, trees and resolution diff; obtain an ordinary outside review before landing`);}