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(board): version roadmap review selection [B16,H16,M1]

Corey Olson21af099b5eab
diff --git a/docs/formats.md b/docs/formats.md
index 4382c896..33521c5f 100644
--- a/docs/formats.md
+++ b/docs/formats.md
@@ -76,10 +76,10 @@ The board file is in the repository's Git common directory at `.git/pullboard/bo
| `row grammar` | `1` | `SPEC_GRAMMAR_VERSION` in `src/spec.js`; optional `<!-- pullboard-grammar N -->` line in either file (absence means the current grammar) | Both files share the version. A declared version must match; an incompatible grammar change requires a coordinated version bump and compatible files. No automatic conversion occurs. |
| `board schema` | `2` | `SCHEMA_VERSION` in `src/board.js`, persisted as `PRAGMA user_version` | Create missing tables and indexes, add missing columns in place with declared defaults, restore missing or changed triggers, and remove stale machine triggers without replacing rows. |
| `event log` | `1` | `EVENT_LOG_VERSION` in `src/board.js`, persisted in `board_meta` as `event_log_version` | Older event-log versions upgrade in place; newer versions are refused with `EVENT_LOG_VERSION`. Preserve event rows when the board schema changes. |
-| `move engine` | `6` | `ENGINE_VERSION` in `src/machine.js`, carried as `engine` in every sealed executable move | Bump when a move's meaning changes, independently of the event log and sealed envelope. A newer engine is refused with `ENGINE_VERSION`, naming both versions and asking you to upgrade Pullboard. |
+| `move engine` | `8` | `ENGINE_VERSION` in `src/machine.js`, carried as `engine` in every sealed executable move | Bump when a move's meaning changes, independently of the event log and sealed envelope. A newer engine is refused with `ENGINE_VERSION`, naming both versions and asking you to upgrade Pullboard. |
<!-- format-versions:end -->
-Pullboard 0.6.1 released engine 1. Engine 2 records a fresh explicit-build claim's skipped-review snapshot. Pullboard 0.8.1 released engine 3, including lane-sensitive graft refusals and authenticated relay senders. Engine 4 adds captured background-baseline completions through `completeCheckBaseline`; released engine-3 clients stop with `ENGINE_VERSION` before interpreting this new operation or advancing their replay cursor. Engine 5 requires a one-line reason when releasing a review and gives that reviewer a one-hour cooldown for the current submission. Each sealed move replays under its recorded engine version: engines 1 through 4 retain the original release event and review-reservation behavior. Engine 5 retains support for older moves, including engine-4 baseline completions. Engine 6 adds board-scoped machine credentials and permits machine execution only for one exact, earlier authenticated phone request, including its payload digest. Older request receipts retain their recorded engine semantics. Upgrade every linked device before using the new moves.
+Pullboard 0.6.1 released engine 1. Engine 2 records a fresh explicit-build claim's skipped-review snapshot. Pullboard 0.8.1 released engine 3, including lane-sensitive graft refusals and authenticated relay senders. Engine 4 adds captured background-baseline completions through `completeCheckBaseline`; released engine-3 clients stop with `ENGINE_VERSION` before interpreting this new operation or advancing their replay cursor. Engine 5 requires a one-line reason when releasing a review and gives that reviewer a one-hour cooldown for the current submission. Each sealed move replays under its recorded engine version: engines 1 through 4 retain the original release event and review-reservation behavior. Engine 5 retains support for older moves, including engine-4 baseline completions. Engine 6 adds board-scoped machine credentials and permits machine execution only for one exact, earlier authenticated phone request, including its payload digest. Older request receipts retain their recorded engine semantics. Pullboard 0.8.3 released engine 6. Engine 7 adds item holds. Engine 8, shared by the 0.8.5 move changes, retains merged-item exception notes and selects the next review in roadmap order; recorded engines 1 through 7 retain their original tier-first review selection. Upgrade every linked device before using the new moves.
The CLI declares its engine in every relay request's `X-Pullboard-Engine` header.
A linked board requires at least engine 3 after issuing any agent token, including
diff --git a/docs/lifecycle.md b/docs/lifecycle.md
index e14b9e4c..5d06e844 100644
--- a/docs/lifecycle.md
+++ b/docs/lifecycle.md
@@ -53,7 +53,7 @@ Each move checks its guards in this order and refuses with the first one that do
| release | claimed | open | agent, coordinator | joined (NOT_JOINED), itemExists (NO_ITEM), inState (NOT_YOURS), isHolder (NOT_YOURS), reviewReleaseExplained (NOTE_REQUIRED) |
| lapse | claimed | open | clock, when its lease runs out | none |
| submit | claimed | submitted | agent, coordinator | joined (NOT_JOINED), itemExists (NO_ITEM), inState (NOT_YOURS), isHolder (NOT_YOURS), criterionUnchanged (CRITERIA_CHANGED), treeClean (DIRTY), nothingUntracked (UNTRACKED), hasCommit (NO_COMMIT), 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), gateConfigured (NO_GATE), gateGreen (GATE_RED or PIPEFAIL_UNAVAILABLE), treeStillDuringGate (MOVED_DURING_GATE), childrenDone (CHILDREN_OPEN), headIsNew (HEAD_NOT_NEW) |
-| reserve | submitted | submitted | agent, coordinator | coordinatorSaysAs (MAIN_IS_COORDINATOR), joined (NOT_JOINED), itemExists (NO_ITEM), inState (NOT_SUBMITTED), reviewCooldownElapsed (REVIEW_COOLDOWN), notBuilder (SELF_VERIFY), routeAllows (ROUTE), policyAllows (COORDINATOR_VERIFIES), familyAllows (O2_FAMILY_MATCH), reviewFree (REVIEW_HELD) |
+| reserve | submitted | submitted | agent, coordinator | coordinatorSaysAs (MAIN_IS_COORDINATOR), joined (NOT_JOINED), roadmapReadable (MILESTONES_CORRUPT), itemExists (NO_ITEM), inState (NOT_SUBMITTED), reviewCooldownElapsed (REVIEW_COOLDOWN), notBuilder (SELF_VERIFY), routeAllows (ROUTE), policyAllows (COORDINATOR_VERIFIES), familyAllows (O2_FAMILY_MATCH), reviewFree (REVIEW_HELD) |
| accept | submitted | verified | agent, coordinator | coordinatorSaysAs (MAIN_IS_COORDINATOR), joined (NOT_JOINED), itemExists (NO_ITEM), inState (NOT_SUBMITTED), atSubmittedCommit (NOT_AT_COMMIT or OUTSIDE_LANE or NO_POLICY or BAD_CONFIG or GIT_GRAFTS), notBuilder (SELF_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), itemCheckGreen (CHECK_RED or CHECK_UNVERIFIED), proofNoted (PROOF_REQUIRED) |
| reject | submitted | open | agent, coordinator | coordinatorSaysAs (MAIN_IS_COORDINATOR), joined (NOT_JOINED), itemExists (NO_ITEM), inState (NOT_SUBMITTED), atSubmittedCommit (NOT_AT_COMMIT or OUTSIDE_LANE or NO_POLICY or BAD_CONFIG or GIT_GRAFTS), notBuilder (SELF_VERIFY), routeAllows (ROUTE), policyAllows (COORDINATOR_VERIFIES), familyAllows (O2_FAMILY_MATCH), reviewFree (REVIEW_HELD), criterionUnchanged (CRITERIA_CHANGED), reasonCoded (BAD_REASON), noteGiven (NOTE_REQUIRED) |
| escalate | open, claimed | open | agent, coordinator | joined (NOT_JOINED), noteGiven (NOTE_REQUIRED), itemExists (NO_ITEM), holderOrCoordinator (NOT_YOURS), inState (CLOSED) |
@@ -83,6 +83,7 @@ Each move checks its guards in this order and refuses with the first one that do
| NOT_JOINED | the caller is the main checkout, or a worktree that joined a lane | pullboard join <lane> (see: pullboard lanes) |
| NO_ITEM | the item exists | pullboard list --all |
| COORDINATOR_ONLY | the caller is the coordinator | run it from the main checkout |
+| MILESTONES_CORRUPT | the roadmap is readable when selecting the next review, only next --verify selection; a review reserved by id does not consult the roadmap | restore board metadata from a known-good board export |
| MAIN_IS_COORDINATOR | in the main checkout, the caller says it is the coordinator | verify from your own worktree; the coordinator adds --as coordinator |
| NOT_YOURS | the caller holds the item, or is the coordinator | shout its holder, or the coordinator |
| NOT_YOURS | the caller holds the claim | pullboard claim <id> |
diff --git a/src/board.js b/src/board.js
index 10c11c1a..8a4f28d8 100644
--- a/src/board.js
+++ b/src/board.js
@@ -1238,6 +1238,7 @@ function reserveWithin(board, id, { agentId, leaseMs, policy, familyPolicy = 'of
checks: {
coordinatorSaysAs: null,
joined: null,
+ roadmapReadable: null, // Selection reads it before this move; explicit ids need no roadmap.
[IN_STATE]: (found) => new Refused('NOT_SUBMITTED', `item #${id} is ${current(board, found).item_status}, not submitted`),
/** Enforce the cooldown after state validation and before reviewer eligibility [V1]. */
reviewCooldownElapsed: () => {
@@ -1771,6 +1772,7 @@ export function appendFact(board, id, { agentId, kind, text, ref = null, superse
* @returns {(entry: any) => number}
*/
function milestonePriorities(board) {
+ if ((board.executionEngineVersion ?? ENGINE_VERSION) < 8) return () => 0;
const ordered = milestones(board);
const items = new Map(listItems(board, { all: true }).map((entry) => [entry.item_id, entry]));
const priorities = new Map();
diff --git a/src/machine.js b/src/machine.js
index af8f5040..5235a495 100644
--- a/src/machine.js
+++ b/src/machine.js
@@ -10,7 +10,7 @@
*/
/** Executable move semantics, carried by every sealed move and retained during replay [H16]. */
-export const ENGINE_VERSION = 6;
+export const ENGINE_VERSION = 8;
/** @typedef {'agent' | 'coordinator' | 'clock'} Role */
@@ -99,6 +99,7 @@ export const GUARDS = [
{ id: 'joined', refuse: 'NOT_JOINED', rule: 'the caller is the main checkout, or a worktree that joined a lane', next: 'pullboard join <lane> (see: pullboard lanes)', source: 'cli' },
{ id: 'itemExists', refuse: 'NO_ITEM', rule: 'the item exists', next: 'pullboard list --all', source: 'board' },
{ id: 'coordinatorOnly', refuse: 'COORDINATOR_ONLY', rule: 'the caller is the coordinator', next: 'run it from the main checkout', source: 'board' },
+ { id: 'roadmapReadable', refuse: 'MILESTONES_CORRUPT', rule: 'the roadmap is readable when selecting the next review', next: 'restore board metadata from a known-good board export', source: 'board', when: 'only next --verify selection; a review reserved by id does not consult the roadmap' },
{ id: 'coordinatorSaysAs', refuse: 'MAIN_IS_COORDINATOR', rule: 'in the main checkout, the caller says it is the coordinator', next: 'verify from your own worktree; the coordinator adds --as coordinator', source: 'cli' },
{ id: 'holderOrCoordinator', refuse: 'NOT_YOURS', rule: 'the caller holds the item, or is the coordinator', next: 'shout its holder, or the coordinator', source: 'board' },
{ id: 'isHolder', refuse: 'NOT_YOURS', rule: 'the caller holds the claim', next: 'pullboard claim <id>', source: 'board' },
@@ -154,7 +155,7 @@ export const MOVES = [
},
{
verb: 'reserve', from: ['submitted'], to: 'submitted', by: ['agent', 'coordinator'], refuse: 'NOT_SUBMITTED',
- guards: ['coordinatorSaysAs', 'joined', 'itemExists', IN_STATE, 'reviewCooldownElapsed', 'notBuilder', 'routeAllows', 'policyAllows', 'familyAllows', 'reviewFree'],
+ guards: ['coordinatorSaysAs', 'joined', 'roadmapReadable', 'itemExists', IN_STATE, 'reviewCooldownElapsed', 'notBuilder', 'routeAllows', 'policyAllows', 'familyAllows', 'reviewFree'],
sets: ['item_review_by', 'item_review_until'], command: 'pullboard next --verify',
},
{
diff --git a/test/machine.test.js b/test/machine.test.js
index 64a956a3..9a1a54c3 100644
--- a/test/machine.test.js
+++ b/test/machine.test.js
@@ -780,11 +780,11 @@ test('pullboard help lists each role\'s moves from the declaration, and pullboar
assert.equal(printed.stdout, lifecycleMarkdown());
});
-/** Guards the CLI checks before it asks the board: the board's own order starts after them. */
-const CLI_CHECKED = {
+/** Guards checked before the explicit transition: CLI facts and optional roadmap selection. */
+const PRECHECKED = {
claim: ['joined'],
submit: ['joined', 'criterionUnchanged', 'treeClean', 'nothingUntracked', 'hasCommit', 'withinLane', 'trunkMergeClean', 'gateConfigured', 'gateGreen', 'treeStillDuringGate'],
- reserve: ['coordinatorSaysAs', 'joined'],
+ reserve: ['coordinatorSaysAs', 'joined', 'roadmapReadable'],
accept: ['coordinatorSaysAs', 'joined', 'atSubmittedCommit', 'trunkMergeClean', 'itemCheckGreen'],
reject: ['coordinatorSaysAs', 'joined', 'atSubmittedCommit'],
};
@@ -798,7 +798,7 @@ const CLI_CHECKED = {
function declaredBoardOrder(verb) {
const move = moveOf(MACHINE, verb);
return effectiveGuards(move)
- .filter((id) => !CLI_CHECKED[verb].includes(id))
+ .filter((id) => !PRECHECKED[verb].includes(id))
.map((id) => (id === IN_STATE ? move.refuse : MACHINE.guards.find((guard) => guard.id === id).refuse));
}
diff --git a/test/next-order.test.js b/test/next-order.test.js
index 005198bb..810050b6 100644
--- a/test/next-order.test.js
+++ b/test/next-order.test.js
@@ -2,6 +2,8 @@
import assert from 'node:assert/strict';
import { test } from 'node:test';
import * as store from '../src/board.js';
+import { applyEngineMove, prepareEngineMove } from '../src/engine.js';
+import { ENGINE_VERSION } from '../src/machine.js';
const HOUR = 60 * 60 * 1000;
const MID_ITEM_DETAILS = {
@@ -91,3 +93,20 @@ test('a builder gets the earliest milestone\'s open items first [B16]', (t) => {
assert.equal(resumed.item.item_id, sameMilestoneStrong, 'an existing held claim still resumes first');
assert.notEqual(resumed.item.item_id, unlistedStrong);
});
+
+test('recorded reserve-next moves retain their versioned ordering [B16,H16]', (t) => {
+ assert.ok(ENGINE_VERSION >= 8, 'roadmap selection is carried by engine 8 or newer');
+ for (const version of [1, 2, 3, 4, 5, 6, 7, ENGINE_VERSION]) {
+ const { board, builder, reviewer } = boardFixture();
+ t.after(() => store.closeBoard(board));
+ const laterStrong = submitted(board, builder, 'later strong', 'strong', 1);
+ const earliestMid = submitted(board, builder, 'earliest mid', 'mid', 2);
+ store.addMilestone(board, { agentId: 'coordinator', name: 'first', items: [earliestMid] });
+ store.addMilestone(board, { agentId: 'coordinator', name: 'later', items: [laterStrong] });
+ const move = prepareEngineMove(board, 'reserveNextReview', [{ agentId: reviewer, lane: 'review', leaseMs: HOUR, policy: 'any' }]);
+ assert.equal(move.engine, ENGINE_VERSION, 'new moves carry the current engine');
+ const outcome = applyEngineMove(board, { ...move, engine: version }, { sequence: 1, at: new Date().toISOString() });
+ assert.equal(outcome.error, undefined, JSON.stringify(outcome.error));
+ assert.equal(outcome.result.item.item_id, version < 8 ? laterStrong : earliestMid, `engine ${version} retains its recorded selection`);
+ }
+});