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(roadmap): summarize milestone progress and pace [N26]
Corey Olson40850605cacd
diff --git a/docs/api.md b/docs/api.mdindex 725815e3..15d6f5a9 100644--- a/docs/api.md+++ b/docs/api.md@@ -352,7 +352,7 @@ The local board state and events responses include `eventLogVersion`, which idenThe coordinator maintains the roadmap with `milestone add <name> [--note ...] [--items 1,2,3]`, `milestone items <name> --add|--remove ids`, `milestone move <name> --before <other>`, `milestone edit <name> [--name <new>] [--note <text>] [--target <date and time>|none]`, `milestone ship <name> [--next <name>]`, and `milestone remove <name>`. A milestone stores its name, optional note, optional target, its shipment once shipped, and ordered item ids in `board_meta`; removing a milestone leaves its items untouched. A target is stored as ISO time; `--target none` clears it. A `repo#id` reference uses a registered repo's display name (or its folder name) before `#`; its status is read from that board when the repo is registered on this machine.-An item counts as done only once it has landed on main: it is verified and its merge commit is recorded. `pullboard roadmap` prints milestones in order as `N/M landed`, with the target, `past target` for an unshipped milestone whose target has passed, or the commit it shipped at, and each item as `landed`, `accepted` (verified, not landed) or its status. Its JSON results and API state use `{ name, note, target, pastTarget, shipped, items: [{ id, title, status, state }], landed, done, total }` for each milestone: `target` is ISO text or `null`, `shipped` is `{ commit, at, by }` or `null`, `state` is `landed`, `accepted` or the status, and `done` equals `landed`.+An item counts as done only once it has landed on main: it is verified and its merge commit is recorded. `pullboard roadmap` prints milestones in order as `N/M landed`, with the target, `past target` for an unshipped milestone whose target has passed, or the commit it shipped at, and each item as `landed`, `accepted` (verified, not landed) or its status. Its JSON results and API state use `{ name, note, target, pastTarget, shipped, items: [{ id, title, status, state }], landed, done, total }` for each milestone: `target` is ISO text or `null`, `shipped` is `{ commit, at, by }` or `null`, `state` is `landed`, `accepted` or the status, and `done` equals `landed`. Each milestone also carries `summary: { total, left, landed, landing, review, building, held, waiting, needsYou, pace: { last6h, last2h }, estimate }`. The six state counts are exclusive and sum to `total`: landed, accepted but not landed, submitted, live claimed, held, then waiting (including expired claims and unresolved references), in that order of precedence. `left` is total minus landed. Holds include item and lane holds. `needsYou` contains local milestone item ids linked to unanswered person decisions by typed item evidence or explicit local `#N` tokens in the question; repo-qualified and URL references do not link local items. Pace counts this board's distinct currently landed items at the first merged event for their current merge commit, with windows excluding the exact lower boundary. `estimate` is `{ low, high }` hours, from left divided by each window's hourly rate, sorted and rounded to the nearest half hour. A zero two-hour rate uses the positive six-hour rate for both bounds. The estimate is `null` with fewer than three landings in six hours or after shipping. Unshipped milestones print one summary line, including the estimate when available; shipment, targets and item states retain their existing fields.`milestone ship` is the coordinator's move. It records the milestone as shipped at the main checkout's commit and moves every local item that has not landed into the next unshipped milestone after it, or into `--next`, recording a `milestone_moved` event on each moved item's thread. A withdrawn local item stays in place. A `repo#id` reference also stays in place because its board belongs to another repository; every such reference is listed in `notMoved` in JSON and named as “not moved across boards” in text output. Its JSON result is `{ milestone, into, moved, notMoved }`. A shipped milestone takes no new items: `milestone items <name> --add` refuses `MILESTONE_SHIPPED`. Shipping refuses `NO_NEXT_MILESTONE` when unlanded local items have nowhere to go, and `MILESTONE_COMMIT` when main has no commit. Targets and shipping are engine 45 moves.diff --git a/src/cli.js b/src/cli.jsindex 645e34af..6b26246f 100644--- a/src/cli.js+++ b/src/cli.js@@ -2377,6 +2377,12 @@ function readCommands(io, { first, second, rest, values }) {const when = milestone.shipped ? ` · shipped at ${milestone.shipped.commit.slice(0, 12)} on ${milestone.shipped.at}`: milestone.target ? ` · target ${milestone.target}${milestone.pastTarget ? ', past target' : ''}` : '';io.say(`${milestone.name}: ${milestone.landed}/${milestone.total} landed${when}`);+ if (!milestone.shipped) {+ const summary = milestone.summary;+ const estimate = summary.estimate+ ? `; about ${summary.estimate.low} to ${summary.estimate.high} h at today's pace.` : '; estimate unavailable.';+ io.say(` ${summary.left} left of ${summary.total}: ${summary.landed} landed, ${summary.landing} landing, ${summary.review} in review, ${summary.building} building, ${summary.waiting} waiting, ${summary.held} held${estimate}`);+ }if (milestone.note) io.say(` ${milestone.note}`);for (const item of milestone.items) {const id = typeof item.id === 'number' ? `#${item.id}` : item.id;diff --git a/src/roadmap.js b/src/roadmap.jsindex 8fd81488..c56a034d 100644--- a/src/roadmap.js+++ b/src/roadmap.js@@ -7,6 +7,11 @@ import {import {closeBoard,getItem,+ events,+ laneHolds,+ listItems,+ openDecisions,+ PERSON,openBoard,roadmap,} from './board.js';@@ -25,6 +30,7 @@ import { listApiProjects } from './projects.js';export function milestoneRoadmap(root, board, options = {}) {const projects = (options.projects ?? listApiProjects)();let hiddenExternal = 0;+ const externalItems = new Map();const hidden = () => ({ id: `external-${++hiddenExternal}`, title: 'External item', status: 'unavailable' });const resolveExternal = (reference) => {const match = /^(.+)#([1-9]\d*)$/.exec(reference);@@ -39,6 +45,8 @@ export function milestoneRoadmap(root, board, options = {}) {: openBoard(join(info.commonDir, 'pullboard', 'board.sqlite'), undefined, { isMain: codeIsFromMain() });try {const item = getItem(other, Number(number));+ externalItems.set(reference, { item, held: Boolean(item.item_hold_reason)+ || laneHolds(other).some(hold => hold.hold_lane === item.item_lane) });return { id: reference, title: item.item_title, status: item.item_status, landed: Boolean(item.item_merged_commit) };} finally {if (other !== board) closeBoard(other);@@ -47,5 +55,64 @@ export function milestoneRoadmap(root, board, options = {}) {return options.hideOutOfScope ? hidden() : { id: reference, title: `#${number} (${repo})`, status: 'unavailable' };}};- return roadmap(board, resolveExternal);+ const milestones = roadmap(board, resolveExternal);+ const items = new Map(listItems(board, { all: true }).map(item => [item.item_id, item]));+ const holds = new Set(laneHolds(board).map(hold => hold.hold_lane));+ const now = board.clock.now().getTime();+ const pace = landingPace(board, items, now);+ const needsYou = personDecisionItems(board);+ return milestones.map(milestone => {+ const summary = { total: milestone.total, left: milestone.total - milestone.landed,+ landed: 0, landing: 0, review: 0, building: 0, held: 0, waiting: 0,+ needsYou: milestone.items.filter(entry => typeof entry.id === 'number' && needsYou.has(entry.id)).map(entry => entry.id),+ pace: { ...pace }, estimate: null };+ for (const entry of milestone.items) {+ const local = typeof entry.id === 'number' ? items.get(entry.id) : null;+ const external = externalItems.get(entry.id);+ const item = local ?? external?.item;+ const held = local ? Boolean(local.item_hold_reason) || holds.has(local.item_lane) : external?.held;+ const state = entry.state === 'landed' ? 'landed'+ : entry.state === 'accepted' ? 'landing'+ : entry.status === 'submitted' ? 'review'+ : item?.item_status === 'claimed' && Date.parse(item.item_lease_until) > now ? 'building'+ : held ? 'held' : 'waiting';+ summary[state]++;+ }+ if (!milestone.shipped && pace.last6h >= 3) {+ const six = summary.left / (pace.last6h / 6);+ const two = pace.last2h ? summary.left / (pace.last2h / 2) : six;+ summary.estimate = { low: Math.round(Math.min(six, two) * 2) / 2,+ high: Math.round(Math.max(six, two) * 2) / 2 };+ }+ return { ...milestone, summary };+ });+}++/** Count distinct currently landed local items at their first recording of the current merge. */+function landingPace(board, items, now) {+ const first = new Map();+ for (const event of events(board)) {+ if (event.event_kind !== 'merged') continue;+ const item = items.get(event.item_id);+ if (item?.item_status !== 'verified' || !item.item_merged_commit || first.has(event.item_id)) continue;+ if (JSON.parse(event.event_detail).commit !== item.item_merged_commit) continue;+ first.set(event.item_id, Date.parse(event.event_at));+ }+ const times = [...first.values()].filter(at => at <= now);+ return { last6h: times.filter(at => at > now - 6 * 3_600_000).length,+ last2h: times.filter(at => at > now - 2 * 3_600_000).length };+}++/** Associate open person questions with typed item evidence and explicit local item references. */+function personDecisionItems(board) {+ const ids = new Set();+ for (const question of openDecisions(board, PERSON)) {+ if (question.shout_evidence_item) ids.add(question.shout_evidence_item);+ // A local token is separate from a URL or repo-qualified reference.+ for (const match of question.shout_text.matchAll(/(?:^|[\s([{"'`,;:!?])#([1-9]\d*)\b/gu)) {+ const id = Number(match[1]);+ if (Number.isSafeInteger(id)) ids.add(id);+ }+ }+ return ids;}diff --git a/test/roadmap.test.js b/test/roadmap.test.jsnew file mode 100644index 00000000..1aa0c79e--- /dev/null+++ b/test/roadmap.test.js@@ -0,0 +1,143 @@+/** The roadmap summarizes recorded progress without treating acceptance as landing [N26]. */+import assert from 'node:assert/strict';+import { execFileSync } from 'node:child_process';+import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs';+import { tmpdir } from 'node:os';+import { join } from 'node:path';+import { test } from 'node:test';+import * as store from '../src/board.js';+import { main } from '../src/cli.js';+import { milestoneRoadmap } from '../src/roadmap.js';+import { submitFixture } from './board-submit-fixture.js';++const HOUR = 3_600_000;++/** A real Git repository and SQLite board with a shared, controlled command clock. */+function fixture(t) {+ const dir = mkdtempSync(join(tmpdir(), 'pullboard-roadmap-'));+ const repo = join(dir, 'repo');+ mkdirSync(repo);+ const saved = { ...process.env };+ for (const key of Object.keys(process.env)) if (key.startsWith('GIT_')) delete process.env[key];+ Object.assign(process.env, { HOME: join(dir, 'home'), PULLBOARD_HOME: join(dir, 'pullboard-home'),+ PULLBOARD_MACHINE_HOME: join(dir, 'machine-home'), GIT_CONFIG_GLOBAL: '/dev/null', GIT_CONFIG_NOSYSTEM: '1',+ GIT_AUTHOR_NAME: 'Roadmap fixture', GIT_AUTHOR_EMAIL: '[email protected]',+ GIT_COMMITTER_NAME: 'Roadmap fixture', GIT_COMMITTER_EMAIL: '[email protected]' });+ t.after(() => {+ for (const key of Object.keys(process.env)) if (!(key in saved)) delete process.env[key];+ Object.assign(process.env, saved);+ rmSync(dir, { recursive: true, force: true });+ });+ execFileSync('git', ['init', '-q', '-b', 'main', repo]);+ writeFileSync(join(repo, 'SPEC.md'), '# Fixture\n\n## G · Goals\n- G1 [approved, must] Work is tracked. | gate: true\n');+ writeFileSync(join(repo, 'pullboard.json'), JSON.stringify({ gate: 'true', verify: 'any',+ lanes: { web: { owns: ['web/'], specs: ['G1'] }, paused: { owns: ['paused/'], specs: ['G1'] } }, shared: [] }));+ execFileSync('git', ['-C', repo, 'add', '-A']);+ execFileSync('git', ['-C', repo, 'commit', '-qm', 'chore: initialize fixture']);+ const commit = execFileSync('git', ['-C', repo, 'rev-parse', 'HEAD'], { encoding: 'utf8' }).trim();+ let instant = Date.parse('2026-10-17T12:00:00Z');+ const clock = { now: () => new Date(instant) };+ const board = store.openBoard(join(repo, '.git', 'pullboard', 'board.sqlite'), clock);+ t.after(() => store.closeBoard(board));+ store.ensureCoordinator(board, repo);+ const builder = store.register(board, { lane: 'web', path: join(dir, 'builder'), model: 'Fixture Model' });+ /** Advance the board clock without editing its stored records. */+ const at = value => { instant = value; };+ /** File work and advance it through ordinary board operations to the requested state. */+ const item = (state, lane = 'web') => {+ const id = store.addItem(board, { by: 'coordinator', lane, title: state + ' work', criterion: 'Tracked work', specIds: ['G1'] });+ if (['waiting', 'held'].includes(state)) {+ if (state === 'held') store.holdItem(board, id, { agentId: 'coordinator', reason: 'Waiting for a judgment' });+ return id;+ }+ store.claim(board, id, { agentId: builder, lane: 'web', leaseMs: HOUR,+ freeze: () => ({ text: 'Tracked work', digest: 'digest:tracked' }) });+ if (state === 'building') return id;+ submitFixture(board, id, { agentId: builder, commit, tree: 'tree' });+ if (state === 'review') return id;+ store.verify(board, id, { agentId: 'coordinator', decision: 'ACCEPT', note: 'checked it',+ head: commit, digest: 'digest:tracked', policy: 'any' });+ if (state === 'landed') store.merged(board, id, { agentId: 'coordinator', commit });+ return id;+ };+ /** Read the public command with the same clock as the board's projections. */+ const run = async (json = true) => {+ let stdout = ''; let stderr = '';+ const code = await main(['roadmap', ...(json ? ['--json'] : [])], { cwd: repo, clock,+ stdout: { write: value => { stdout += value; } }, stderr: { write: value => { stderr += value; } } });+ assert.equal(code, 0, stdout + stderr);+ return json ? JSON.parse(stdout) : stdout;+ };+ return { repo, board, clock, commit, at, item, run };+}++test('[N26] each milestone sums its items by state with an estimate', async t => {+ const box = fixture(t);+ const now = box.clock.now().getTime();+ const landings = [];+ for (const hours of [7, 6, 4, 3, 1.5, 1, 0.5]) {+ box.at(now - hours * HOUR);+ landings.push(box.item('landed'));+ }+ box.at(now);+ // Recording an old landing again must not turn it into new progress.+ store.merged(box.board, landings[0], { agentId: 'coordinator', commit: box.commit });+ const landing = box.item('landing');+ const review = box.item('review');+ const building = box.item('building');+ const held = box.item('held');+ const waiting = box.item('waiting');+ const ids = [landings.at(-1), landing, review, building, held, waiting];+ store.addMilestone(box.board, { agentId: 'coordinator', name: 'A', items: ids });+ const ask = store.shout(box.board, { from: 'coordinator', to: store.PERSON, lanes: ['web'], decision: true,+ text: `Choose for #${waiting}, #${waiting}; foreign#${review} and https://example.invalid/#${landing} are outside`,+ evidence: { kind: 'attempt', outcome: 'Needs judgment', item: held, commit: box.commit } });+ const expected = { total: 6, left: 5, landed: 1, landing: 1, review: 1, building: 1, held: 1, waiting: 1,+ needsYou: [held, waiting], pace: { last6h: 5, last2h: 3 }, estimate: { low: 3.5, high: 6 } };+ assert.deepEqual((await box.run()).milestones[0].summary, expected);+ assert.match(await box.run(false), /^ 5 left of 6: 1 landed, 1 landing, 1 in review, 1 building, 1 waiting, 1 held; about 3.5 to 6 h at today's pace\.$/m);+ const direct = milestoneRoadmap(box.repo, box.board, { projects: () => [] })[0];+ assert.equal(direct.total, 6);+ assert.equal(direct.done, 1);+ assert.deepEqual(direct.items.map(entry => entry.id), ids, 'existing roadmap fields stay intact');+ assert.equal(['landed', 'landing', 'review', 'building', 'held', 'waiting'].reduce((sum, key) => sum + direct.summary[key], 0), direct.total);+ store.shout(box.board, { from: store.PERSON, to: 'coordinator', lanes: ['web'], answers: ask, text: 'Choose it' });+ assert.deepEqual((await box.run()).milestones[0].summary.needsYou, [], 'answered questions no longer need the person');+ box.at(now + 2 * HOUR);+ const later = (await box.run()).milestones[0].summary;+ assert.equal(later.building, 0, 'an expired claim becomes waiting');+ assert.equal(later.waiting, 2);+ assert.deepEqual(later.pace, { last6h: 4, last2h: 0 });+ assert.deepEqual(later.estimate, { low: 7.5, high: 7.5 }, 'a zero short window uses the positive six-hour rate');+ box.at(now + 6 * HOUR);+ assert.equal((await box.run()).milestones[0].summary.estimate, null, 'fewer than three recent landings has no estimate');+ box.at(now);+ store.addMilestone(box.board, { agentId: 'coordinator', name: 'B', items: [] });+ store.shipMilestone(box.board, 'A', { agentId: 'coordinator', commit: box.commit });+ const shipped = (await box.run()).milestones[0];+ assert.equal(shipped.summary.estimate, null, 'a shipped milestone has no estimate even at a known pace');+ assert.doesNotMatch((await box.run(false)).split('B:')[0], /left of/, 'the shipped milestone has no summary line');+});+++test('[N26] roadmap holds and unavailable scoped references partition without leaking names', async t => {+ const box = fixture(t);+ const now = box.clock.now().getTime();+ const building = box.item('building');+ store.holdItem(box.board, building, { agentId: 'coordinator', reason: 'Next stage waits' });+ const paused = box.item('waiting', 'paused');+ store.holdLane(box.board, 'paused', { agentId: 'coordinator', reason: 'Paused lane' });+ store.addMilestone(box.board, { agentId: 'coordinator', name: 'Scoped', items: [building, paused, 'unregistered-private#7'] });+ const scoped = milestoneRoadmap(box.repo, box.board, { projects: () => [], hideOutOfScope: true })[0];+ assert.equal(scoped.summary.building, 1, 'a live builder takes precedence over a hold');+ assert.equal(scoped.summary.held, 1, 'a held lane counts its open work');+ assert.equal(scoped.summary.waiting, 1, 'an unresolved foreign item remains in the total');+ assert.equal(scoped.summary.total, 3);+ assert.equal(scoped.summary.estimate, null);+ assert.doesNotMatch(JSON.stringify(scoped), /unregistered-private/, 'the summary preserves scoped reference redaction');+ box.at(now + 2 * HOUR);+ const expired = milestoneRoadmap(box.repo, box.board, { projects: () => [], hideOutOfScope: true })[0].summary;+ assert.equal(expired.building, 0);+ assert.equal(expired.held, 2, 'the expired builder is held instead of waiting');+ assert.equal(expired.waiting, 1);+});