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): name newly added items [A3,N27]

Corey Olsonea1078ced7da
diff --git a/src/cockpit.js b/src/cockpit.js
index 8c34951c..aa1a515b 100644
--- a/src/cockpit.js
+++ b/src/cockpit.js
@@ -843,7 +843,7 @@ function pageMove(command, args = {}) {
/** Describe an API-confirmed move without exposing its transport document in the page. */
function moveMessage(move, result) {
- if (move.verb === 'add') return 'added #' + result.id;
+ if (move.verb === 'add') return 'added #' + result.item.item_id;
if (move.verb === 'shout') return 'shouted to ' + move.args.to;
if (move.verb === 'answer') return 'answered #' + move.item;
return move.args.off ? 'released the ' + move.args.lane + ' lane' : 'holding the ' + move.args.lane + ' lane: ' + move.args.reason;
diff --git a/test/cockpit.test.js b/test/cockpit.test.js
index 4deef8c7..f4978af9 100644
--- a/test/cockpit.test.js
+++ b/test/cockpit.test.js
@@ -396,6 +396,32 @@ test('the page uses only API v1 for state, code and every offered move [A3,N26,N
}
});
+test('an added item confirmation names its returned id [A3,N27]', async () => {
+ const box = machine();
+ const alpha = project(box, 'alpha');
+ box.run(alpha.repo, 'add', 'web', 'An existing item', '--specs', 'G1');
+ const view = await startView(box);
+ try {
+ const page = await openPage(view);
+ const ids = [];
+ for (const title of ['First page item', 'Second page item']) {
+ await page.fire('new-item', 'click');
+ page.element('add-lane').value = 'web';
+ page.element('add-title').value = title;
+ page.element('add-specs').value = 'G1';
+ await page.fire('add-form', 'submit');
+ const item = (await boardOf(view, alpha.repo)).items.find((row) => row.title === title);
+ assert.ok(item, 'the real public move creates the submitted item');
+ ids.push(item.id);
+ assert.equal(page.element('console').className, 'console ok');
+ assert.equal(page.element('console').textContent.split('\n').at(-1), `added #${item.id}`);
+ }
+ assert.notEqual(ids[0], ids[1], 'successive confirmations use their distinct returned ids');
+ } finally {
+ await view.stop();
+ }
+});
+
test('the sidebar lists every project and what needs the person [N26]', async () => {
const box = machine();
const alpha = project(box, 'alpha');