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.

test(core): do not revive an earlier withdrawn review [V2,V6,H16]

Corey Olson11bfc17b0fcd
diff --git a/test/verdict-withdraw-engine.test.js b/test/verdict-withdraw-engine.test.js
index 2802b7df..c4b58f23 100644
--- a/test/verdict-withdraw-engine.test.js
+++ b/test/verdict-withdraw-engine.test.js
@@ -15,7 +15,7 @@ const e2e = createE2eHelpers();
after(e2e.cleanup);
/** Obtain an accepted snapshot through actual joined Git checkouts and native submission/review. */
-function acceptedSnapshot() {
+function acceptedSnapshot(context = false) {
const box = e2e.project();
assert.equal(box.run(box.repo, 'add', 'web', 'Withdrawal engine fixture', '--specs', 'G1', '--criterion', 'The page renders.').code, 0);
assert.equal(box.run(box.web, 'claim', '1').code, 0);
@@ -29,7 +29,7 @@ function acceptedSnapshot() {
const accepted = box.run(reviewer, 'verify', '1', 'accept', '--note', 'native private check passed', '--json');
assert.equal(accepted.code, 0, accepted.err + accepted.out);
const board = store.openBoard(join(box.repo, '.git', 'pullboard', 'board.sqlite'));
- try { return exportBoard(board); } finally { store.closeBoard(board); }
+ try { return context ? { box, reviewer, snapshot: exportBoard(board) } : exportBoard(board); } finally { store.closeBoard(board); }
}
test('withdrawal true is engine-fenced while false retains historical reopen meaning [V2,V6,H16]', t => {
@@ -67,3 +67,34 @@ test('the API carries withdrawal as a boolean without changing note boundaries [
['reopen', '7', '--note=a note --conflict literal', '--withdraw-verdict', '--json', '--']);
assert.throws(() => moveArgs({ verb: 'reopen', item: 7, args: { 'withdraw-verdict': 'true', note: 'why' } }), /BAD_REQUEST/u);
});
+
+
+test('withdrawing the latest accept never revives an earlier accept of the same commit [V2,V6,H16]', t => {
+ const { box, reviewer } = acceptedSnapshot(true);
+ const trunk = e2e.commitFile(box, box.repo, 'README.md', 'A new private trunk revision.\n', 'docs: move the private review trunk');
+ assert.equal(trunk.status, 0, trunk.stderr);
+ box.git(reviewer, 'merge', '-q', '--no-edit', 'main');
+ const reviewed = box.run(reviewer, 'verify', '1', 'accept', '--note', 'the actual new trunk composition passes', '--json');
+ assert.equal(reviewed.code, 0, reviewed.err + reviewed.out);
+ const board = store.openBoard(join(box.repo, '.git', 'pullboard', 'board.sqlite'));
+ t.after(() => store.closeBoard(board));
+ const rows = board.db.prepare('SELECT * FROM verdict WHERE item_id = ? ORDER BY verdict_id').all(1);
+ assert.equal(rows.length, 2, 'two genuine native reviews bind the same submitted commit to successive trunks');
+ assert.equal(rows[0].verdict_commit, rows[1].verdict_commit);
+ const withdrawn = box.run(reviewer, 'reopen', '1', '--withdraw-verdict', '--note', 'withdraw the latest interpretation', '--json');
+ assert.equal(withdrawn.code, 0, withdrawn.err + withdrawn.out);
+ assert.equal(store.acceptedVerdict(board, store.getItem(board, 1)), undefined,
+ 'withdrawal of the latest current acceptance must not resurrect the older one');
+ assert.deepEqual(board.db.prepare('SELECT * FROM verdict WHERE item_id = ? ORDER BY verdict_id').all(1), rows);
+ box.git(box.web, 'merge', '-q', '--no-edit', 'main');
+ assert.equal(box.run(box.web, 'claim', '1').code, 0);
+ assert.equal(e2e.commitFile(box, box.web, 'web/page.html', '<h1>Corrected</h1>', 'fix(web): honor the clarified interpretation [G1]').status, 0);
+ assert.equal(box.run(box.web, 'submit', '1').code, 0);
+ box.git(reviewer, 'switch', '-q', '--detach', box.git(box.web, 'rev-parse', 'HEAD'));
+ assert.equal(box.run(reviewer, 'next', '--verify', '1').code, 0);
+ const fresh = box.run(reviewer, 'verify', '1', 'accept', '--note', 'the corrected new submission passes', '--json');
+ assert.equal(fresh.code, 0, fresh.err + fresh.out);
+ const current = store.acceptedVerdict(board, store.getItem(board, 1));
+ assert.ok(current.verdict_id > rows[1].verdict_id);
+ assert.equal(current.withdrawn, undefined, 'a genuine later acceptance becomes current normally');
+});