Skip to content

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.

fix(cli): separate writer setup from read imports [C7,N14,N19]

Corey Olson4afa0fe21005
diff --git a/src/board.js b/src/board.js
index 4e635dc7..6b0786a2 100644
--- a/src/board.js
+++ b/src/board.js
@@ -165,8 +165,8 @@ import { recordVerdict } from './verdict-assurance.js';
import {
mergeOnlyBasis,
mergeOnlyProblem,
- prepareMergeOnlySubmit,
} from './merge-only-verdict.js';
+import { prepareMergeOnlySubmit } from './merge-only-submit.js';
import { MERGE_ONLY_VERDICT_ENGINE } from './merge-only-verdict-engine.js';
import {
atomic,
diff --git a/src/merge-only-submit.js b/src/merge-only-submit.js
new file mode 100644
index 00000000..a9ca4c9f
--- /dev/null
+++ b/src/merge-only-submit.js
@@ -0,0 +1,21 @@
+/** Writer-only carry preparation stays outside the read-side verdict import graph [C7,V4,H16]. */
+import { deriveMergeOnly } from './merge-only-source.js';
+import {
+ mergeOnlyBasis,
+ mergeOnlySourceValid,
+} from './merge-only-verdict.js';
+import { retainedVerifierIdentityProblem } from './item-authors.js';
+import { getItem } from './board-query.js';
+
+/** Derive the origin’s carry before sealing; caller-supplied carry facts are discarded. */
+export function prepareMergeOnlySubmit(board, id, options) {
+ if (options?.gateGreen !== true) return null;
+ // An absent item remains a replay-time refusal, not a new pre-transport policy.
+ const held = board.db.prepare('SELECT * FROM item WHERE item_id = ?').get(id);
+ const basis = held ? mergeOnlyBasis(board, held) : null;
+ if (!basis) return null;
+ const item = getItem(board, id);
+ return !retainedVerifierIdentityProblem(board, item, basis.by)
+ && mergeOnlySourceValid(board.gitRoot, board, item)
+ ? deriveMergeOnly(board.gitRoot, basis, options) : null;
+}
diff --git a/src/merge-only-verdict.js b/src/merge-only-verdict.js
index adf58c8a..598362af 100644
--- a/src/merge-only-verdict.js
+++ b/src/merge-only-verdict.js
@@ -1,29 +1,11 @@
/** Immutable acceptance provenance for a narrowly proved trunk merge [V1,V4,H16]. */
import { createHash } from 'node:crypto';
-import {
- captureMergeOnly,
- deriveMergeOnly,
-} from './merge-only-source.js';
+import { captureMergeOnly } from './merge-only-source.js';
import { Refused } from './refused.js';
import { acceptedVerdict } from './verdict-reviews.js';
-import { retainedVerifierIdentityProblem } from './item-authors.js';
-import { getItem } from './board-query.js';
const SHA = /^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u;
-/** Derive the origin’s carry before sealing; caller-supplied carry facts are discarded. */
-export function prepareMergeOnlySubmit(board, id, options) {
- if (options?.gateGreen !== true) return null;
- // An absent item remains a replay-time refusal, not a new pre-transport policy.
- const held = board.db.prepare('SELECT * FROM item WHERE item_id = ?').get(id);
- const basis = held ? mergeOnlyBasis(board, held) : null;
- if (!basis) return null;
- const item = getItem(board, id);
- return !retainedVerifierIdentityProblem(board, item, basis.by)
- && mergeOnlySourceValid(board.gitRoot, board, item)
- ? deriveMergeOnly(board.gitRoot, basis, options) : null;
-}
-
/** Find only the latest conflict return and the exact unwithdrawn verdict it superseded. */
export function mergeOnlyBasis(board, item, { before = Number.MAX_SAFE_INTEGER } = {}) {
const last = board.db.prepare("SELECT event_id, event_kind, event_detail FROM event WHERE item_id = ? AND event_id < ? AND event_kind IN ('reopen','accept','reject','refreeze','merge-only-accept') ORDER BY event_id DESC LIMIT 1").get(item.item_id, before);
diff --git a/test/e2e-runner.test.js b/test/e2e-runner.test.js
index 5cdb1ad4..ea5ae8bd 100644
--- a/test/e2e-runner.test.js
+++ b/test/e2e-runner.test.js
@@ -84,7 +84,7 @@ test('run builds routed items unattended: the failure feeds the next attempt; re
assert.match(box.run(light, 'run', '--agent-mid', `sh ${agent}`).err, /ROUTE.*joined on the light route, so it cannot take mid items/);
const ran = box.run(light, 'run', '--agent-light', `sh ${agent}`, '--attempts', '2', '--minutes', '2');
assert.equal(ran.code, 0, ran.err);
- assert.match(ran.out, /#1 attempt 1: red[\s\S]*#1 attempt 2: green \(agent \d+s, check \d+s\)\nsubmitted #1/);
+ assert.match(ran.out, /#1 attempt 1: red[\s\S]*#1 attempt 2: green \(agent \d+s, check \d+s\)\n[1-9]\d* lane updates; details remain on the board\nsubmitted #1 at [0-9a-f]{12};/);
assert.match(ran.out, /nothing left to run: no open light runnable items in the web lane/);
assert.match(ran.out, /#2 attempt 2: red[\s\S]*#2 escalated light -> mid; the attempt is pinned at refs\/pullboard\/attempts\/2\//);
assert.match(ran.out, /runner done: 1 submitted, 1 escalated/);
@@ -265,7 +265,7 @@ test('resume puts an agent back to work from the board: its claim, its branch, w
box.git(box.repo, 'switch', '-q', 'main');
assert.match(box.run(box.web, 'resume').out, /branch web\/one: 1 ahead of main, 0 behind/);
assert.match(back, /sent back: #1 TEST_FAILURE by coordinator \(unknown\): no test proves the heading$/m);
- assert.match(back, /next: pullboard claim 1, fix what the verifier found, and submit again/);
+ assert.match(back, /^next: pullboard next; pullboard claim 1, fix what the verifier found, and submit again$/m);
});
test('next takes work near your recent files; submit records them; show names related verified work [N20, N21]', () => {