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(cockpit): explain finished Items under All [N26]

Corey Olsonc38cafbe33e0
diff --git a/src/cockpit.js b/src/cockpit.js
index 71730c33..e91907ac 100644
--- a/src/cockpit.js
+++ b/src/cockpit.js
@@ -2295,6 +2295,8 @@ function render() {
$('filter-toggle').title = filterLabel;
if (view.filterOpen && activeChoice) [...menu.querySelectorAll('[data-filter-choice]')].find((option) => option.dataset.filterChoice === activeChoice)?.focus({ preventScroll: true });
const shown = inView.filter(inLane(view.lane)).sort((a, b) => b.updatedAt.localeCompare(a.updatedAt));
+ const finishedUnderAll = !shown.length && p.items.length > 0 && p.items.every((item) => stateOf(item) === 'verified')
+ && view.tab === 'items' && view.itemsView === 'list' && view.state === 'active' && !view.lane && !q && !snapshot && !readOnly;
$('pipeline').innerHTML = pipeline ? pipelineCard(shown) : '';
// With nothing picked, the detail shows the first row, and keeps it when a refresh reorders the list.
// While another project loads, the item picked there waits for its own board.
@@ -2317,7 +2319,9 @@ function render() {
// A rejected row's second line is its verdict; any other row's is its lane and the spec ids it serves.
secondary: (rejected(i) ? '<span class="why"><b>' + esc(i.verdict.reason) + '</b> ' + linked(firstLine(visibleVerdictNote(i.verdict.reason, i.verdict.note)), titles) + '</span>'
: '<span>' + esc(i.lane) + '</span>' + (i.specs.length ? '<span class="specs" title="' + esc(i.specs.join(', ')) + '">' + esc(i.specs.slice(0, 3).join(', ') + (i.specs.length > 3 ? ' +' + (i.specs.length - 3) : '')) + '</span>' : '')) + pills + staleChip(i) });
- }).join('') : '<li class="empty">' + (items.length ? 'No items match.' : snapshot ? 'No items at this event.' : 'No items yet. Add the first one with New item.') + '</li>';
+ }).join('') : '<li class="empty">' + (finishedUnderAll
+ ? 'Finished work is under All. <button class="link" data-filter-choice="state:all" data-filter-kind="state" data-filter-value="all" type="button">Show all</button>'
+ : items.length ? 'No items match.' : snapshot ? 'No items at this event.' : 'No items yet. Add the first one with New item.') + '</li>';
const selected = p.items.find((i) => i.id === view.item);
// The form shows when asked for, or when the project has no item at all, withdrawn ones included.
diff --git a/test/cockpit/items-empty.test.js b/test/cockpit/items-empty.test.js
new file mode 100644
index 00000000..487ed407
--- /dev/null
+++ b/test/cockpit/items-empty.test.js
@@ -0,0 +1,49 @@
+/** The default Items view gives finished work a clear next step [N26]. */
+import assert from 'node:assert/strict';
+import { mkdtempSync, rmSync } from 'node:fs';
+import { tmpdir } from 'node:os';
+import { join } from 'node:path';
+import { test } from 'node:test';
+import { accept, build, chromeExecutable, machine, openSnapshotChrome, press, project, startView } from './fixture.js';
+
+test('a board whose work is all verified shows it or says it is under All [N26]', async () => {
+ const executable = chromeExecutable();
+ assert.ok(executable, 'the real-Chrome empty-state check requires Chrome');
+ const box = machine();
+ const alpha = project(box, 'all-verified');
+ box.run(alpha.repo, 'add', 'web', 'Finished item', '--specs', 'G1', '--criterion', 'shows the page');
+ build(box, alpha, 1, 'finished.html');
+ accept(box, alpha, 1);
+
+ const view = await startView(box);
+ const profile = mkdtempSync(join(tmpdir(), 'pullboard-items-empty-chrome-'));
+ let chrome;
+ try {
+ chrome = await openSnapshotChrome(executable, view.link.href, profile);
+ await chrome.waitFor("document.querySelector('#chain .empty') || document.querySelector('#chain .row[data-item=\"1\"]')");
+ const initial = JSON.parse(await chrome.stable(`JSON.stringify({
+ state: view.state,
+ visibleRows: [...document.querySelectorAll('#chain .row')].filter((row) => {
+ const bounds = row.getBoundingClientRect();
+ return bounds.width > 0 && bounds.height > 0 && getComputedStyle(row).visibility === 'visible';
+ }).map((row) => row.dataset.item),
+ empty: document.querySelector('#chain .empty')?.textContent.trim() ?? '',
+ action: document.querySelector('#chain [data-filter-choice="state:all"]')?.textContent.trim() ?? '',
+ })`));
+ if (initial.visibleRows.includes('1')) return;
+
+ assert.equal(initial.state, 'active', 'the explanatory state applies to the default Active filter');
+ assert.doesNotMatch(initial.empty, /\n/, 'the finished-work explanation stays on one line');
+ assert.match(initial.empty, /finished work is under All/i, 'the empty state explains where the accepted item went');
+ assert.ok(initial.action, 'the message provides a one-click way to show the finished item');
+ await press(chrome, "document.querySelector('#chain [data-filter-choice=\"state:all\"]')");
+ await chrome.waitFor("view.state === 'all' && (() => { const row = document.querySelector('#chain .row[data-item=\"1\"]'); const bounds = row?.getBoundingClientRect(); return bounds?.width > 0 && bounds?.height > 0 && getComputedStyle(row).visibility === 'visible'; })()");
+ assert.equal(await chrome.stable("document.querySelector('#chain .row[data-item=\"1\"]').getAttribute('title')"), 'Finished item',
+ 'the message action opens All and reveals the accepted work');
+ assert.deepEqual(chrome.exceptions, [], 'the empty-state action produces no browser exceptions');
+ } finally {
+ if (chrome) await chrome.close();
+ await view.stop();
+ rmSync(profile, { recursive: true, force: true });
+ }
+});