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(view): keep title references inline across panes [N26]

Corey Olson176f31673b18
diff --git a/src/cockpit.js b/src/cockpit.js
index 6b8eaca5..bc1110ed 100644
--- a/src/cockpit.js
+++ b/src/cockpit.js
@@ -763,13 +763,14 @@ function renderGroup(group) {
const needs = group.repos.flatMap((repo) => projectNeeds(repo.board).map((row) => ({ ...row, repo })));
$('group-needs').innerHTML = needs.length ? needs.map((row) => {
const titles = new Map(row.repo.board.items.map((item) => [String(item.id), item.title]));
- return '<button class="group-need" data-root="' + esc(row.repo.root) + '" type="button"><b>' + esc(row.repo.name) + '</b><code>' + esc(row.ref) + '</code><span>' + rich(row.text, titles, false) + '</span><em>' + esc(row.what) + (row.at ? ', ' + age(row.at) : '') + ' →</em></button>';
+ const text = rich(row.text, titles).replaceAll('<button class="ref" data-go=', '<button class="ref" data-root="' + esc(row.repo.root) + '" data-go=');
+ return '<div class="group-need"><b>' + esc(row.repo.name) + '</b><code>' + esc(row.ref) + '</code><span>' + text + '</span><button data-root="' + esc(row.repo.root) + '" type="button"><em>' + esc(row.what) + (row.at ? ', ' + age(row.at) : '') + ' →</em></button></div>';
}).join('') : '<div class="empty">Nothing needs you across this project.</div>';
const events = group.repos.flatMap((repo) => {
const titles = new Map(repo.board.items.map((item) => [String(item.id), item.title]));
- return repo.board.events.map((event) => ({ ...event, repo, title: event.item_id ? titles.get(String(event.item_id)) : null }));
+ return repo.board.events.map((event) => ({ ...event, repo, titles, title: event.item_id ? titles.get(String(event.item_id)) : null }));
}).sort((a, b) => b.event_at.localeCompare(a.event_at)).slice(0, 80);
- $('group-activity').innerHTML = events.length ? byDay(events, (event) => event.event_at, (event) => '<div><time>' + clock(event.event_at) + '</time><div class="act"><b class="repo-label">' + esc(event.repo.name) + '</b> <span>' + esc(event.event_by) + ' ' + esc(event.event_kind) + (event.item_id ? ' #' + event.item_id + (event.title ? ' ' + rich(event.title, new Map(), false) : '') : '') + '</span></div></div>') : '<div class="empty">No activity yet.</div>';
+ $('group-activity').innerHTML = events.length ? byDay(events, (event) => event.event_at, (event) => '<div><time>' + clock(event.event_at) + '</time><div class="act"><b class="repo-label">' + esc(event.repo.name) + '</b> <span>' + esc(event.event_by) + ' ' + esc(event.event_kind) + (event.item_id ? ' #' + event.item_id + (event.title ? ' ' + rich(event.title, event.titles).replaceAll('<button class="ref" data-go=', '<button class="ref" data-root="' + esc(event.repo.root) + '" data-go=') : '') : '') + '</span></div></div>') : '<div class="empty">No activity yet.</div>';
}
/**
@@ -871,7 +872,7 @@ function render() {
];
const drafts = p.spec.filter((r) => r.status === 'draft').length;
$('needs').hidden = !needs.length && !drafts;
- $('needs').innerHTML = '<div class="head"><i></i>Needs you</div>' + needs.slice(0, 6).map(([target, ref, text, what, at]) => '<button class="ny" data-go="' + esc(target) + '" type="button"><code>' + esc(ref) + '</code><span>' + rich(text, titles, false) + '</span><em>' + esc(what) + (at ? ', ' + age(at) : '') + ' →</em></button>').join('') + (needs.length > 6 ? '<div class="muted more">and ' + (needs.length - 6) + ' more</div>' : '') + (drafts ? '<button class="ny" data-go="tab:spec" type="button"><code>' + drafts + '</code><span>draft spec rows to approve or drop</span><em>review →</em></button>' : '');
+ $('needs').innerHTML = '<div class="head"><i></i>Needs you</div>' + needs.slice(0, 6).map(([target, ref, text, what, at]) => '<div class="ny"><code>' + esc(ref) + '</code><span class="ny-text">' + rich(text, titles) + '</span><button class="ny-open" data-go="' + esc(target) + '" type="button"><em>' + esc(what) + (at ? ', ' + age(at) : '') + ' →</em></button></div>').join('') + (needs.length > 6 ? '<div class="muted more">and ' + (needs.length - 6) + ' more</div>' : '') + (drafts ? '<div class="ny"><code>' + drafts + '</code><span class="ny-text">draft spec rows to approve or drop</span><button class="ny-open" data-go="tab:spec" type="button"><em>review →</em></button></div>' : '');
const lanes = p.lanes;
const working = lanes.filter((l) => l !== 'coordinator');
@@ -960,7 +961,7 @@ function render() {
$('agents').innerHTML = p.agents.length ? p.agents.map((a) => {
const mine = holding(a);
return '<div class="agent"><div><b title="' + esc(a.agent_path) + '">' + esc(a.agent_id) + '</b><span class="muted">' + esc(a.agent_lane) + ' · ' + esc(a.agent_route) + '</span>' + (a.lastMoveAt ? '<time data-ago="' + esc(a.lastMoveAt) + '" title="last moved ' + when(a.lastMoveAt) + '">' + ago(a.lastMoveAt) + '</time>' : '') + '</div>'
- + (mine.length ? mine.map((i) => '<button data-go="item:' + i.id + '" type="button"><span>#' + i.id + ' ' + rich(i.title, titles, false) + '</span>' + (i.reviewer === a.agent_id ? '<span class="chip warn">reviewing</span>' : chip(stateOf(i))) + '</button>').join('') : '<small>idle</small>') + '</div>';
+ + (mine.length ? mine.map((i) => '<div class="agent-work" data-item="' + i.id + '"><span>#' + i.id + ' ' + rich(i.title, titles) + '</span>' + (i.reviewer === a.agent_id ? '<span class="chip warn">reviewing</span>' : chip(stateOf(i))) + '</div>').join('') : '<small>idle</small>') + '</div>';
}).join('') : '<div class="empty">No agents yet.</div>';
const held = new Map(p.holds.map((h) => [h.hold_lane, h]));
$('lanes').innerHTML = working.map((l) => '<div class="lane"><span><b>' + esc(l) + '</b> ' + (held.has(l) ? '<span class="chip no">held by ' + esc(held.get(l).hold_by) + '</span> <span class="muted">' + esc(held.get(l).hold_reason) + '</span>' : '<span class="chip ok">open</span>') + '</span>' + (held.has(l) ? '<button class="ghost" data-release="' + esc(l) + '" type="button">Release</button>' : '') + '</div>').join('');
@@ -989,11 +990,11 @@ function render() {
const source = kind === 'doctrine' && row ? '<span class="chip">' + esc(ruleSource(row)) + '</span>' : '';
const reason = declined && row.reason ? '<dt>reason</dt><dd>' + esc(row.reason) + '</dd>' : '';
const home = kind === 'doctrine' && row && row.origin === 'standard' ? 'Standard rules come with Pullboard; override or decline one in PRACTICE.md.' : 'Rows change in ' + (kind === 'spec' ? 'SPEC.md' : 'PRACTICE.md') + ', and only you approve them.';
- $(kind + '-detail').innerHTML = row ? '<div class="stack tight"><h2><span>' + esc(row.id) + '</span>' + text + '</h2><div class="meta"><span class="chip ' + tone(row.status) + '">' + esc(row.status) + '</span>' + (row.tier ? '<span class="chip">' + esc(row.tier) + '</span>' : '') + source + '</div><dl class="kv"><dt>section</dt><dd>' + esc(row.section) + '</dd>' + reason + (row.gate ? '<dt>gate</dt><dd>' + esc(row.gate) + '</dd>' : '') + (row.serves && row.serves.length ? '<dt>serves</dt><dd>' + esc(row.serves.join(', ')) + '</dd>' : '') + '</dl><div><h3>Items that cite it</h3>' + (citing.length ? '<div class="links">' + citing.map((i) => '<button data-go="item:' + i.id + '" type="button">#' + i.id + ' ' + rich(i.title, titles, false) + '</button>').join('') + '</div>' : '<div class="muted">None yet.</div>') + '</div><div class="muted">' + home + '</div></div>' : '<div class="empty">Pick a row to see it, and the items that cite it.</div>';
+ $(kind + '-detail').innerHTML = row ? '<div class="stack tight"><h2><span>' + esc(row.id) + '</span>' + text + '</h2><div class="meta"><span class="chip ' + tone(row.status) + '">' + esc(row.status) + '</span>' + (row.tier ? '<span class="chip">' + esc(row.tier) + '</span>' : '') + source + '</div><dl class="kv"><dt>section</dt><dd>' + esc(row.section) + '</dd>' + reason + (row.gate ? '<dt>gate</dt><dd>' + esc(row.gate) + '</dd>' : '') + (row.serves && row.serves.length ? '<dt>serves</dt><dd>' + esc(row.serves.join(', ')) + '</dd>' : '') + '</dl><div><h3>Items that cite it</h3>' + (citing.length ? '<div class="links">' + citing.map((i) => '<div class="links-item" data-item="' + i.id + '"><span>#' + i.id + ' ' + rich(i.title, titles) + '</span></div>').join('') + '</div>' : '<div class="muted">None yet.</div>') + '</div><div class="muted">' + home + '</div></div>' : '<div class="empty">Pick a row to see it, and the items that cite it.</div>';
}
if (keep('pb.flow') !== 'hidden') $('flow').innerHTML = flowSvg(p);
- $('activity').innerHTML = p.events.length ? byDay(p.events, (e) => e.event_at, (e) => '<div><time>' + clock(e.event_at) + '</time><div class="act"><b>' + esc(e.event_by) + '</b> ' + esc(e.event_kind) + (e.item_id ? ' <button class="ref" data-go="item:' + e.item_id + '" type="button">#' + e.item_id + '</button>' + (titles.has(String(e.item_id)) ? ' <span class="what">' + esc(titles.get(String(e.item_id))) + '</span>' : '') : '') + '</div></div>') : '<div class="empty">No activity yet.</div>';
+ $('activity').innerHTML = p.events.length ? byDay(p.events, (e) => e.event_at, (e) => '<div><time>' + clock(e.event_at) + '</time><div class="act"><b>' + esc(e.event_by) + '</b> ' + esc(e.event_kind) + (e.item_id ? ' <button class="ref" data-go="item:' + e.item_id + '" type="button">#' + e.item_id + '</button>' + (titles.has(String(e.item_id)) ? ' <span class="what">' + rich(titles.get(String(e.item_id)), titles) + '</span>' : '') : '') + '</div></div>') : '<div class="empty">No activity yet.</div>';
showTab();
}
@@ -1246,16 +1247,14 @@ function fold(open) {
$('proj-switch').setAttribute('aria-expanded', String(open));
}
-/**
- * Show another project: mark it at once, dim the old one's panes until its board arrives. Given an
- * item, its board opens on that item; with record false the history entry stays as it is, for a
- * move that came from the entry.
- */
-function switchTo(root, item = null, record = true) {
+/** Show another project and its item; history restores keep the tab their entry named. */
+function switchTo(root, target = null, record = true) {
answer(null);
view.root = root;
- view.item = item;
+ const item = typeof target === 'number' ? target : /^item:(\\d+)$/.exec(target || '');
+ view.item = typeof item === 'number' ? item : item ? Number(item[1]) : null;
view.adding = false;
+ if (record && view.item !== null) { view.tab = 'items'; keep('pb.tab', view.tab); }
keep('pb.project', root);
if (record) address(false);
fold(false);
@@ -1265,7 +1264,7 @@ function switchTo(root, item = null, record = true) {
document.body.classList.add('switching');
refresh().catch(() => { $('live').textContent = 'offline: is pullboard view still running?'; }).finally(() => {
document.body.classList.remove('switching');
- if (item !== null && view.root === root && view.tab === 'items') reveal();
+ if (view.item !== null && view.root === root && view.tab === 'items') reveal();
});
}
@@ -1275,7 +1274,7 @@ document.addEventListener('click', (event) => {
if (!t) return;
if (t.id === 'proj-switch') { fold(!$('side').classList.contains('open')); return; }
if (t.id === 'console') { t.hidden = true; return; }
- if (t.dataset.root) switchTo(t.dataset.root);
+ if (t.dataset.root) switchTo(t.dataset.root, t.dataset.go || '');
else if (t.dataset.tab) { openTab(t.dataset.tab); showTab(); }
else if (t.dataset.go) go(t.dataset.go, t.dataset.board);
else if (t.dataset.item) pick(Number(t.dataset.item));
diff --git a/src/view.css b/src/view.css
index f434b7ac..af0e67d2 100644
--- a/src/view.css
+++ b/src/view.css
@@ -51,12 +51,13 @@ button, input, select, textarea { font: inherit; color: inherit; }
.group-view { display: grid; gap: 14px; max-width: 1000px; }
.group-panel { padding: 14px 16px; }
.group-panel h2 { margin: 0 0 10px; font-size: 17px; }
-.group-need { display: grid; grid-template-columns: minmax(90px, auto) auto minmax(0, 1fr) auto; align-items: baseline; gap: 5px 10px; width: 100%; padding: 9px 0; text-align: left; border: 0; border-top: 1px solid var(--line); background: none; cursor: pointer; }
+.group-need { display: grid; grid-template-columns: minmax(90px, auto) auto minmax(0, 1fr) auto; align-items: baseline; gap: 5px 10px; width: 100%; padding: 9px 0; text-align: left; border: 0; border-top: 1px solid var(--line); background: none; }
.group-need:hover { background: var(--surface-2); }
.group-need > b { color: var(--ink-muted); }
.group-need > code { color: var(--accent-strong); }
.group-need > span { overflow-wrap: anywhere; }
-.group-need > em { color: var(--ink-faint); font-size: 12px; font-style: normal; }
+.group-need > button { min-height: 44px; border: 0; padding: 0; background: none; cursor: pointer; text-align: right; }
+.group-need > button em { color: var(--ink-faint); font-size: 12px; font-style: normal; }
.repo-label { color: var(--ink-muted); }
.need { min-width: 20px; padding: 1px 6px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); font: 700 11.5px/1.5 var(--mono); text-align: center; }
.products { padding-top: 6px; }
@@ -118,13 +119,13 @@ button.milestone-item:hover { background: var(--surface-2); }
main { padding: 12px 10px 24px; }
.two, .two.narrow { grid-template-columns: minmax(0, 1fr); }
.group-need { grid-template-columns: minmax(80px, auto) auto minmax(0, 1fr); }
- .group-need > em { grid-column: 3; }
+ .group-need > button { grid-column: 3; }
}
@media (width < 480px) {
.group-need { grid-template-columns: minmax(0, 1fr) auto; gap: 3px 8px; }
.group-need > b { grid-column: 1; }
.group-need > code { grid-column: 2; }
- .group-need > span, .group-need > em { grid-column: 1 / -1; }
+ .group-need > span, .group-need > button { grid-column: 1 / -1; }
.tabs { flex: 1; display: grid; grid-auto-flow: column; grid-auto-columns: auto; gap: 0; }
.tab { display: grid; grid-template-rows: auto 13px; justify-items: center; align-content: center; padding: 7px 2px 5px; font-size: 13.5px; }
.tab b { margin: 0; line-height: 13px; }
@@ -145,12 +146,13 @@ input:disabled { background: var(--surface-2); color: var(--ink-muted); }
.needs-you .head.quiet { color: var(--ink-muted); font-weight: 600; }
.needs-you .ask + .head.quiet { margin-top: 12px; }
.needs-you .more { padding: 2px 4px; }
-.ny { display: grid; grid-template-columns: auto minmax(5em, 1fr) minmax(0, max-content); gap: 10px; align-items: baseline; text-align: left; border: 0; background: none; padding: 6px 4px; border-radius: 8px; cursor: pointer; width: 100%; }
+.ny { display: grid; grid-template-columns: auto minmax(5em, 1fr) minmax(0, max-content); gap: 10px; align-items: baseline; text-align: left; border: 0; background: none; padding: 6px 4px; border-radius: 8px; width: 100%; min-height: 44px; }
.ny:hover { background: color-mix(in srgb, var(--warn) 10%, var(--surface)); }
.ny code { font: 600 12px var(--mono); }
-.ny span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-muted); }
+.ny .ny-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-muted); }
+.ny .ny-open { min-height: 44px; border: 0; padding: 0; background: none; color: var(--warn); cursor: pointer; text-align: right; }
.ny em { font-style: normal; color: var(--warn); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
-@media (width < 480px) { .ny { grid-template-columns: auto minmax(0, 1fr); row-gap: 1px; } .ny em { grid-column: 2; } }
+@media (width < 480px) { .ny { grid-template-columns: auto minmax(0, 1fr); row-gap: 1px; } .ny .ny-open { grid-column: 2; } }
.ask { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: center; padding: 6px 4px; }
.ask > p { grid-column: 1; margin: 0; overflow-wrap: anywhere; }
.ask small { color: var(--ink-muted); }
@@ -232,7 +234,7 @@ input:disabled { background: var(--surface-2); color: var(--ink-muted); }
.rowref { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; font-size: 13px; padding: 3px 0; }
.rowref code { font-weight: 600; }
.links { display: flex; flex-wrap: wrap; gap: 6px; }
-.links button { border: 1px solid var(--line); background: var(--surface-2); border-radius: 6px; padding: 3px 9px; cursor: pointer; font-size: 12.5px; }
+.links-item { border: 1px solid var(--line); background: var(--surface-2); border-radius: 6px; padding: 3px 9px; cursor: pointer; font-size: 12.5px; min-height: 44px; display: flex; align-items: center; }
.panel-form { display: grid; gap: 10px; }
.panel-form label, .inline label { display: grid; gap: 4px; font-size: 12px; color: var(--ink-muted); }
@@ -248,7 +250,7 @@ input:disabled { background: var(--surface-2); color: var(--ink-muted); }
.feed > div:first-child, .feed > .day + div { border-top: 0; }
.feed .day { margin: 0; padding: 12px 0 4px; font: 600 11px/1 var(--mono); letter-spacing: .07em; text-transform: uppercase; color: var(--ink-faint); }
.feed .day:first-child { padding-top: 6px; }
-.feed button.ref, .ask button.ref, .detail button.ref { border: 0; background: none; padding: 0; color: var(--accent-strong); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; display: inline; min-height: 0; vertical-align: baseline; line-height: inherit; font: inherit; }
+button.ref { width: auto; min-height: 0; border: 0; border-radius: 0; background: none; padding: 0; color: var(--accent-strong); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; display: inline; vertical-align: baseline; line-height: inherit; font: inherit; }
code.inline { padding: 0 3px; border-radius: 3px; background: color-mix(in srgb, var(--ink) 8%, var(--surface)); font: .92em var(--mono); white-space: break-spaces; }
.code { display: block; margin: 6px 0 2px; padding: 6px 0; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); font: 12px/1.55 var(--mono); white-space: pre; overflow-x: auto; overflow-wrap: normal; }
.code > span { display: block; padding-right: 12px; }
@@ -263,9 +265,9 @@ code.inline { padding: 0 3px; border-radius: 3px; background: color-mix(in srgb,
.agent > div { display: flex; gap: 8px; align-items: baseline; min-width: 0; }
.agent > div > .muted { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent time { margin-left: auto; color: var(--ink-faint); font: 12px var(--mono); }
-.agent button { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; width: 100%; border: 0; background: none; padding: 2px 0; text-align: left; cursor: pointer; }
-.agent button > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
-.agent button:hover > span:first-child { color: var(--accent-strong); text-decoration: underline; text-underline-offset: 2px; }
+.agent-work { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; width: 100%; border: 0; background: none; padding: 2px 0; text-align: left; cursor: pointer; }
+.agent-work > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
+.agent-work:hover > span:first-child { color: var(--accent-strong); text-decoration: underline; text-underline-offset: 2px; }
.lane { display: flex; justify-content: space-between; gap: 8px; align-items: center; padding: 6px 0; border-top: 1px solid var(--line); font-size: 13px; }
.lane:first-child { border-top: 0; }
.rows { padding: 4px 10px 10px; }
diff --git a/test/cockpit.test.js b/test/cockpit.test.js
index 6e7272a2..9c5072a2 100644
--- a/test/cockpit.test.js
+++ b/test/cockpit.test.js
@@ -504,14 +504,14 @@ test('the sidebar lists every project and what needs the person [N26]', async ()
test('projects group repos with combined needs and activity, while ungrouped and unreadable repos stay clear [N33, N34, N36]', async () => {
const box = machine();
- const core = project(box, 'core', `${SPEC}- G3 [pending] Should the API greet in French?\n`, { name: 'Core API', project: 'Atlas' });
- box.run(core.repo, 'add', 'web', 'Greeting', '--specs', 'G1', '--criterion', 'greets');
+ const core = project(box, 'core', `${SPEC}- G3 [pending] Should #1 greet in French?\n`, { name: 'Core API', project: 'Atlas' });
+ box.run(core.repo, 'add', 'web', 'Core target #1', '--specs', 'G1', '--criterion', 'greets');
build(box, core, 1, 'greeting.html');
sendBack(box, core, 1, 'the page needs a greeting');
const web = project(box, 'web', SPEC, { name: 'Web UI', project: 'Atlas' });
- box.run(web.repo, 'add', 'web', 'Header', '--specs', 'G1', '--criterion', 'has a header');
+ box.run(web.repo, 'add', 'web', 'Target for #1', '--specs', 'G1', '--criterion', 'has a header');
build(box, web, 1, 'header.html');
- box.run(web.repo, 'shout', 'person', 'Ship the header today?', '--decision');
+ box.run(web.repo, 'shout', 'person', 'Ship #1 today?', '--decision');
const standalone = project(box, 'standalone', SPEC, { name: 'Scratchpad' });
const broken = project(box, 'broken', SPEC, { name: 'Broken repo', project: 'Atlas' });
const view = await startView(box);
@@ -545,17 +545,36 @@ test('projects group repos with combined needs and activity, while ungrouped and
assert.equal(page.element('tabs').hidden, true);
assert.match(page.show('group-needs'), /Core API/);
assert.match(page.show('group-needs'), /Web UI/);
- assert.match(page.show('group-needs'), /<b>Core API<\/b><code>G3<\/code><span>Should the API greet in French\?<\/span><em>answer in SPEC\.md →<\/em>/, "a question in one repo's spec");
- assert.match(page.show('group-needs'), /<b>Web UI<\/b><code>coordinator<\/code><span>Ship the header today\?<\/span><em>decision, /, "and a decision in another's");
+ assert.match(page.show('group-needs'), /<b>Core API<\/b><code>G3<\/code><span>Should <button class="ref" data-root="[^"]+" data-go="item:1" title="Core target #1" type="button">#1<\/button> greet in French\?<\/span><button data-root="[^"]+" type="button"><em>answer in SPEC\.md →<\/em><\/button>/, "a question in one repo's spec");
+ assert.match(page.show('group-needs'), /<b>Web UI<\/b><code>coordinator<\/code><span>Ship <button class="ref" data-root="[^"]+" data-go="item:1" title="Target for #1" type="button">#1<\/button> today\?<\/span><button data-root="[^"]+" type="button"><em>decision, /, "and a decision in another's");
assert.doesNotMatch(page.show('group-needs'), /sent back|to verify|Greeting|Header/, "work sent back or waiting for a verdict is the agents', not the person's");
assert.match(page.show('group-activity'), /Core API/);
assert.match(page.show('group-activity'), /Web UI/);
- assert.match(page.show('group-activity'), /Greeting|Header/);
+ assert.match(page.show('group-activity'), /Greeting|Target/);
+ const activityRefs = [...page.show('group-activity').matchAll(/<button class="ref" data-root="([^"]+)" data-go="item:1" title="([^"]+)"/g)].map((link) => [link[1], link[2]]);
+ assert.ok(activityRefs.some(([root, title]) => root === core.repo && title === 'Core target #1'), 'activity links bind Core API #1 to its repo');
+ assert.ok(activityRefs.some(([root, title]) => root === web.repo && title === 'Target for #1'), 'activity links bind Web UI #1 to its repo');
+
+ assert.deepEqual([...page.show('group-needs').matchAll(/<button class="ref" data-root="([^"]+)" data-go="item:1" title="([^"]+)"/g)].map((link) => [link[1], link[2]]), [
+ [core.repo, 'Core target #1'], [web.repo, 'Target for #1'],
+ ], 'each duplicate #1 keeps the repo where it was written');
+ page.run("view.tab = 'activity'");
+ await page.click({ root: core.repo, go: 'item:1' });
+ assert.equal(page.run('view.root'), core.repo, 'the Core API link opens its own repo');
+ assert.equal(page.run('view.item'), 1, 'the Core API link opens its #1');
+ assert.equal(page.run('view.tab'), 'items', 'the Core API link opens its item detail');
+ await page.click({ root: 'group:Atlas' });
+ page.run("view.tab = 'activity'");
+ await page.click({ root: web.repo, go: 'item:1' });
+ assert.equal(page.run('view.root'), web.repo, 'the Web UI link opens its own repo');
+ assert.equal(page.run('view.item'), 1, 'the Web UI link opens its #1');
+ assert.equal(page.run('view.tab'), 'items', 'the Web UI link opens its item detail');
+ await page.click({ root: 'group:Atlas' });
await page.click({ root: core.repo });
assert.equal(page.element('group-view').hidden, true);
assert.equal(page.element('tabs').hidden, false);
- assert.match(page.show('chain'), /Greeting/);
+ assert.match(page.show('chain'), /Core target/);
assert.doesNotMatch(page.show('chain'), /Header/);
assert.ok(side.includes(`data-root="${standalone.repo}"`), 'the repo without a project stands alone');
} finally {
@@ -749,7 +768,7 @@ function agentEntries(html) {
id: /<b[^>]*>([^<]*)<\/b>/.exec(entry)?.[1],
path: /<b title="([^"]*)"/.exec(entry)?.[1],
age: /<time[^>]*>([^<]*)<\/time>/.exec(entry)?.[1],
- holds: [...entry.matchAll(/data-go="item:(\d+)"[^>]*><span>([^]*?)<\/span><span class="chip[^"]*">([^<]*)</g)].map((match) => `${match[2]}: ${match[3]}`),
+ holds: [...entry.matchAll(/data-item="(\d+)"[^>]*><span>([^]*?)<\/span><span class="chip[^"]*">([^<]*)</g)].map((match) => `${match[2]}: ${match[3]}`),
idle: entry.includes('<small>idle</small>'),
text: entry.replace(/<[^>]*>/g, ' '),
}));
@@ -1442,7 +1461,7 @@ test('a decision waits in needs-you until the view answers it [B21, B26, N27]',
box.run(alpha.repo, 'pass', '1', 'over to you');
await page.run('refresh()');
const passed = `Passed up from web-1: ${question}\nCoordinator note: over to you`;
- assert.match(page.show('needs'), new RegExp(`^<div class="head"><i></i>Needs you</div><button class="ny" data-go="decide:42" type="button"><code>coordinator</code><span>${passed.replace('\n', '<br>')}</span><em>decide, <time data-ago="[^"]+">now</time> →</em></button>`), 'first in Needs-you: who passed it, what, and since when');
+ assert.match(page.show('needs'), new RegExp(`^<div class="head"><i></i>Needs you</div><div class="ny"><code>coordinator</code><span class="ny-text">${passed.replace('\n', '<br>')}</span><button class="ny-open" data-go="decide:42" type="button"><em>decide, <time data-ago="[^"]+">now</time> →</em></button></div>`), 'first in Needs-you: who passed it, what, and since when');
assert.match(page.show('decisions'), new RegExp(`^<div class="head"><i></i>Decision needed</div><div class="ask"><p><small><b>coordinator</b> asks, <time data-ago="[^"]+">now</time></small></p><p>${passed.replace('\n', '<br>')}</p><button class="ghost" data-go="decide:42" type="button">Answer</button></div>$`), 'and above the shouts, with an Answer button');
const form = () => ({
@@ -1521,14 +1540,14 @@ test("needs-you holds only the person's calls; the rest show on the board with w
try {
const page = await openPage(view);
const needs = page.show('needs');
- assert.deepEqual([...needs.matchAll(/<button class="ny" data-go="([^:"]+):[^"]*" type="button"><code>([^<]*)<\/code><span>([^<]*)<\/span>/g)].map((line) => [line[1], line[2], line[3]]), [
+ assert.deepEqual([...needs.matchAll(/<div class="ny"><code>([^<]*)<\/code><span class="ny-text">([^<]*)<\/span><button class="ny-open" data-go="([^:"]+):[^"]*" type="button"><em>/g)].map((line) => [line[3], line[1], line[2]]), [
['decide', 'coordinator', 'Launch on Friday?'],
['spec', 'G3', 'Greet in French?'],
['tab', 'web', 'G3 is open'],
['tab', '1', 'draft spec rows to approve or drop'],
], "the person's calls, and only those: the decision asked of them, the spec's question, the held lane, the draft row");
assert.doesNotMatch(needs, /Which colour|Greeting|Farewell/, "an agent's ask, work waiting for a verdict and work sent back are not the person's");
- assert.match(needs, /<code>web<\/code><span>G3 is open<\/span><em>lane held by coordinator →<\/em>/, 'a held lane says who set it');
+ assert.match(needs, /<code>web<\/code><span class="ny-text">G3 is open<\/span><button class="ny-open" data-go="tab:shouts" type="button"><em>lane held by coordinator →<\/em><\/button>/, 'a held lane says who set it');
// Each of the rest is on the board, with who holds it.
assert.match(page.show('decisions'), /<div class="head quiet">Waiting on others<\/div><div class="ask other"><p><small><b>web-1<\/b> asks <b>coordinator<\/b>, /, "the agent's ask waits on its coordinator");
@@ -2122,9 +2141,9 @@ test('needs-you lines keep their titles on a phone [N26]', async () => {
const page = await openPage(view, { width: 375 });
const style = await styleOf(view);
assert.match(style, /\n\.ny \{ display: grid; grid-template-columns: auto minmax\(5em, 1fr\) minmax\(0, max-content\);/, 'wider, a line keeps its single row');
- assert.match(style, /\n@media \(width < 480px\) \{ \.ny \{ grid-template-columns: auto minmax\(0, 1fr\); row-gap: 1px; \} \.ny em \{ grid-column: 2; \} \}\n/, 'under 480px, what it needs moves under the title');
- // The rule works because each line is the ref, then the title, then what it needs.
- assert.match(page.show('needs'), /<button class="ny" data-go="spec:G3" type="button"><code>G3<\/code><span>Should a greeting with a title long enough to need the room wrap\?<\/span><em>answer in SPEC\.md →<\/em><\/button>/);
+ assert.match(style, /\n@media \(width < 480px\) \{ \.ny \{ grid-template-columns: auto minmax\(0, 1fr\); row-gap: 1px; \} \.ny \.ny-open \{ grid-column: 2; \} \}\n/, 'under 480px, the action moves under the text');
+ // The row keeps its reference, text and action in three columns.
+ assert.match(page.show('needs'), /<div class="ny"><code>G3<\/code><span class="ny-text">Should a greeting with a title long enough to need the room wrap\?<\/span><button class="ny-open" data-go="spec:G3" type="button"><em>answer in SPEC\.md →<\/em><\/button><\/div>/);
} finally {
await view.stop();
}
@@ -3105,7 +3124,7 @@ test('real Chrome styles shout code and item text without growing linked lines [
const titleNode = document.querySelector('#chain .row .t');
const outside = [...document.querySelectorAll('#feed > div:not(.day)')].find((row) => row.textContent.includes('alert(2)'));
const itemDetail = document.querySelector('#detail');
- const agentItem = document.querySelector('#agents .agent button[data-go="item:1"]');
+ const agentItem = document.querySelector('#agents .agent [data-item="1"]');
/** Measure the complete rendered content line box, including its item link. */
const lineMetrics = (message) => {
const row = [...document.querySelectorAll('#feed > div:not(.day)')].find((entry) => {
@@ -3126,8 +3145,9 @@ test('real Chrome styles shout code and item text without growing linked lines [
previewLinks: shout.querySelectorAll('button[data-code^="SPEC.md:1-2@"]').length,
outsideHtml: outside.innerHTML, askNestedButtons: ask.querySelector('p').querySelectorAll('button').length,
criterionHtml: itemDetail.querySelector('.text')?.innerHTML, briefHtml: itemDetail.querySelector('.text.muted')?.innerHTML,
- needsNestedButtons: document.querySelectorAll('#needs button.ref').length,
- agentNestedButtons: document.querySelectorAll('#agents .agent button.ref').length,
+ needsNestedButtons: [...document.querySelectorAll('#needs button.ref')].filter(link => link.parentElement.closest('button')).length,
+ agentNestedButtons: [...document.querySelectorAll('#agents .agent button.ref')].filter(link => link.parentElement.closest('button')).length,
+ agentItemHeight: agentItem?.getBoundingClientRect().height,
};
})())`));
assert.match(rendered.shoutHtml, /<code class="inline">code &lt;b&gt;safe&lt;\/b&gt;<\/code>/, 'backticks create escaped inline code');
@@ -3150,6 +3170,7 @@ test('real Chrome styles shout code and item text without growing linked lines [
assert.equal(rendered.askNestedButtons, 0, 'formatted text in an ask cannot nest interactive controls');
assert.equal(rendered.needsNestedButtons, 0, 'needs-you keeps its button markup valid');
assert.equal(rendered.agentNestedButtons, 0, 'agent item buttons never nest reference controls');
+ assert.ok(rendered.agentItemHeight >= 44, 'agent item controls keep a 44px touch target');
assert.match(rendered.titleHtml, /<code class="inline">title<\/code>/, 'item titles use the same code renderer');
assert.match(rendered.titleHtml, /&lt;img src=x onerror=alert\(1\)&gt;/, 'item text remains escaped');
assert.match(rendered.criterionHtml, /<code class="inline">value<\/code>/, 'criterion text uses the renderer');
@@ -3194,6 +3215,123 @@ test('real Chrome styles shout code and item text without growing linked lines [
}
});
+test('in-text item references stay inline and open their target at phone and desktop widths [N26]', { timeout: 90_000 }, async (t) => {
+ const executable = chromeExecutable();
+ if (!executable) return t.skip('Install Chrome or set PULLBOARD_CHROME for item-reference layout checks.');
+
+ const box = machine();
+ const demo = project(box, 'inline-references', SPEC, { practice: 'ways.md' });
+ writeFileSync(join(demo.repo, 'ways.md'), '# Local rules\n\n## Team\n- R1 [approved, must] Items carry the page behavior. | gate: review\n');
+ box.run(demo.repo, 'add', 'web', 'Target item', '--specs', 'G1', '--criterion', 'the linked target');
+ box.run(demo.repo, 'add', 'web', 'Title links to #1', '--specs', 'G1', '--criterion', 'Criterion links to #1', '--brief', 'Brief links to #1');
+ box.run(demo.web, 'claim', '2');
+ box.run(demo.repo, 'shout', 'person', 'Please choose #1 next', '--decision');
+ const view = await startView(box);
+ const profile = mkdtempSync(join(tmpdir(), 'pullboard-inline-references-chrome-'));
+ let chrome;
+ try {
+ chrome = await openSnapshotChrome(executable, view.link.href, profile);
+ await chrome.send('Emulation.setDeviceMetricsOverride', { width: 1280, height: 900, deviceScaleFactor: 1, mobile: false });
+ await chrome.waitFor('document.querySelectorAll("#chain .row").length >= 2 && document.querySelector("#needs .ny")');
+
+ for (const width of [375, 1280]) {
+ await chrome.send('Emulation.setDeviceMetricsOverride', { width, height: 900, deviceScaleFactor: 1, mobile: false });
+ // The row inlineReference stays on its title line beside the text.
+ const rendered = JSON.parse(await chrome.evaluate(`JSON.stringify((() => {
+ const row = document.querySelector('#chain .row[data-item="2"]');
+ const plain = document.querySelector('#chain .row[data-item="1"]');
+ const titleRef = row?.querySelector('.t button.ref');
+ const need = [...document.querySelectorAll('#needs .ny')].find((entry) => entry.textContent.includes('Please choose'));
+ const needRef = need?.querySelector('button.ref');
+ const needAction = need?.querySelector('.ny-open');
+ const realButton = document.querySelector('#new-item');
+ /** Measure the element box independently of the inline-link assertion. */
+ const rect = node => { const r=node.getBoundingClientRect(); return {height:r.height,width:r.width}; };
+ return {
+ titleRef: titleRef && { ...rect(titleRef), border:getComputedStyle(titleRef).borderWidth, lineHeight:getComputedStyle(titleRef).lineHeight },
+ linkedTitle: row && rect(row.querySelector('.t')),
+ plainTitle: plain && rect(plain.querySelector('.t')),
+ needRef: needRef && { ...rect(needRef), border:getComputedStyle(needRef).borderWidth, lineHeight:getComputedStyle(needRef).lineHeight },
+ needText: need?.querySelector('.ny-text') && rect(need.querySelector('.ny-text')),
+ needAction: needAction && rect(needAction), realButton: realButton && rect(realButton),
+ };
+ })())`));
+ assert.ok(rendered.titleRef && rendered.needRef, `${width}: list and Needs-you references are links: ${JSON.stringify(rendered)}`);
+ assert.equal(rendered.titleRef.border, '0px', `${width}: the title reference has no button border`);
+ assert.equal(rendered.needRef.border, '0px', `${width}: the Needs-you reference has no button border`);
+ assert.ok(Math.abs(rendered.linkedTitle.height - rendered.plainTitle.height) < 1,
+ `${width}: the title line matches a plain title: ${JSON.stringify(rendered)}`);
+ assert.ok(Math.abs(rendered.titleRef.height - rendered.linkedTitle.height) < 1,
+ `${width}: the title link has the surrounding line height: ${JSON.stringify(rendered)}`);
+ assert.ok(Math.abs(rendered.needRef.height - rendered.needText.height) < 1,
+ `${width}: the Needs-you link has the surrounding line height: ${JSON.stringify(rendered)}`);
+ assert.ok(rendered.needAction.height >= 44 && rendered.realButton.height >= 44,
+ `${width}: real controls keep 44px targets: ${JSON.stringify(rendered)}`);
+
+ for (const section of ['agents', 'spec', 'doctrine']) {
+ if (section === 'agents') {
+ await chrome.evaluate(`document.querySelector('[data-tab="shouts"]').click()`);
+ await chrome.waitFor('document.querySelector("#agents [data-item=\\"2\\"]")');
+ } else {
+ await chrome.evaluate(`document.querySelector('[data-tab="${section}"]').click()`);
+ await chrome.evaluate(`document.querySelector('[data-rows="${section}:all"]').click()`);
+ const citedRow = section === 'doctrine' ? 'R1' : 'G1';
+ if (section === 'doctrine') {
+ // Item citations normally point to SPEC ids; add the distinct practice id to the
+ // browser projection to exercise the shared doctrine citing-item renderer.
+ await chrome.evaluate("data.project.items.find(item => item.id === 2).specs.push('R1'); render();");
+ }
+ await chrome.waitFor(`document.querySelector('#${section}-list [data-row="${section}:${citedRow}"]')`);
+ await chrome.evaluate(`document.querySelector('#${section}-list [data-row="${section}:${citedRow}"]').click()`);
+ await chrome.waitFor(`document.querySelector('#${section}-detail [data-item="2"]')`);
+ }
+ const selector = section === 'agents' ? '#agents [data-item="2"] .ref' : `#${section}-detail .links [data-item="2"] .ref`;
+ const metrics = JSON.parse(await chrome.evaluate(`JSON.stringify((() => {
+ const ref = document.querySelector(${JSON.stringify(selector)});
+ const container = ref?.closest('[data-item="2"]');
+ const r = ref?.getBoundingClientRect();
+ const c = container?.getBoundingClientRect();
+ return { present:!!ref, border:ref && getComputedStyle(ref).borderWidth,
+ refHeight:r?.height, lineHeight:ref && parseFloat(getComputedStyle(ref).lineHeight),
+ containerHeight:c?.height, nestedButtons:container ? [...container.querySelectorAll('.ref')].filter(link => link.parentElement.closest('button')).length : 0 };
+ })())`));
+ assert.ok(metrics.present, `${width}: ${section} citing title renders a compact item reference: ${JSON.stringify(metrics)}`);
+ assert.equal(metrics.border, '0px', `${width}: ${section} reference has no button border`);
+ assert.ok(Math.abs(metrics.refHeight - metrics.lineHeight) < 1, `${width}: ${section} reference keeps the text line height: ${JSON.stringify(metrics)}`);
+ assert.ok(metrics.containerHeight >= 44, `${width}: ${section} containing item keeps a 44px target`);
+ assert.equal(metrics.nestedButtons, 0, `${width}: ${section} title has no nested controls`);
+ await chrome.evaluate(`document.querySelector(${JSON.stringify(selector)}).click()`);
+ await chrome.waitFor("document.querySelector('[data-tab=items].on') && document.querySelector('#detail h2')?.textContent.includes('Target item')");
+ await chrome.evaluate(`document.querySelector(${JSON.stringify(selector)}).closest('[data-item="2"]').click()`);
+ await chrome.waitFor("document.querySelector('#detail h2')?.textContent.includes('Title links to #1')");
+ }
+
+ await chrome.evaluate(`document.querySelector('#chain .row[data-item="2"] .t button.ref').click()`);
+ await chrome.waitFor("document.querySelector('#detail h2')?.textContent.includes('Target item')");
+ await chrome.evaluate(`document.querySelector('#needs .ny button.ref').click()`);
+ await chrome.waitFor("document.querySelector('[data-tab=items].on') && document.querySelector('#detail h2')?.textContent.includes('Target item')");
+
+ await chrome.evaluate(`document.querySelector('[data-tab="activity"]').click()`);
+ await chrome.waitFor("document.querySelector('#activity .what button.ref')");
+ await chrome.evaluate(`document.querySelector('#activity .what button.ref').click()`);
+ await chrome.waitFor("document.querySelector('[data-tab=items].on') && document.querySelector('#detail h2')?.textContent.includes('Target item')");
+
+ await chrome.evaluate(`document.querySelector('#chain .row[data-item="2"]').click()`);
+ await chrome.waitFor("document.querySelector('#detail h2')?.textContent.includes('Title links to #1') && document.querySelector('#detail .text button.ref') && document.querySelector('#detail .text.muted button.ref')");
+ await chrome.evaluate(`document.querySelector('#detail .text button.ref').click()`);
+ await chrome.waitFor("document.querySelector('#detail h2')?.textContent.includes('Target item')");
+ await chrome.evaluate(`document.querySelector('#chain .row[data-item="2"]').click()`);
+ await chrome.waitFor("document.querySelector('#detail .text.muted button.ref')");
+ await chrome.evaluate(`document.querySelector('#detail .text.muted button.ref').click()`);
+ await chrome.waitFor("document.querySelector('#detail h2')?.textContent.includes('Target item')");
+ }
+ } finally {
+ if (chrome) await closeSnapshotChrome(chrome);
+ rmSync(profile, { recursive: true, force: true });
+ await view.stop();
+ }
+});
+
test('wait references stay on one line and link to every prerequisite at phone and desktop widths [N26]', { timeout: 90_000 }, async (t) => {
const executable = chromeExecutable();
if (!executable) return t.skip('Install Chrome or set PULLBOARD_CHROME for prerequisite layout checks.');