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.

feat(view): needs-you holds only the person's calls [B26,N26]

Corey Olsonc97761b194ea
diff --git a/src/cockpit.js b/src/cockpit.js
index ccddb4f8..6f6b8413 100644
--- a/src/cockpit.js
+++ b/src/cockpit.js
@@ -175,20 +175,18 @@ const codeRef = (ref, before) => {
};
const tone = (s) => s === 'approved' ? 'ok' : s === 'pending' ? 'no' : s === 'draft' ? 'warn' : '';
const count = (n, one, many = one) => n + ' ' + (n === 1 ? one : many);
-// What needs the person in a project, as its Needs-you list counts it: work sent back or waiting for a
-// verdict, open questions, held lanes.
-const needCount = (x) => x.ok ? x.decisions + x.sentBack + x.awaiting + x.pending + x.holds : 0;
-const doing = (x) => [x.decisions && count(x.decisions, 'decision', 'decisions'), x.sentBack && count(x.sentBack, 'sent back'), x.awaiting && count(x.awaiting, 'to verify'), x.pending && count(x.pending, 'question', 'questions'), x.holds && count(x.holds, 'lane held', 'lanes held'), x.building && count(x.building, 'building')].filter(Boolean).join(' · ') || (x.open ? count(x.open, 'item open', 'items open') : 'nothing open');
-/** The actionable rows shown in one repo's Needs-you panel, reused by a combined project view. */
+// What needs the person in a project, as its Needs-you list counts it: only the person's calls (B26),
+// the decisions passed up to them, spec rows waiting for them, and held lanes, which only the main
+// checkout, the person's seat, can set. Work waiting for a verdict or sent back belongs to the agents,
+// and the line under the project says so without counting it.
+const needCount = (x) => x.ok ? x.decisions + x.pending + x.drafts + x.holds : 0;
+const doing = (x) => [x.decisions && count(x.decisions, 'decision', 'decisions'), x.pending && count(x.pending, 'question', 'questions'), x.drafts && count(x.drafts, 'draft row', 'draft rows'), x.holds && count(x.holds, 'lane held', 'lanes held'), x.sentBack && count(x.sentBack, 'sent back'), x.awaiting && count(x.awaiting, 'to verify'), x.building && count(x.building, 'building')].filter(Boolean).join(' · ') || (x.open ? count(x.open, 'item open', 'items open') : 'nothing open');
+/** The person's calls in one repo, as its Needs-you panel shows them, reused by a combined project view. */
function projectNeeds(p) {
- const items = p.items.filter((item) => item.status !== 'withdrawn');
- const by = (state) => items.filter((item) => stateOf(item) === state);
return [
...p.decisions.map((d) => ({ ref: d.shout_from, text: d.shout_text, what: 'decision', at: d.shout_at })),
...p.spec.filter((row) => row.status === 'pending').map((row) => ({ ref: row.id, text: row.text, what: 'answer in SPEC.md' })),
- ...by('back').map((item) => ({ ref: '#' + item.id, text: item.title, what: 'sent back: ' + item.verdict.reason, target: 'item:' + item.id, at: item.updatedAt })),
- ...by('verify').map((item) => ({ ref: '#' + item.id, text: item.title, what: item.reviewer ? 'being reviewed by ' + item.reviewer : rejected(item) ? 'resubmitted after ' + item.verdict.reason : 'to verify', target: 'item:' + item.id, at: item.updatedAt })),
- ...p.holds.map((hold) => ({ ref: hold.hold_lane, text: hold.hold_reason, what: 'lane held' })),
+ ...p.holds.map((hold) => ({ ref: hold.hold_lane, text: hold.hold_reason, what: 'lane held by ' + hold.hold_by })),
...(p.spec.some((row) => row.status === 'draft') ? [{ ref: String(p.spec.filter((row) => row.status === 'draft').length), text: 'draft spec rows to approve or drop', what: 'review in SPEC.md', target: 'tab:spec' }] : []),
];
}
@@ -505,20 +503,18 @@ function render() {
+ (states.length ? '<small>' + states.map(([label, dot, n]) => '<span><i class="dot ' + dot + '"></i>' + n + ' ' + label + '</span>').join('') + '</small>' : '') + '</div>';
}).join('');
const items = p.items.filter((i) => i.status !== 'withdrawn');
- const by = (s) => items.filter((i) => stateOf(i) === s);
const active = items.filter((i) => stateOf(i) !== 'verified');
$('count-items').textContent = active.length || '';
$('count-spec').textContent = p.spec.filter((r) => ['pending', 'draft'].includes(r.status)).length || '';
$('count-doctrine').textContent = p.practice.filter((r) => ['pending', 'draft'].includes(r.status)).length || '';
- // What needs the person, first: decisions asked, questions, work sent back, work waiting for a
- // verdict, held lanes.
+ // What needs the person, first, and only the person's calls (B26): the decisions passed up to them,
+ // questions in the spec, held lanes, then draft rows. Work waiting for a verdict or sent back shows
+ // on the board with who holds it; it is the agents' to move.
const needs = [
...p.decisions.map((d) => ['decide:' + d.shout_id, d.shout_from, d.shout_text, 'decide', d.shout_at]),
...p.spec.filter((r) => r.status === 'pending').map((r) => ['spec:' + r.id, r.id, r.text, 'answer in SPEC.md']),
- ...by('back').map((i) => ['item:' + i.id, '#' + i.id, i.title, 'sent back: ' + i.verdict.reason]),
- ...by('verify').map((i) => ['item:' + i.id, '#' + i.id, i.title, (i.reviewer ? 'being reviewed by ' + i.reviewer : rejected(i) ? 'resubmitted after ' + i.verdict.reason : 'to verify'), i.updatedAt]),
- ...p.holds.map((h) => ['tab:shouts', h.hold_lane, h.hold_reason, 'lane held']),
+ ...p.holds.map((h) => ['tab:shouts', h.hold_lane, h.hold_reason, 'lane held by ' + h.hold_by]),
];
const drafts = p.spec.filter((r) => r.status === 'draft').length;
$('needs').hidden = !needs.length && !drafts;
@@ -602,9 +598,11 @@ function render() {
// and the commit, shortened, with the full SHA on hover.
const evidence = (x) => (x.shout_evidence_kind ? '<span class="ev"><b>' + esc(x.shout_evidence_kind) + '</b> ' + esc(x.shout_evidence_outcome) + ' · ' + linked('#' + x.shout_evidence_item) + ' · ' + esc(x.shout_from) + ' · <code title="' + esc(x.shout_evidence_commit) + '">' + esc(String(x.shout_evidence_commit).slice(0, 12)) + '</code></span>' : '');
$('feed').innerHTML = p.shouts.length ? byDay(p.shouts, (x) => x.shout_at, (x) => '<div><time>' + clock(x.shout_at) + '</time><div><b>' + esc(x.shout_from) + ' → ' + esc(x.shout_to) + '</b> ' + mark(x) + linked(x.shout_text) + evidence(x) + '</div></div>') : '<div class="empty">No shouts yet.</div>';
- // Each ask waits here until it is answered (B21); the answer itself is typed in the form below.
- $('decisions').hidden = !p.decisions.length;
- $('decisions').innerHTML = '<div class="head"><i></i>Decision needed</div>' + p.decisions.map((d) => '<div class="ask"><p><small><b>' + esc(d.shout_from) + '</b> asks, ' + age(d.shout_at) + '</small></p><p>' + linked(d.shout_text) + '</p><button class="ghost" data-go="decide:' + d.shout_id + '" type="button">Answer</button></div>').join('');
+ // Each ask waits here until it is answered (B21); the answer itself is typed in the form below. The
+ // person answers the ones passed up to them; the rest wait on whoever holds them (B26).
+ $('decisions').hidden = !p.decisions.length && !p.asked.length;
+ $('decisions').innerHTML = (p.decisions.length ? '<div class="head"><i></i>Decision needed</div>' + p.decisions.map((d) => '<div class="ask"><p><small><b>' + esc(d.shout_from) + '</b> asks, ' + age(d.shout_at) + '</small></p><p>' + linked(d.shout_text) + '</p><button class="ghost" data-go="decide:' + d.shout_id + '" type="button">Answer</button></div>').join('') : '')
+ + (p.asked.length ? '<div class="head quiet">Waiting on others</div>' + p.asked.map((d) => '<div class="ask other"><p><small><b>' + esc(d.shout_from) + '</b> asks <b>' + esc(d.shout_to) + '</b>, ' + age(d.shout_at) + '</small></p><p>' + linked(d.shout_text) + '</p></div>').join('') : '');
$('shout-targets').innerHTML = ['all', ...lanes, ...p.agents.map((a) => a.agent_id)].map((t) => '<option value="' + esc(t) + '">').join('');
// Each agent with what it holds: its claim, then its work sent back, then its work waiting for a
// verdict. The worktree path is there on hover; what the person reads is who is doing what.
@@ -617,7 +615,7 @@ function render() {
+ (mine.length ? mine.map((i) => '<button data-go="item:' + i.id + '" type="button"><span>#' + i.id + ' ' + esc(i.title) + '</span>' + (i.reviewer === a.agent_id ? '<span class="chip warn">reviewing</span>' : chip(stateOf(i))) + '</button>').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</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('');
+ $('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('');
for (const kind of ['spec', 'doctrine']) {
const rows = kind === 'spec' ? p.spec : p.practice;
diff --git a/src/serve.js b/src/serve.js
index b2f86b3b..d9f4188b 100644
--- a/src/serve.js
+++ b/src/serve.js
@@ -90,7 +90,7 @@ function summary(project) {
return withProject(project.root, (board, info, config) => {
const items = store.listItems(board, { all: true });
const count = (test) => items.filter(test).length;
- const pending = loadSpec(info.root, config).rows.filter((row) => row.status === 'pending').length;
+ const spec = loadSpec(info.root, config).rows;
return {
...project,
ok: true,
@@ -99,10 +99,12 @@ function summary(project) {
sentBack: count((item) => item.item_status === 'open' && item.item_verdict === 'REJECT'),
open: count((item) => item.item_status === 'open'),
verified: count((item) => item.item_status === 'verified'),
- pending,
+ // What the person decides (B26): rows waiting for their call, held lanes, and the decisions
+ // passed up to them. An agent's ask goes to its coordinator, and stays off this count.
+ pending: spec.filter((row) => row.status === 'pending').length,
+ drafts: spec.filter((row) => row.status === 'draft').length,
holds: store.laneHolds(board).length,
- // Asks still waiting for an answer need the person as much as a verdict does (B21).
- decisions: store.openDecisions(board).length,
+ decisions: store.openDecisions(board, store.PERSON).length,
};
});
} catch (error) {
@@ -181,8 +183,10 @@ export function projectState(root, { seen = null } = {}) {
};
}),
shouts: store.recentShouts(board, 40),
- // Every ask still waiting for an answer, however far back the forty shouts reach (B21).
- decisions: store.openDecisions(board),
+ // Every ask still waiting for an answer, however far back the forty shouts reach (B21): the
+ // person's to answer here, and the rest with who holds them (B26).
+ decisions: store.openDecisions(board, store.PERSON),
+ asked: store.openDecisions(board).filter((ask) => ask.shout_to !== store.PERSON),
events: log.slice(-80).reverse(),
agents: store.listAgents(board).map((agent) => ({ ...agent, lastMoveAt: lastMove.get(agent.agent_id) ?? null })),
holds: store.laneHolds(board),
@@ -249,7 +253,8 @@ export function actionArgs(command, args = {}) {
return ['add', text(args.lane), text(args.title), ...(text(args.criterion) ? ['--criterion', text(args.criterion)] : []), ...(text(args.specs) ? ['--specs', text(args.specs)] : []), ...(text(args.brief) ? ['--brief', text(args.brief)] : [])];
}
if (command === 'shout') return ['shout', text(args.to), text(args.text)];
- if (command === 'answer') return ['answer', text(args.id), text(args.text)];
+ // The view is the person's, so it answers as the person (B26).
+ if (command === 'answer') return ['answer', text(args.id), text(args.text), '--as', 'person'];
if (command === 'hold') return ['hold', text(args.lane), '--reason', text(args.reason)];
if (command === 'release') return ['hold', text(args.lane), '--off'];
return null;
diff --git a/src/view.css b/src/view.css
index 73a5d4d5..f830e067 100644
--- a/src/view.css
+++ b/src/view.css
@@ -126,6 +126,8 @@ input:disabled { background: var(--surface-2); color: var(--ink-muted); }
.needs-you { background: color-mix(in srgb, var(--warn) 8%, var(--surface)); border: 1px solid color-mix(in srgb, var(--warn) 38%, var(--line)); border-radius: 14px; box-shadow: var(--shadow); padding: 10px 12px; display: grid; gap: 4px; }
.needs-you .head { font-weight: 700; display: flex; gap: 8px; align-items: center; }
.needs-you .head i { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); display: inline-block; }
+.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:hover { background: color-mix(in srgb, var(--warn) 10%, var(--surface)); }
diff --git a/test/cockpit.test.js b/test/cockpit.test.js
index 4985ccb7..74630646 100644
--- a/test/cockpit.test.js
+++ b/test/cockpit.test.js
@@ -358,7 +358,7 @@ test('the sidebar lists every project and what needs the person [N26]', async ()
assert.match(style, /@media \(max-width: 900px\) \{[^@]*\.side-body \{ display: none;[^@]*\.side\.open \.side-body \{ display: grid; \}/, 'under 900px the list folds behind the project button');
assert.deepEqual(projectRows(page.show('proj-list')), [
- { root: alpha.repo, name: 'alpha', needs: '2', line: '1 sent back · 1 to verify', current: true },
+ { root: alpha.repo, name: 'alpha', needs: '', line: '1 sent back · 1 to verify', current: true },
{ root: beta.repo, name: 'beta', needs: '2', line: '1 question · 1 lane held', current: false },
{ root: gamma.repo.replace('<', '&lt;').replace('>', '&gt;'), name: 'gam&lt;i&gt;ma', needs: '', line: '1 item open', current: false },
]);
@@ -369,7 +369,7 @@ test('the sidebar lists every project and what needs the person [N26]', async ()
assert.match(page.show('chain'), /Gamma page/, 'the main column shows the project picked');
assert.doesNotMatch(page.show('chain'), /Greeting/);
assert.equal(page.element('proj-name').textContent, 'gam<i>ma');
- assert.equal(page.element('proj-elsewhere').textContent, '4 elsewhere', 'the folded button counts what needs the person elsewhere');
+ assert.equal(page.element('proj-elsewhere').textContent, '2 elsewhere', 'the folded button counts what needs the person elsewhere: beta\'s question and held lane, not alpha\'s agents\' work');
await page.click({ id: 'proj-switch', classes: 'switch-btn side' });
assert.ok(page.element('side').classList.contains('open'), 'the project button opens the list');
@@ -383,13 +383,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, { name: 'Core API', project: 'Atlas' });
+ 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');
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');
build(box, web, 1, 'header.html');
+ box.run(web.repo, 'shout', 'person', 'Ship the header 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);
@@ -422,7 +423,9 @@ 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'), /sent back: BEHAVIOR_MISMATCH/);
+ 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.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/);
@@ -675,7 +678,7 @@ test('a review in progress names its reviewer [N26]', async () => {
try {
const page = await openPage(view);
assert.match(itemRow(page.show('chain'), 1), /<span class="chip warn" title="reviewing until [^"]+">web-2 reviewing<\/span><\/li>$/, 'the row names who holds the review');
- assert.match(page.show('needs'), /<code>#1<\/code><span>Greeting<\/span><em>being reviewed by web-2, <time data-ago="[^"]+">[^<]+<\/time> →<\/em>/);
+ assert.doesNotMatch(page.show('needs'), /Greeting/, "a review is the agents' work, so it stays out of Needs-you");
const holds = (id) => agentEntries(page.show('agents')).find((agent) => agent.id === id).holds;
assert.deepEqual(holds('web-2'), ['#1 Greeting: reviewing'], 'the reviewer holds it');
assert.deepEqual(holds('web-1'), ['#1 Greeting: to verify'], 'the builder waits on it');
@@ -710,11 +713,11 @@ test('the tab title says what needs you [N26]', async () => {
try {
const page = await openPage(view);
const title = () => page.run('document.title');
- assert.equal(title(), '(3) alpha · Pullboard', 'one sent back and one to verify here, one lane held in beta');
+ assert.equal(title(), '(1) alpha · Pullboard', "the lane held in beta; alpha's work sent back or waiting for a verdict is the agents'");
page.run(`switchTo(${JSON.stringify(calm.repo)})`);
- assert.equal(title(), '(3) calm · Pullboard', 'a switch names the project at once; the count still covers them all');
+ assert.equal(title(), '(1) calm · Pullboard', 'a switch names the project at once; the count still covers them all');
await page.run('refresh()');
- assert.equal(title(), '(3) calm · Pullboard');
+ assert.equal(title(), '(1) calm · Pullboard');
box.run(alpha.repo, 'withdraw', '1', 'the greeting moved to the next release');
accept(box, alpha, 2);
@@ -728,7 +731,7 @@ test('the tab title says what needs you [N26]', async () => {
await nobody.stop();
}
});
-test('an open decision counts in the sidebar and the tab title [B21, N26]', async () => {
+test('an open decision counts in the sidebar and the tab title [B21, B26, N26]', async () => {
const box = machine();
const alpha = project(box, 'alpha');
const beta = project(box, 'beta');
@@ -737,17 +740,22 @@ test('an open decision counts in the sidebar and the tab title [B21, N26]', asyn
try {
const page = await openPage(view);
const rows = () => projectRows(page.show('proj-list')).map((row) => [row.name, row.needs, row.line]);
- assert.deepEqual(rows(), [['alpha', '', 'nothing open'], ['beta', '1', '1 decision']], "beta's ask needs the person, from alpha too");
+ assert.deepEqual(rows(), [['alpha', '', 'nothing open'], ['beta', '', 'nothing open']], "an agent's ask is its coordinator's to answer, so it counts for no one here");
+
+ box.run(beta.repo, 'pass', '1', 'it changes the launch');
+ await page.run('refresh()');
+ assert.deepEqual(rows(), [['alpha', '', 'nothing open'], ['beta', '1', '1 decision']], "passed up, it needs the person, from alpha too");
assert.equal(page.run('document.title'), '(1) alpha · Pullboard');
assert.equal(page.element('proj-elsewhere').textContent, '1 elsewhere', 'and on a phone');
- box.run(beta.web, 'shout', 'coordinator', 'And the docs?', '--decision');
+ box.run(beta.repo, 'shout', 'person', 'And the docs?', '--decision');
await page.run('refresh()');
- assert.deepEqual(rows()[1], ['beta', '2', '2 decisions']);
- box.run(beta.repo, 'answer', '1', 'yes');
- box.run(beta.repo, 'answer', '2', 'after');
+ assert.deepEqual(rows()[1], ['beta', '2', '2 decisions'], 'a coordinator asks the person straight out too');
+ box.run(beta.repo, 'answer', '2', 'yes', '--as', 'person');
+ box.run(beta.repo, 'answer', '3', 'after', '--as', 'person');
await page.run('refresh()');
assert.deepEqual(rows(), [['alpha', '', 'nothing open'], ['beta', '', 'nothing open']], 'answered, they need no one');
+ assert.match(box.run(beta.web, 'inbox'), /person -> web-1: answers \\?#1: Person answered \\?#2: yes/, "the person's answer reaches the agent that asked");
assert.equal(page.run('document.title'), 'alpha · Pullboard');
assert.equal(page.element('proj-elsewhere').hidden, true);
} finally {
@@ -992,12 +1000,13 @@ test('ages stay true while the board is quiet [N26]', async () => {
const alpha = project(box, 'alpha');
box.run(alpha.repo, 'add', 'web', 'Greeting', '--specs', 'G1', '--criterion', 'greets');
build(box, alpha, 1, 'greeting.html');
+ box.run(alpha.repo, 'shout', 'person', 'Ship the greeting today?', '--decision');
const view = await startView(box);
try {
const page = await openPage(view);
const ages = () => ({
row: /<time data-ago="[^"]+">([^<]*)<\/time>/.exec(itemRow(page.show('chain'), 1))?.[1],
- needs: /to verify, <time data-ago="[^"]+">([^<]*)<\/time>/.exec(page.show('needs'))?.[1],
+ needs: /decide, <time data-ago="[^"]+">([^<]*)<\/time>/.exec(page.show('needs'))?.[1],
agent: agentEntries(page.show('agents')).find((agent) => agent.id === 'web-1')?.age,
});
assert.deepEqual(ages(), { row: 'now', needs: 'now', agent: 'now' });
@@ -1130,8 +1139,7 @@ test('a sent-back item shows why first [N26]', async () => {
const page = await openPage(view);
const beforeCriterion = () => page.show('detail').slice(0, Math.max(0, page.show('detail').indexOf('<h3>Criterion</h3>')));
const needs = page.show('needs');
- assert.match(needs, /<code>#1<\/code><span>Greeting<\/span><em>sent back: BEHAVIOR_MISMATCH →<\/em>/);
- assert.match(needs, /<code>#2<\/code><span>Farewell<\/span><em>resubmitted after BEHAVIOR_MISMATCH, <time data-ago="[^"]+">\w+<\/time> →<\/em>/);
+ assert.doesNotMatch(needs, /Greeting|Farewell/, "work sent back is the agents' to move, so it stays out of Needs-you; its row says why");
const row = itemRow(page.show('chain'), 1);
assert.ok(row.includes('BEHAVIOR_MISMATCH: no &lt;b&gt;greeting&lt;/b&gt; on the page'), row);
assert.ok(!row.includes('second line'), 'the row shows the first line of the note only');
@@ -1276,7 +1284,7 @@ test('shout ids, search and narrow windows reach the item [N26]', async () => {
}
});
-test('a decision waits in needs-you until the view answers it [B21, N27]', async () => {
+test('a decision waits in needs-you until the view answers it [B21, B26, N27]', async () => {
const box = machine();
const alpha = project(box, 'alpha');
box.run(alpha.web, 'shout', 'coordinator', 'Greet in <b>French</b> first?', '--decision');
@@ -1290,11 +1298,19 @@ test('a decision waits in needs-you until the view answers it [B21, N27]', async
const page = await openPage(view);
// The question as the page escapes it, written as a pattern.
const question = 'Greet in &lt;b&gt;French&lt;/b&gt; first\\?';
- assert.match(page.show('needs'), new RegExp(`^<div class="head"><i></i>Needs you</div><button class="ny" data-go="decide:1" type="button"><code>web-1</code><span>${question}</span><em>decide, <time data-ago="[^"]+">now</time> →</em></button>`), 'first in Needs-you: who asks, what, and since when');
+ // An agent asks its coordinator (B25): the ask waits on the board with who holds it, never in Needs-you.
+ assert.doesNotMatch(page.show('needs'), /decide:/, "an agent's ask is its coordinator's to answer");
assert.equal(page.element('decisions').hidden, false);
- assert.match(page.show('decisions'), new RegExp(`^<div class="head"><i></i>Decision needed</div><div class="ask"><p><small><b>web-1</b> asks, <time data-ago="[^"]+">now</time></small></p><p>${question}</p><button class="ghost" data-go="decide:1" type="button">Answer</button></div>$`), 'and above the shouts, with an Answer button');
+ assert.match(page.show('decisions'), new RegExp(`^<div class="head quiet">Waiting on others</div><div class="ask other"><p><small><b>web-1</b> asks <b>coordinator</b>, <time data-ago="[^"]+">now</time></small></p><p>${question}</p></div>$`), 'above the shouts, saying who holds it, with no Answer button');
assert.doesNotMatch(page.show('feed'), /Greet in/, 'though the feed no longer reaches it');
+ // The coordinator passes it up with its note (B27): now it is the person's call.
+ 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}</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('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}</p><button class="ghost" data-go="decide:42" type="button">Answer</button></div>$`), 'and above the shouts, with an Answer button');
+
const form = () => ({
answering: !page.element('answering').hidden,
who: page.element('answering-who').textContent,
@@ -1304,52 +1320,92 @@ test('a decision waits in needs-you until the view answers it [B21, N27]', async
button: page.element('shout-send').textContent,
});
page.element('shout-to').value = 'web';
- await page.click({ go: 'decide:1' });
+ await page.click({ go: 'decide:42' });
assert.equal(page.run('view.tab'), 'shouts');
- assert.deepEqual(form(), { answering: true, who: 'web-1', question: 'Greet in <b>French</b> first?', to: 'web-1', locked: true, button: 'Answer' }, 'Answer turns the form to answering the asker');
+ assert.deepEqual(form(), { answering: true, who: 'coordinator', question: 'Passed up from web-1: Greet in <b>French</b> first?\nCoordinator note: over to you', to: 'coordinator', locked: true, button: 'Answer' }, 'Answer turns the form to answering the one who asked');
await page.fire('answer-cancel', 'click');
assert.deepEqual(form(), { answering: false, who: '', question: '', to: 'web', locked: false, button: 'Shout' }, 'Cancel gives back the plain shout');
- await page.click({ go: 'decide:1' });
+ await page.click({ go: 'decide:42' });
page.element('shout-text').value = 'French, then English';
await page.fire('shout-form', 'submit');
- assert.equal(page.element('console').textContent.split('\n')[0], '$ pullboard answer 1 French, then English');
+ assert.equal(page.element('console').textContent.split('\n')[0], '$ pullboard answer 42 French, then English --as person', 'the view answers as the person');
assert.equal(page.element('console').className, 'console ok');
- assert.match(box.run(alpha.web, 'inbox'), /coordinator -> web-1: answers #1: French, then English/, 'the answer reaches the asker');
+ assert.match(box.run(alpha.web, 'inbox'), /person -> web-1: answers \\?#1: Person answered \\?#42: French, then English/, 'the answer reaches the agent that asked');
assert.deepEqual(form(), { answering: false, who: '', question: '', to: 'web', locked: false, button: 'Shout' }, 'the form is a plain shout again');
assert.equal(page.element('shout-text').value, '');
assert.doesNotMatch(page.show('needs'), /decide:/, 'an answered decision leaves Needs-you');
assert.equal(page.element('decisions').hidden, true, 'and the banner');
box.run(alpha.web, 'shout', 'coordinator', 'Ship today?', '--decision');
+ box.run(alpha.repo, 'pass', '45', 'yours');
await page.run('refresh()');
const feed = page.show('feed');
assert.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"/);
+ assert.match(feed, /<b>person → coordinator<\/b> <span class="mark">answer<\/span> French, then English/, 'and an answer');
+ assert.match(page.show('needs'), /data-go="decide:46"/);
// An answer belongs to the project whose question it shows.
+ box.run(beta.repo, 'pass', '1', 'yours too');
const plain = { answering: false, who: '', question: '', to: 'web', locked: false, button: 'Shout' };
- await page.click({ go: 'decide:43' });
+ await page.click({ go: 'decide:46' });
// 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.click({ go: 'decide:2' });
+ assert.equal(form().question, 'Passed up from web-1: Beta asks too?\nCoordinator note: yours 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' });
+ await page.click({ go: 'decide:2' });
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");
+ assert.equal(page.element('console').textContent.split('\n')[0], '$ pullboard answer 42 French, then English --as person', 'nothing ran');
+ assert.match(box.run(beta.repo, 'decisions', '--as', 'person'), /^#2 {2}coordinator -> person, [^:]+: Passed up from web-1: Beta asks too\?/m, "beta's ask still waits");
+ assert.match(box.run(alpha.repo, 'decisions', '--as', 'person'), /^#46 {2}coordinator -> person, [^:]+: Passed up from web-1: Ship today\?/m, "and so does alpha's");
+ } finally {
+ await view.stop();
+ }
+});
+test("needs-you holds only the person's calls; the rest show on the board with who holds them [B26, N26]", async () => {
+ const box = machine();
+ const alpha = project(box, 'alpha', `${SPEC}- G3 [pending] Greet in French? | gate: review\n- G4 [draft, aim] A footer on every page. | gate: review\n`);
+ box.run(alpha.repo, 'add', 'web', 'Greeting', '--specs', 'G1', '--criterion', 'greets');
+ box.run(alpha.repo, 'add', 'web', 'Farewell', '--specs', 'G2', '--criterion', 'says goodbye');
+ build(box, alpha, 1, 'greeting.html');
+ build(box, alpha, 2, 'farewell.html');
+ sendBack(box, alpha, 2, 'no farewell yet');
+ box.run(alpha.web, 'shout', 'coordinator', 'Which colour for the button?', '--decision');
+ box.run(alpha.repo, 'shout', 'person', 'Launch on Friday?', '--decision');
+ box.run(alpha.repo, 'hold', 'web', '--reason', 'G3 is open');
+ const view = await startView(box);
+ 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]]), [
+ ['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');
+
+ // 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");
+ assert.match(itemRow(page.show('chain'), 1), /<span class="chip [^"]*">to verify<\/span><\/li>$/, 'work waiting for a verdict');
+ assert.ok(itemRow(page.show('chain'), 2).includes('BEHAVIOR_MISMATCH: no farewell yet'), 'and work sent back, with why');
+ assert.deepEqual(agentEntries(page.show('agents')).find((agent) => agent.id === 'web-1').holds, ['#2 Farewell: sent back', '#1 Greeting: to verify'], 'the agent that built them holds both');
+ assert.match(page.show('lanes'), /<b>web<\/b> <span class="chip no">held by coordinator<\/span> <span class="muted">G3 is open<\/span>/, 'a held lane names who holds it');
+
+ // The sidebar counts exactly the person's calls; its line still says what the agents are doing.
+ assert.deepEqual(projectRows(page.show('proj-list')).map((row) => [row.needs, row.line]), [['4', '1 decision · 1 question · 1 draft row · 1 lane held · 1 sent back · 1 to verify']]);
+ assert.equal(page.run('document.title'), '(4) alpha · Pullboard');
} finally {
await view.stop();
}
@@ -1824,11 +1880,7 @@ test('activity names the item each event moved [N26]', async () => {
test('needs-you lines keep their titles on a phone [N26]', async () => {
const box = machine();
- const alpha = project(box, 'alpha');
- box.run(alpha.repo, 'add', 'web', 'A greeting with a title long enough to need the room', '--specs', 'G1', '--criterion', 'greets');
- build(box, alpha, 1, 'greeting.html');
- sendBack(box, alpha, 1, 'no greeting yet');
- build(box, alpha, 1, 'greeting-again.html');
+ project(box, 'alpha', `${SPEC}- G3 [pending] Should a greeting with a title long enough to need the room wrap? | gate: review\n`);
const view = await startView(box);
try {
const page = await openPage(view, { width: 375 });
@@ -1836,7 +1888,7 @@ test('needs-you lines keep their titles on a phone [N26]', async () => {
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="item:1" type="button"><code>#1<\/code><span>A greeting with a title long enough to need the room<\/span><em>resubmitted after BEHAVIOR_MISMATCH, [^]*? →<\/em><\/button>/);
+ 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>/);
} finally {
await view.stop();
}