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.
JavaScript agentic-codingai-agentsai-governanceautonomous-agentsclaude-codeclicode-reviewcodexcoding-agentsdeveloper-toolsgit-hooksllmlocal-firstmulti-agentsoftware-factoryspec-driven-developmentverificationvibe-coding
fix(view): an answer stays with the project it answers [B21,N27]
Corey Olsonb9d2a3e290cf
diff --git a/src/cockpit.js b/src/cockpit.jsindex e366f24a..85ae9929 100644--- a/src/cockpit.js+++ b/src/cockpit.js@@ -606,6 +606,7 @@ function renderSide() {function render() {const p = data.project;renderSide();+ if (view.answering && view.answering.root !== view.root) answer(null);// Until the first board arrives the page shows no tabs or panes, so a machine with none never// flashes them; with no board to show, one message says how a board starts, in their place.document.body.classList.remove('loading');@@ -774,13 +775,14 @@ function countUnseen() {/*** Put the shout form in answer mode for an open decision (B21), or back to a plain shout with null.* The form is never redrawn, so what the person types survives every refresh; only its answer line,- * its To and its button change. The To the person had comes back when the answer is done.+ * its To and its button change. The To the person had comes back when the answer is done. An answer+ * belongs to the project whose question it shows: leaving that project leaves answer mode.*/function answer(id) {const ask = id === null ? null : data.project.decisions.find((d) => d.shout_id === id) || null;if (ask && !view.answering) view.to = $('shout-to').value;if (!ask && view.answering) $('shout-to').value = view.to || '';- view.answering = ask ? ask.shout_id : null;+ view.answering = ask ? { root: view.root, id: ask.shout_id } : null;$('answering').hidden = !ask;$('answering-who').textContent = ask ? ask.shout_from : '';$('answering-q').textContent = ask ? ask.shout_text : '';@@ -874,6 +876,7 @@ function fold(open) {/** Show another project: mark it at once, dim the old one's panes until its board arrives. */function switchTo(root) {+ answer(null);view.root = root;view.item = null;view.adding = false;@@ -926,7 +929,9 @@ $('add-form').addEventListener('submit', async (event) => {$('shout-form').addEventListener('submit', async (event) => {event.preventDefault();const text = $('shout-text').value;- if (!(await (view.answering ? act('answer', { id: view.answering, text }) : act('shout', { to: $('shout-to').value, text })))) return;+ const ask = view.answering;+ if (ask && ask.root !== view.root) return answer(null);+ if (!(await (ask ? act('answer', { id: ask.id, text }) : act('shout', { to: $('shout-to').value, text })))) return;$('shout-text').value = '';answer(null);});diff --git a/test/cockpit.test.js b/test/cockpit.test.jsindex 7db2597d..2ded0f7f 100644--- a/test/cockpit.test.js+++ b/test/cockpit.test.js@@ -1033,6 +1033,9 @@ test('a decision waits in needs-you until the view answers it [B21, N27]', asyncbox.run(alpha.web, 'shout', 'coordinator', 'Greet in <b>French</b> first?', '--decision');// Forty shouts after it: the ask is older than every shout the feed loads, and still waits.for (let n = 0; n < 40; n += 1) box.run(alpha.web, 'shout', 'all', `note ${n}`);+ // Another project's board numbers its shouts from 1 too.+ const beta = project(box, 'beta');+ box.run(beta.web, 'shout', 'coordinator', 'Beta asks too?', '--decision');const view = await startView(box);try {const page = await openPage(view);@@ -1075,6 +1078,29 @@ test('a decision waits in needs-you until the view answers it [B21, N27]', asyncassert.match(feed, /<b>web-1 → coordinator<\/b> <span class="mark ask">decision<\/span> Ship today\?/, 'the feed marks an ask');assert.match(feed, /<b>coordinator → web-1<\/b> <span class="mark">answer<\/span> French, then English/, 'and an answer');assert.match(page.show('needs'), /data-go="decide:43"/);++ // An answer belongs to the project whose question it shows.+ const plain = { answering: false, who: '', question: '', to: 'web', locked: false, button: 'Shout' };+ await page.click({ go: 'decide:43' });+ // The new project's board is held back, so this is the form the moment the switch is made.+ page.run('globalThis.plain = fetch; globalThis.fetch = (path, init) => new Promise((done) => { globalThis.resume = done; }).then(() => plain(path, init));');+ await page.click({ root: beta.repo });+ assert.deepEqual(form(), plain, 'leaving the project leaves answer mode at once');+ page.run('globalThis.fetch = plain; resume();');+ await page.run('refresh()');+ await page.click({ go: 'decide:1' });+ assert.equal(form().question, 'Beta asks too?');+ await page.run(`view.root = ${JSON.stringify(alpha.repo)}; seen = ''; refresh()`);+ assert.deepEqual(form(), plain, 'and so does a board drawn for another project');+ await page.run(`view.root = ${JSON.stringify(beta.repo)}; seen = ''; refresh()`);+ await page.click({ go: 'decide:1' });+ page.run(`view.root = ${JSON.stringify(alpha.repo)}`);+ page.element('shout-text').value = 'yes';+ await page.fire('shout-form', 'submit');+ assert.deepEqual(form(), plain, 'an answer is never sent to another project');+ assert.equal(page.element('console').textContent.split('\n')[0], '$ pullboard answer 1 French, then English', 'nothing ran');+ assert.match(box.run(beta.repo, 'decisions'), /^#1 {2}web-1 -> coordinator, [^:]+: Beta asks too\?$/m, "beta's ask still waits");+ assert.match(box.run(alpha.repo, 'decisions'), /^#43 {2}web-1 -> coordinator, [^:]+: Ship today\?$/m, "and so does alpha's");} finally {await view.stop();}