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.

feat(view): a blocked roadmap row shows a dot and unfolds why [N26]

Corey Olson1a2056c00709
diff --git a/src/cockpit.js b/src/cockpit.js
index 0078da05..6463f100 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 { roadmapBlock } from './view/roadmap-block.js';
/** The CLI's default phrases, ordered by depth for the existing prose inventory guard. */
export const PULLBOARD_COMMANDS = Object.freeze(commandPhrases().sort((left, right) => right.split(' ').length - left.split(' ').length));
@@ -570,6 +571,8 @@ const STATES = { building: ['building', 'busy'], verify: ['to verify', 'warn'],
const chip = (s) => '<span class="chip ' + STATES[s][1] + '">' + STATES[s][0] + '</span>';
// A verified item's stale mark from src/view/stale.js (#726): Core publishes verdictState and the page only draws it.
const staleChip = (${staleChip.toString()});
+// A roadmap item's blocker dot and unfolded reason from src/view/roadmap-block.js (#605), read from the summaries held.
+const roadmapBlock = (${roadmapBlock.toString()});
/** Parse the bounded reference syntax before requesting additional committed line windows. */
function codeReferenceParts(ref) {
const match = /^(.+):(\\d+)(?:-(\\d+))?@([0-9a-f]{7,40})$/.exec(String(ref));
@@ -2185,6 +2188,7 @@ function milestoneItem(entry, p) {
titles: new Map((root === view.root ? p.items : root ? named[0].items : []).map((i) => [String(i.id), i.title])),
state: read ? stateOf(read) : null,
stale: item ? staleChip(item) : '',
+ block: item ? roadmapBlock(item, { holds: root === view.root ? p.holds : named[0].holds, items: root === view.root ? p.items : named[0].items, name: (id) => agentName(id), address: (id) => itemAddress(id, root) }) : null,
stage: item ? pipelineStage(item) : entry.status,
word: entry.status,
open: item ? { root, id } : null,
@@ -2237,7 +2241,14 @@ function jumpToRoadmap(key) {
*/
function milestoneRow(row, titles) {
const title = row.title ? inline(String(row.title).replace(/\\s+/g, ' '), row.titles || titles, true, row.root) : '<span class="muted">' + esc(row.why) + '</span>';
- const inner = '<span class="dot' + (row.state ? ' ' + row.state : '') + '"></span><span class="t"><span class="id">' + esc(row.label) + '</span>' + title + '</span>' + (row.stale || '') + (row.state ? chip(row.state) : '<span class="chip">' + esc(row.word) + '</span>');
+ const inner = '<span class="dot' + (row.state ? ' ' + row.state : '') + '"></span><span class="t"><span class="id">' + esc(row.label) + '</span>' + title + (row.block ? row.block.dot : '') + '</span>' + (row.stale || '') + (row.state ? chip(row.state) : '<span class="chip">' + esc(row.word) + '</span>');
+ if (row.block && row.open) {
+ // A blocked row unfolds in place to say why (#605); its detail links over to Items.
+ const key = 'i:' + row.label, open = view.roadmapOpen.get(JSON.stringify([view.root, key])) === true;
+ const toggle = 'class="milestone-item blocked" data-roadmap-key="' + esc(key) + '" aria-expanded="' + open + '" title="' + esc(row.title) + '"';
+ return '<li>' + (title.includes('class="ref"') ? '<div ' + toggle + ' role="button" tabindex="0">' + inner + '</div>' : '<button ' + toggle + ' type="button">' + inner + '</button>')
+ + '<div class="milestone-why"' + (open ? '' : ' hidden') + '>' + row.block.detail + '</div></li>';
+ }
if (!row.open) return '<li><div class="milestone-item" title="' + esc(row.title ? row.title + ' (' + row.why + ')' : row.why) + '">' + inner + '</div></li>';
const attributes = 'class="milestone-item" data-go="item:' + row.open.id + '"' + (row.open.root === view.root ? '' : ' data-board="' + esc(row.open.root) + '"') + ' title="' + esc(row.title) + '"';
// A title with its own links needs a separate containing control, never a nested button.
@@ -3631,6 +3642,7 @@ document.addEventListener('keydown', (event) => {
const row = event.target.closest('.milestone-item[role="button"]');
if (event.target !== row) return;
event.preventDefault();
+ if (row.dataset.roadmapKey !== undefined) { row.click(); return; }
go(row.dataset.go, row.dataset.board || view.root);
});
// In a focused Spec or Doctrine list the arrow keys move the pick, and A approves the picked row and D asks why it is
diff --git a/src/view.css b/src/view.css
index dc3c2e45..a08f0cd3 100644
--- a/src/view.css
+++ b/src/view.css
@@ -221,6 +221,11 @@ a.ghost { color: var(--ink); }
.milestone-item { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; gap: 10px; align-items: center; width: 100%; min-height: var(--tap); padding: 0 9px; border: 1px solid transparent; border-radius: 10px; background: none; text-align: left; }
.milestone-item[data-go] { cursor: pointer; }
.milestone-item[data-go]:hover { background: var(--surface-2); }
+.milestone-item.blocked { cursor: pointer; }
+.milestone-item.blocked:hover { background: var(--surface-2); }
+.block-dot { display: inline-block; width: 7px; height: 7px; margin-left: 6px; border-radius: 50%; background: var(--reject); vertical-align: middle; }
+.milestone-why { margin: 2px 9px 8px 31px; font-size: 13px; }
+.milestone-why .kv { margin: 0 0 6px; }
.milestone-item .t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.milestone-item .t code { white-space: nowrap; }
.milestone-item .id { margin-right: 6px; color: var(--ink-faint); font: 500 12px var(--mono); }
diff --git a/src/view/roadmap-block.js b/src/view/roadmap-block.js
new file mode 100644
index 00000000..18f4e2cf
--- /dev/null
+++ b/src/view/roadmap-block.js
@@ -0,0 +1,43 @@
+/**
+ * The Roadmap's blocked mark (N26, #605). An item that cannot move on its own, because it waits on an
+ * item that is not verified or its lane is held, gets a small red dot, and its row unfolds in place to
+ * say why. Everything here comes from the board summaries the page already holds, so the unfolded row
+ * needs no detail request.
+ */
+
+/**
+ * Why a roadmap item cannot move on its own, or null when nothing blocks it.
+ *
+ * The page embeds this function's source, so it reads nothing outside itself, its own escaping
+ * included; the page passes in the item lookup, agent names and item addresses it already uses.
+ *
+ * @param {{id: number, status: string, lane?: string, blockedBy?: number[], claim?: {by?: string|null}|null, builtBy?: string|null, verdict?: {decision?: string, note?: string}|null}|null} item
+ * @param {{holds?: {hold_lane: string, hold_reason?: string}[], items?: {id: number, title?: string, status: string}[], name?: (id: string) => string, address?: (id: number) => string}} context
+ * @returns {{label: string, dot: string, detail: string}|null} The dot, its accessible label and the unfolded detail.
+ */
+export function roadmapBlock(item, context = {}) {
+ if (!item || item.status !== 'open') return null;
+ const escape = (text) => String(text).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[c]);
+ const statusOf = (id) => (context.items || []).find((other) => other.id === id)?.status || 'not on this board';
+ const waits = (item.blockedBy || []).map((id) => ({ id, status: statusOf(id) }));
+ const hold = (context.holds || []).find((h) => h.hold_lane === item.lane) || null;
+ if (!waits.length && !hold) return null;
+ const parts = waits.map((w) => '#' + w.id + ' (' + w.status + ')');
+ const label = 'Blocked: ' + [parts.length ? 'waits on ' + parts.join(', ') : '', hold ? 'lane ' + item.lane + ' held' : ''].filter(Boolean).join('; ');
+ const name = context.name || ((id) => id);
+ const holder = item.claim?.by || item.builtBy || null;
+ // A send-back note's first line, the way the Items list shows it.
+ const sentBack = item.verdict && item.verdict.decision === 'REJECT' && item.verdict.note ? String(item.verdict.note).split('\n')[0].trim() : '';
+ const address = context.address || ((id) => '#items/' + id);
+ const rows = [
+ '<dt>state</dt><dd>' + escape(item.status) + (holder ? ', held by ' + escape(name(holder)) : ', nobody holds it') + '</dd>',
+ waits.length ? '<dt>waits on</dt><dd>' + waits.map((w) => '#' + w.id + ' <span class="block-state">' + escape(w.status) + '</span>').join(', ') + '</dd>' : '',
+ hold ? '<dt>lane held</dt><dd>' + escape(item.lane) + (hold.hold_reason ? ': ' + escape(hold.hold_reason) : '') + '</dd>' : '',
+ sentBack ? '<dt>sent back</dt><dd>' + escape(sentBack) + '</dd>' : '',
+ ].join('');
+ return {
+ label,
+ dot: '<span class="block-dot" role="img" aria-label="' + escape(label) + '" title="' + escape(label) + '"></span>',
+ detail: '<dl class="kv">' + rows + '</dl><a class="ref" href="' + escape(address(item.id)) + '" data-go="item:' + item.id + '">Open #' + item.id + ' in Items</a>',
+ };
+}
diff --git a/test/cockpit/roadmap.test.js b/test/cockpit/roadmap.test.js
index 0062c382..1df67213 100644
--- a/test/cockpit/roadmap.test.js
+++ b/test/cockpit/roadmap.test.js
@@ -840,3 +840,58 @@ test('the roadmap panel counts the next release by stage [N26]', {
await view.stop();
}
});
+
+test('a blocked roadmap item shows its dot and expands to say why [N26]', { timeout: 90_000 }, async (t) => {
+ const executable = chromeExecutable();
+ assert.ok(executable, 'Chrome is required for the roadmap blocker check.');
+ const box = machine();
+ const alpha = project(box, 'blocked-roadmap');
+ box.run(alpha.repo, 'add', 'web', 'Base work', '--specs', 'G1', '--criterion', 'renders');
+ box.run(alpha.repo, 'add', 'web', 'Waits on base', '--specs', 'G1', '--criterion', 'renders', '--after', '1');
+ box.run(alpha.repo, 'add', 'web', 'Free work', '--specs', 'G1', '--criterion', 'renders');
+ box.run(alpha.repo, 'milestone', 'add', 'Next', '--items', '1,2,3');
+ const view = await startView(box);
+ const profile = mkdtempSync(join(tmpdir(), 'pullboard-blocked-roadmap-chrome-'));
+ let chrome;
+ /** Read the three rows: their state dot, blocker dot and unfolded reason. */
+ const read = async () => JSON.parse(await chrome.stable(`JSON.stringify([...document.querySelectorAll('#roadmap-list > [data-key="m:Next"] .milestone-body > ul > li')].map((li) => ({
+ id: li.querySelector('.milestone-item .id').textContent,
+ dot: Boolean(li.querySelector('.milestone-item > .dot')),
+ blocker: li.querySelector('.block-dot')?.getAttribute('aria-label') || null,
+ why: li.querySelector('.milestone-why')?.hidden === false ? li.querySelector('.milestone-why').textContent : null,
+ })))`));
+ try {
+ chrome = await openSnapshotChrome(executable, view.link.href, profile);
+ await chrome.waitFor('data?.project?.milestones?.length === 1');
+ await press(chrome, "document.querySelector('[data-tab=roadmap]')");
+ await chrome.waitFor("!document.querySelector('[data-pane=roadmap]').hidden && document.querySelector('#roadmap-list > [data-key=\"m:Next\"]')");
+ const folded = await read();
+ const byId = Object.fromEntries(folded.map((row) => [row.id, row]));
+ assert.equal(byId['#2'].blocker, 'Blocked: waits on #1 (open)', 'the gated item has a blocker dot naming what it waits on');
+ assert.equal(byId['#3'].dot, true, 'an unblocked item keeps its state dot');
+ assert.equal(byId['#3'].blocker, null, 'an unblocked item has no blocker dot');
+ assert.equal(byId['#1'].blocker, null, 'the item others wait on is not itself blocked');
+ assert.ok(folded.every((row) => row.why === null), 'every row starts folded');
+ // From here on, record every request the page makes: unfolding must not fetch an item's detail.
+ await chrome.stable("window.__requests = []; window.__fetch = window.__fetch || window.fetch; window.fetch = (url, options) => { window.__requests.push(String(url)); return window.__fetch(url, options); }; true");
+ await press(chrome, "[...document.querySelectorAll('#roadmap .milestone-item.blocked')].find((row) => row.querySelector('.id').textContent === '#2')");
+ await chrome.waitFor("document.querySelector('#roadmap .milestone-why:not([hidden])')");
+ const open = Object.fromEntries((await read()).map((row) => [row.id, row]));
+ assert.match(open['#2'].why, /waits on#1 open/, 'the unfolded row names the item it waits on and that item\'s state');
+ assert.match(open['#2'].why, /state.*open, nobody holds it/, 'the unfolded row says its own state and who holds it');
+ assert.equal(open['#3'].why, null, 'unblocked rows stay as they were');
+ const requests = JSON.parse(await chrome.stable('JSON.stringify(window.__requests)'));
+ assert.deepEqual(requests.filter((url) => /\/items\/\d/.test(url)), [], 'unfolding reads the summaries already held and makes no detail request');
+ await press(chrome, "document.querySelector('#roadmap .milestone-why:not([hidden]) a.ref')");
+ await chrome.waitFor("!document.querySelector('[data-pane=items]').hidden && document.querySelector('#detail h2')?.textContent.includes('Waits on base')");
+ await press(chrome, "document.querySelector('[data-tab=roadmap]')");
+ await chrome.waitFor("!document.querySelector('[data-pane=roadmap]').hidden");
+ await press(chrome, "[...document.querySelectorAll('#roadmap .milestone-item.blocked')].find((row) => row.querySelector('.id').textContent === '#2')");
+ await chrome.waitFor("!document.querySelector('#roadmap .milestone-why:not([hidden])')");
+ assert.deepEqual(chrome.exceptions, [], 'the blocked roadmap raises no uncaught page exception');
+ } finally {
+ if (chrome) await closeSnapshotChrome(chrome);
+ rmSync(profile, { recursive: true, force: true });
+ await view.stop();
+ }
+});