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(view): display supplied milestone summaries [N26]
Corey Olsonaaeff395a3dc
diff --git a/src/cockpit.js b/src/cockpit.jsindex cbb348e1..4bd8f831 100644--- a/src/cockpit.js+++ b/src/cockpit.js@@ -21,6 +21,7 @@ import {hostedState,} from './view/hosted.js';import { staleChip } from './view/stale.js';+import { roadmapSummary } from './view/roadmap-summary.js';import { applyStateDelta } from './api-http.js';/** The CLI's default phrases, ordered by depth for the existing prose inventory guard. */@@ -599,6 +600,7 @@ function shoutAgentName(id) {}/** Render a review note with escaped text and references bound to the selected board. */const verdictHtml = (v, titles) => '<div class="verdict ' + (v.decision === 'ACCEPT' ? 'yes' : 'no') + '"><b>' + esc(v.decision) + ' ' + esc(v.reason) + '</b><span class="by">' + esc(agentName(v.by)) + ' · ' + when(v.at) + ' · at ' + esc(String(v.commit || '').slice(0, 12)) + '</span><div class="note">' + inline(visibleVerdictNote(v.reason, v.note), titles) + '</div></div>';+const roadmapSummary = (${roadmapSummary.toString()});const stateOf = (i) => i.status === 'claimed' ? 'building' : i.status === 'submitted' ? 'verify' : i.status === 'verified' ? 'verified' : i.status === 'withdrawn' ? 'withdrawn' : i.verdict && i.verdict.decision === 'REJECT' ? 'back' : 'open';const STATES = { building: ['building', 'busy'], verify: ['to verify', 'warn'], back: ['sent back', 'no'], verified: ['verified', 'ok'], open: ['unclaimed', 'free'], withdrawn: ['withdrawn', ''] };const chip = (s) => '<span class="chip ' + STATES[s][1] + '">' + STATES[s][0] + '</span>';@@ -2310,7 +2312,7 @@ function milestoneRow(row, titles) {: '<li><button ' + attributes + ' type="button">' + inner + '</button></li>';}-/** Read the work still to ship before verified items, excluding withdrawn work from every count. */+/** Read supplied landed counts and explicit shipments; keep old exports readable and omit withdrawn rows. */function readMilestone(milestone, p) {const visible = milestone.items.map((entry) => milestoneItem(entry, p)).filter((row) => row.state !== 'withdrawn');const verified = visible.filter((row) => row.state === 'verified');@@ -2346,32 +2348,50 @@ function roadmapCards(p, titles) {const milestones = (p.milestones || []).filter((m) => !only || m.name === only);const lead = only ? '<div class="roadmap-only"><span>' + esc(only) + '</span><button class="link" data-roadmap-all type="button">show all</button></div>' : '';const read = milestones.map((milestone) => readMilestone(milestone, p));- const coming = read.filter((m) => !m.shipped && m.rows.length).concat(read.filter((m) => !m.rows.length)), shipped = read.filter((m) => m.shipped).reverse();+ const coming = read.filter((m) => !m.shipped && m.rows.length).concat(read.filter((m) => !m.shipped && !m.rows.length)), shipped = read.filter((m) => m.shipped).reverse();/** Preserve each board's disclosure choices independently. */const isOpen = (key, first) => view.roadmapOpen.has(JSON.stringify([view.root, key])) ? view.roadmapOpen.get(JSON.stringify([view.root, key])) : first;const caret = '<span class="caret" aria-hidden="true"></span>';const next = coming.find((m) => m.rows.length) || null;+ const summaryHeaders = new Map();+ /** Reuse the supplied summary across its header, body and companion panel. */+ const headerFor = (read) => {+ if (!read) return null;+ if (!summaryHeaders.has(read)) summaryHeaders.set(read, roadmapSummary(read.milestone, { time: when, lookup: (id) => {+ const label = typeof id === 'number' ? '#' + id : String(id), row = read.rows.find((row) => row.label === label);+ return row ? { label, title: row.title, id: row.open?.id, address: row.open ? itemAddress(row.open.id, row.open.root) : null, board: row.open?.root !== view.root ? row.open?.root : null } : null;+ } }));+ return summaryHeaders.get(read);+ };const stages = [['open', 'Open'], ['claimed', 'Building'], ['submitted', 'In review'], ['accepted', 'Accepted'], ['merged', 'Landed']];const counts = Object.fromEntries(stages.map(([stage]) => [stage, next ? next.rows.filter((row) => row.stage === stage).length : 0]));- const shippingCounts = '<dl class="roadmap-stage-counts">' + stages.map(([stage, label]) => '<div data-shipping-stage="' + stage + '"><dt>' + label + '</dt><dd>' + counts[stage] + '</dd></div>').join('') + '</dl>';+ const shippingCounts = headerFor(next)+ ? '<dl class="roadmap-stage-counts">' + [['landed','Landed'],['landing','Accepted, landing'],['review','In review'],['building','Building'],['waiting','Waiting'],['held','Held']].map(([key,label]) => '<div data-shipping-stage="' + key + '"><dt>' + label + '</dt><dd>' + next.milestone.summary[key] + '</dd></div>').join('') + '</dl>'+ : '<dl class="roadmap-stage-counts">' + stages.map(([stage, label]) => '<div data-shipping-stage="' + stage + '"><dt>' + label + '</dt><dd>' + counts[stage] + '</dd></div>').join('') + '</dl>';const lastShipped = '<p class="roadmap-last-shipped"><span>Last shipped</span><b>' + esc(shipped[0]?.milestone.name || 'None yet') + '</b>'+ (shipped[0]?.milestone.note ? '<small>' + esc(firstLine(shipped[0].milestone.note)) + '</small>' : '') + '</p>';const mobileShipping = '<section class="roadmap-shipping roadmap-mobile-shipping" aria-label="Shipping counts">' + shippingCounts + lastShipped + '</section>';/** Keep the existing verified-item count beside an upcoming release. */const count = (m) => m.total ? '<span class="milestone-count" aria-label="' + m.done + '/' + m.total + ' landed">' + m.done + '/' + m.total + ' landed</span>' : '';/** Render the existing milestone items, progress and complete note when opened. */- const body = ({ milestone, rows, done, total }) => (rows.length- ? '<svg class="milestone-progress" viewBox="0 0 100 1" preserveAspectRatio="none" role="progressbar" aria-label="' + esc(milestone.name) + ': ' + done + ' of ' + rows.length + ' done" aria-valuemin="0" aria-valuemax="' + rows.length + '" aria-valuenow="' + done + '"><rect width="' + Math.round((100 * done) / total) + '" height="1"/></svg><ul>' + rows.map((row) => milestoneRow(row, titles)).join('') + '</ul>'- : '<p class="milestone-empty">No items yet.</p>')- + (milestone.note ? '<p class="milestone-note">' + rich(milestone.note, titles) + '</p>' : '');+ const body = (read) => {+ const { milestone, rows, done, total } = read;+ const progress = headerFor(read) ? '' : '<svg class="milestone-progress" viewBox="0 0 100 1" preserveAspectRatio="none" role="progressbar" aria-label="' + esc(milestone.name) + ': ' + done + ' of ' + total + ' landed" aria-valuemin="0" aria-valuemax="' + total + '" aria-valuenow="' + done + '"><rect width="' + (total ? (100 * done) / total : 0) + '" height="1"/></svg>';+ return (rows.length ? progress + '<ul>' + rows.map((row) => milestoneRow(row, titles)).join('') + '</ul>' : '<p class="milestone-empty">No items yet.</p>')+ + (milestone.note ? '<p class="milestone-note">' + rich(milestone.note, titles) + '</p>' : '');+ };/** Keep folding consistent with the View's other keyboard-accessible disclosure controls. */const wrap = (tag, classes, key, first, heading, contents, afterHead = '') => {const open = isOpen(key, first);return '<' + tag + ' class="' + classes + '" data-key="' + esc(key) + '"><div class="milestone-head" data-roadmap-key="' + esc(key) + '" role="button" tabindex="0" aria-expanded="' + open + '">' + caret + heading + '</div>' + afterHead + '<div class="milestone-body"' + (open ? '' : ' hidden') + '>' + contents + '</div></' + tag + '>';};/** Open every upcoming milestone by default; the person's current-page fold remains in the view map. */- const card = (m) => wrap('section', 'card-panel milestone', 'm:' + m.milestone.name, true, '<h2>' + linked(m.milestone.name, titles) + '</h2>' + count(m), body(m),- (m.milestone.target ? '<div class="milestone-targetline">Target <time datetime="' + esc(m.milestone.target) + '">' + when(m.milestone.target) + '</time>' + (m.milestone.pastTarget ? ' <span class="chip warn">past target</span>' : '') + '</div>' : '') + (m === next ? mobileShipping : ''));+ const card = (m) => {+ const header = headerFor(m);+ const legacyTarget = m.milestone.target ? '<div class="milestone-targetline">Target <time datetime="' + esc(m.milestone.target) + '">' + when(m.milestone.target) + '</time>' + (m.milestone.pastTarget ? ' <span class="chip warn">past target</span>' : '') + '</div>' : '';+ return wrap('section', 'card-panel milestone' + (header ? ' roadmap-has-summary' : ''), 'm:' + m.milestone.name, true,+ '<h2>' + linked(m.milestone.name, titles) + '</h2>' + (header ? header.count : count(m)), body(m), header ? header.detail : legacyTarget + (m === next ? mobileShipping : ''));+ };/** Summarize one shipped milestone with its first note line and total count. */const line = (m) => wrap('div', 'milestone shipped-one', 'm:' + m.milestone.name, false, '<h2>' + esc(m.milestone.name) + '</h2><small>' + esc(firstLine(m.milestone.note)) + '</small>' + (m.milestone.shipped?.commit ? '<code class="roadmap-shipped-commit" title="' + esc(m.milestone.shipped.commit) + '">' + esc(m.milestone.shipped.commit.slice(0, 12)) + '</code>' : '') + '<span class="milestone-count">' + m.total + (m.total === 1 ? ' item' : ' items') + '</span>', body(m));const releaseButtons = coming.map((m) => {diff --git a/src/view.css b/src/view.cssindex 36128b51..1f087c89 100644--- a/src/view.css+++ b/src/view.css@@ -910,3 +910,26 @@ code.inline.long { white-space: break-spaces; overflow-wrap: anywhere; }.milestone-targetline { margin: 0 14px 10px; color: var(--ink-muted); font-size: 13px; }.roadmap-shipped-commit { flex: none; color: var(--ink-muted); font: 11px var(--mono); }++/* Approved milestone summary: all quantities are supplied by the roadmap API [N26]. */+.roadmap-has-summary > .milestone-head { align-items: flex-start; }+.roadmap-has-summary > .milestone-head h2 { flex: 1; min-width: 0; font-size: 18px; line-height: 1.35; }+.roadmap-left { flex: none; display: grid; gap: 4px; margin-left: auto; text-align: right; white-space: nowrap; }+.roadmap-left > b { font-size: 22px; font-weight: 600; line-height: 1.1; }+.roadmap-left > span { color: var(--ink-muted); font: 12px var(--mono); }+.roadmap-summary { margin: 0 14px 14px; min-width: 0; }+.roadmap-summary-bar { display: flex; height: 10px; margin: 10px 0; border-radius: 5px; }+.roadmap-summary-segment { flex-basis: 0; min-width: 0; }+.roadmap-summary-swatch { display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; }+.roadmap-summary .landed { background: var(--accent); }+.roadmap-summary .landing { background: var(--accent-strong); }+.roadmap-summary .review { background: var(--violet); }+.roadmap-summary .building { background: var(--blue); }+.roadmap-summary .waiting { background: var(--ink-faint); }+.roadmap-summary .held { background: var(--warn); }+.roadmap-summary-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--ink-muted); font-size: 13px; }+.roadmap-summary-legend b { font-weight: 600; color: var(--ink); }+.roadmap-summary-meta { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--ink-muted); font-size: 13px; }+.roadmap-summary-needs { margin-top: 12px; padding: 8px 12px; border-radius: 8px; background: var(--warn-soft); color: var(--warn); font-size: 13px; overflow-wrap: anywhere; }+.roadmap-summary-needs a { color: inherit; }+.shipped-one > .milestone-head h2 { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }diff --git a/src/view/roadmap-summary.js b/src/view/roadmap-summary.jsnew file mode 100644index 00000000..a194ec65--- /dev/null+++ b/src/view/roadmap-summary.js@@ -0,0 +1,23 @@+/** The approved Roadmap header, displaying the backend's summary without deriving board counts [N26]. */+export function roadmapSummary(milestone, context = {}) {+ const escape = text => String(text ?? '').replace(/[&<>"']/g, c => ({'&':'&','<':'<','>':'>','"':'"',"'":'''})[c]);+ const summary = milestone.summary;+ const states = [['landed','landed'],['landing','accepted, landing'],['review','in review'],['building','building'],['waiting','waiting for an agent'],['held','held']];+ const number = value => Number.isInteger(value) && value >= 0;+ if (!summary || !number(summary.total) || !number(summary.left) || states.some(([key]) => !number(summary[key]))) return null;+ const count = '<span class="roadmap-left"><b>'+escape(summary.left)+' left</b><span aria-label="'+escape(summary.landed)+'/'+escape(summary.total)+' landed">'+escape(summary.landed)+' of '+escape(summary.total)+' landed</span></span>';+ const description = states.map(([key,label]) => summary[key]+' '+label).join(', ');+ const bar = '<div class="milestone-progress roadmap-summary-bar" role="img" aria-label="'+escape(milestone.name+': '+description)+'" data-total="'+escape(summary.total)+'">'+states.map(([key]) => '<span class="roadmap-summary-segment '+key+'" data-summary-segment="'+key+'" data-count="'+escape(summary[key])+'" style="flex-grow:'+summary[key]+'"></span>').join('')+'</div>';+ const legend = '<div class="roadmap-summary-legend">'+states.map(([key,label]) => '<span data-summary-state="'+key+'"><i class="roadmap-summary-swatch '+key+'" aria-hidden="true"></i><b>'+escape(summary[key])+'</b> '+label+'</span>').join('')+'</div>';+ const target = milestone.target ? '<span class="roadmap-target">Target <time datetime="'+escape(milestone.target)+'">'+escape(context.time ? context.time(milestone.target) : milestone.target)+'</time>'+(milestone.pastTarget?' <span class="chip warn">past target</span>':'')+'</span>' : '';+ const estimate = summary.estimate, pace = summary.pace;+ const measured = estimate && Number.isFinite(estimate.low) && Number.isFinite(estimate.high) && pace && number(pace.last6h) && number(pace.last2h);+ const forecast = measured ? '<span class="roadmap-estimate">About '+escape(estimate.low)+' to '+escape(estimate.high)+' h at today’s pace</span><span class="roadmap-pace">'+escape(pace.last6h)+' landed in the last 6 h, '+escape(pace.last2h)+' in the last 2 h</span>' : '';+ const meta = target || forecast ? '<div class="roadmap-summary-meta">'+target+forecast+'</div>' : '';+ const needs = Array.isArray(summary.needsYou) ? summary.needsYou.map(id => {+ const item = context.lookup ? context.lookup(id) : null;+ const text = escape(item?.label || '#'+id)+(item?.title?' '+escape(item.title):'');+ return item?.address ? '<a class="ref" href="'+escape(item.address)+'" data-go="item:'+escape(item.id)+'"'+(item.board?' data-board="'+escape(item.board)+'"':'')+'>'+text+'</a>' : '<span>'+text+'</span>';+ }).join(', ') : '';+ return { count, detail: '<div class="roadmap-summary">'+bar+legend+meta+(needs?'<div class="roadmap-summary-needs"><b>Needs you:</b> '+needs+'</div>':'')+'</div>' };+}diff --git a/test/cockpit/roadmap.test.js b/test/cockpit/roadmap.test.jsindex 4a314011..a1a55ff1 100644--- a/test/cockpit/roadmap.test.js+++ b/test/cockpit/roadmap.test.js@@ -860,11 +860,13 @@ test('the roadmap shows landed, accepted and past target [N26]', { timeout: 90_0box.run(alpha.repo,'milestone','add','Shipped release','--items','4');box.run(alpha.repo,'milestone','add','State summary','--items','5,6,7,8,9,10');box.run(alpha.repo,'milestone','ship','Shipped release','--next','State summary');+ box.run(alpha.repo,'milestone','add','Empty shipped');+ box.run(alpha.repo,'milestone','ship','Empty shipped','--next','State summary');const shipped=box.git(alpha.repo,'rev-parse','HEAD');const view=await startView(box),profile=mkdtempSync(join(tmpdir(),'pullboard-roadmap-truth-'));let chrome;const milestone=name=>`document.querySelector('[data-key="m:${name}"]')`;try {- chrome=await openSnapshotChrome(executable,view.link.href,profile);await chrome.waitFor('data?.project?.milestones?.length===3');+ chrome=await openSnapshotChrome(executable,view.link.href,profile);await chrome.waitFor('data?.project?.milestones?.length===4');// Temporary #820 contract fixture for the permitted parallel build. Its shape is provisional until the backend lands; this is not real CLI summary proof.await chrome.stable(`(()=>{const m=data.project.milestones.find(m=>m.name==='State summary');m.summary={total:6,left:5,landed:1,landing:1,review:1,building:1,waiting:1,held:1,needsYou:[9],pace:{last6h:3,last2h:3},estimate:{low:3.5,high:10}};return true})()`);await press(chrome,"document.querySelector('[data-tab=roadmap]')");@@ -876,6 +878,8 @@ test('the roadmap shows landed, accepted and past target [N26]', { timeout: 90_0await press(chrome,"document.querySelector('[data-key=shipped] > .milestone-head')");await chrome.waitFor(`${milestone('Shipped release')}?.querySelector('.milestone-head')`);assert.match(await chrome.stable(`${milestone('Shipped release')}.textContent`),new RegExp(shipped.slice(0,12)),'the shipped release names its actual commit');+ assert.equal(await chrome.stable(`${milestone('Empty shipped')}.closest('.shipped')!==null`),true,'an empty shipped milestone appears only under Shipped');+ assert.equal(await chrome.stable("document.querySelectorAll('[data-key=\"m:Empty shipped\"]').length"),1,'an empty shipment is not repeated among upcoming releases');for(const width of [375,1280]) {await chrome.send('Emulation.setDeviceMetricsOverride',{width,height:950,deviceScaleFactor:1,mobile:false});for(const scheme of ['light','dark']) {