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): a project with only withdrawn items asks for a pick [N26]

Corey Olson9e39f54db60b
diff --git a/src/cockpit.js b/src/cockpit.js
index 7d92a8dd..02835a8d 100644
--- a/src/cockpit.js
+++ b/src/cockpit.js
@@ -377,10 +377,10 @@ function render() {
}).join('') : '<li class="empty">' + (items.length ? 'No items match.' : 'No items yet. Add the first one with New item.') + '</li>';
const item = p.items.find((i) => i.id === view.item);
- // The form shows when asked for, or when the project has nothing yet to show instead.
- const adding = view.adding || !items.length;
+ // The form shows when asked for, or when the project has no item at all, withdrawn ones included.
+ const adding = view.adding || !p.items.length;
$('add-form').hidden = !adding;
- $('add-cancel').hidden = !items.length;
+ $('add-cancel').hidden = !p.items.length;
$('detail').hidden = adding;
if (!item) $('detail').innerHTML = '<div class="empty">Pick an item to see its criterion, verdicts and history.</div>';
if (item && !view.adding) {
diff --git a/test/cockpit.test.js b/test/cockpit.test.js
index cc3c0cb6..2ec6fa79 100644
--- a/test/cockpit.test.js
+++ b/test/cockpit.test.js
@@ -426,6 +426,9 @@ test('the detail opens on the top item, not a blank form [N26]', async () => {
box.run(done.repo, 'add', 'web', 'Shipped page', '--specs', 'G1', '--criterion', 'renders');
build(box, done, 1, 'shipped.html');
accept(box, done, 1);
+ const gone = project(box, 'gone');
+ box.run(gone.repo, 'add', 'web', 'Dropped page', '--specs', 'G1', '--criterion', 'renders');
+ box.run(gone.repo, 'withdraw', '1', 'nobody needs it');
const view = await startView(box);
try {
const page = await openPage(view);
@@ -463,6 +466,11 @@ test('the detail opens on the top item, not a blank form [N26]', async () => {
assert.deepEqual(rows(), [], 'Active shows nothing: the only item is verified');
assert.deepEqual(form(), [true, false]);
assert.match(page.show('detail'), /Pick an item to see its criterion, verdicts and history\./);
+
+ await page.click({ root: gone.repo, classes: 'proj side' });
+ assert.deepEqual(rows(), [], 'no chip lists the only item: it is withdrawn');
+ assert.deepEqual(form(), [true, false], 'but an item exists, so no form');
+ assert.match(page.show('detail'), /Pick an item to see its criterion, verdicts and history\./);
} finally {
await view.stop();
}