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): every lifecycle arrow carries its own label [N26]
Corey Olson77de2997c916
diff --git a/src/cockpit.js b/src/cockpit.jsindex b74aeb21..1a055c04 100644--- a/src/cockpit.js+++ b/src/cockpit.js@@ -372,7 +372,7 @@ function flowSvg(p) {const pos = new Map(row.map((s, i) => [s, { x: L + BW / 2 + i * step, y: Y }]));for (const s of FLOW.states.filter((s) => !pos.has(s.id))) {const from = row.filter((r) => leads(r).includes(s.id));- pos.set(s.id, { x: from.length ? from.reduce((n, r) => n + pos.get(r).x, 0) / from.length : W / 2, y: Y + 120 });+ pos.set(s.id, { x: from.length ? from.reduce((n, r) => n + pos.get(r).x, 0) / from.length : W / 2, y: Y + 150 });}const H = Math.max(...[...pos.values()].map((q) => q.y)) + BH / 2 + 20;const f = (v) => String(Math.round(v * 10) / 10);@@ -386,7 +386,6 @@ function flowSvg(p) {const made = (pair, m) => counts.get(pair.from + '>' + pair.to + ':' + m.verb) || 0;const says = (pair) => pair.moves.map((m) => m.verb + ', ' + pair.from + ' to ' + pair.to + ', by the ' + m.by.join(' or ') + ': ' + m.how + '. Made ' + count(made(pair, m), 'time', 'times') + (m.checks.length ? '.\\nChecks, in order:\\n' + m.checks.map((c) => ' ' + c).join('\\n') : '.')).join('\\n\\n');const text = (x, y, words, cls, anchor = 'middle') => '<text class="' + cls + '" x="' + f(x) + '" y="' + f(y) + '" text-anchor="' + anchor + '">' + esc(words) + '</text>';- const below = new Map();const arrows = pairs.map((pair) => {const a = pos.get(pair.from), b = pos.get(pair.to);const done = pair.moves.filter((m) => made(pair, m));@@ -408,19 +407,16 @@ function flowSvg(p) {d = 'M' + f(sx) + ' ' + f(top) + 'C' + f(sx) + ' ' + f(cy) + ' ' + f(ex) + ' ' + f(cy) + ' ' + f(ex) + ' ' + f(top);label = text((sx + ex) / 2, (top + 3 * cy) / 4 - 7, words, cls);} else {- // Down to a state off the row: the arrows spread across its top, one label beside its box.- d = 'M' + f(a.x) + ' ' + f(a.y + BH / 2) + 'L' + f(b.x + (a.x - b.x) * 0.3) + ' ' + f(b.y - BH / 2);- const into = below.get(pair.to) || { verbs: new Map() };- for (const m of pair.moves) into.verbs.set(m.verb, (into.verbs.get(m.verb) || 0) + made(pair, m));- below.set(pair.to, into);+ // Down to a state off the row: the arrows spread across its top, each labelled along its way,+ // on the side away from the others.+ const sy = a.y + BH / 2, ex = b.x + (a.x - b.x) * 0.3, ey = b.y - BH / 2;+ d = 'M' + f(a.x) + ' ' + f(sy) + 'L' + f(ex) + ' ' + f(ey);+ const lx = a.x + (ex - a.x) * 0.6, ly = sy + (ey - sy) * 0.6 + 4;+ // A straight drop, its ends equal but for rounding, keeps its label on the right.+ label = a.x < b.x - 0.5 ? text(lx - 6, ly, words, cls, 'end') : text(lx + 6, ly, words, cls, 'start');}return '<g><title>' + esc(says(pair)) + '</title><path class="edge' + tone + '" d="' + d + '" marker-end="url(#pb-head' + (tone ? '-no' : '') + ')"/>' + label + '</g>';});- for (const [id, into] of below) {- const b = pos.get(id), all = [...into.verbs];- const words = (all.some(([, n]) => n) ? all.filter(([, n]) => n).map(([v, n]) => v + ' ' + n) : all.map(([v]) => v)).join(' · ');- arrows.push(text(b.x + BW / 2 + 12, b.y + 4, words, 'tag' + (all.some(([, n]) => n) ? '' : ' idle'), 'start'));- }const back = p.items.filter((i) => stateOf(i) === 'back').length;const boxes = FLOW.states.map((s) => {const { x, y } = pos.get(s.id);diff --git a/test/cockpit.test.js b/test/cockpit.test.jsindex 127b5261..28353913 100644--- a/test/cockpit.test.js+++ b/test/cockpit.test.js@@ -365,13 +365,17 @@ test('the agents panel says what each agent holds [N26]', async () => {});/**- * The lifecycle drawing: each box's state, count and title; each arrow's title and label.+ * The lifecycle drawing: each box's state, count and title; each arrow's title, the pair of states+ * its title starts with, and the label drawn with it, if any.*/function drawing(svg) {return {boxes: [...svg.matchAll(/<g class="s-([^"]+)"><title>([^<]*)<\/title>[^]*?<text class="n"[^>]*>(\d+)<\/text>/g)].map((match) => ({ state: match[1], title: match[2], count: Number(match[3]) })),- arrows: [...svg.matchAll(/<g><title>([^<]*)<\/title><path class="edge[^"]*"/g)].map((match) => match[1]),- labels: [...svg.matchAll(/<text class="tag([^"]*)"[^>]*>([^<]*)<\/text>/g)].map((match) => match[2] + (match[1].includes('idle') ? ' (none yet)' : '')),+ arrows: [...svg.matchAll(/<g><title>([^<]*)<\/title><path class="edge[^"]*"[^>]*\/>(?:<text class="tag([^"]*)"[^>]*>([^<]*)<\/text>)?<\/g>/g)].map((match) => ({+ title: match[1],+ pair: /^\w+, (\w+) to (\w+),/.exec(match[1]).slice(1).join('>'),+ label: match[3] === undefined ? null : match[3] + (match[2].includes('idle') ? ' (none yet)' : ''),+ })),sentBack: /<text class="sub"[^>]*>([^<]*)<\/text>/.exec(svg)?.[1],};}@@ -379,11 +383,18 @@ function drawing(svg) {test('the activity tab draws the lifecycle from the declaration, with live counts [N26]', async () => {const box = machine();const alpha = project(box, 'alpha');- for (const title of ['Greeting', 'Farewell', 'Header', 'Footer', 'Sidebar']) box.run(alpha.repo, 'add', 'web', title, '--specs', 'G1', '--criterion', 'renders');+ for (const title of ['Greeting', 'Farewell', 'Header', 'Footer', 'Sidebar', 'Banner', 'Menu', 'Search']) box.run(alpha.repo, 'add', 'web', title, '--specs', 'G1', '--criterion', 'renders');build(box, alpha, 1, 'greeting.html');accept(box, alpha, 1);build(box, alpha, 2, 'farewell.html');sendBack(box, alpha, 2, 'no farewell');+ // Withdrawn from claimed twice, from submitted once and from open once, so each arrow has its count.+ for (const id of ['6', '8']) {+ box.run(alpha.web, 'claim', id);+ box.run(alpha.repo, 'withdraw', id, 'not this release');+ }+ build(box, alpha, 7, 'menu.html');+ box.run(alpha.repo, 'withdraw', '7', 'the menu moved to the next release');box.run(alpha.web, 'claim', '3');box.run(alpha.web, 'claim', '3');box.run(alpha.repo, 'withdraw', '4', 'the footer moved to the next release');@@ -392,31 +403,34 @@ test('the activity tab draws the lifecycle from the declaration, with live countconst page = await openPage(view);assert.doesNotMatch(page.html, /id="metrics"/, 'the drawing replaces the metric cards');assert.ok(!page.html.includes('pullboard claim <id>'), 'the declaration is embedded with < escaped');- const { boxes, arrows, labels, sentBack } = drawing(page.show('flow'));+ const { boxes, arrows, sentBack } = drawing(page.show('flow'));const esc = (text) => text.replaceAll('&', '&').replaceAll('<', '<').replaceAll('>', '>').replaceAll('"', '"').replaceAll("'", ''');assert.deepEqual(boxes.map((entry) => entry.state), MACHINE.states.map((state) => state.id), 'a box for every declared state');for (const state of MACHINE.states) assert.ok(boxes.find((entry) => entry.state === state.id).title.startsWith(esc(`${state.id}: ${state.means}`)), `${state.id} says what it means`);assert.match(boxes.find((entry) => entry.state === 'verified').title, /Every way in checks:\n {2}the caller's checkout contains the submitted commit\n {2}the caller did not build it/);- assert.deepEqual(Object.fromEntries(boxes.map((entry) => [entry.state, entry.count])), { open: 2, claimed: 1, submitted: 0, verified: 1, withdrawn: 1 });+ assert.deepEqual(Object.fromEntries(boxes.map((entry) => [entry.state, entry.count])), { open: 2, claimed: 1, submitted: 0, verified: 1, withdrawn: 4 });assert.equal(sentBack, '1 sent back');const pairs = new Set(MACHINE.moves.flatMap((move) => move.from.map((from) => `${from}>${move.to}`)));- assert.equal(arrows.length, pairs.size, 'one arrow per pair of states a move joins');+ assert.deepEqual(arrows.map((arrow) => arrow.pair).sort(), [...pairs].sort(), 'one arrow per pair of states a move joins');for (const move of MACHINE.moves) {- for (const from of move.from) assert.ok(arrows.some((title) => title.includes(`${move.verb}, ${from} to ${move.to}, by the ${move.by.join(' or ')}: `)), `${move.verb} from ${from} is on an arrow`);+ for (const from of move.from) assert.ok(arrows.find((arrow) => arrow.pair === `${from}>${move.to}`).title.includes(`${move.verb}, ${from} to ${move.to}, by the ${move.by.join(' or ')}: `), `${move.verb} from ${from} is on its arrow`);}- assert.ok(arrows.some((title) => title.includes('claim, open to claimed, by the agent or coordinator: pullboard claim <id>. Made 3 times.\nChecks, in order:\n the caller is the main checkout, or a worktree that joined a lane (NOT_JOINED)\n the item exists (NO_ITEM)\n the item is open or claimed (NOT_CLAIMABLE)')), 'each check in order, escaped');- assert.deepEqual(labels, [- 'claim 3',- 'claim 1',- 'release · lapse · escalate · refreeze (none yet)',- 'submit 2',- 'accept 1',- 'reject 1',- 'escalate · refreeze (none yet)',- 'withdraw 1',- ]);+ assert.ok(arrows.some((arrow) => arrow.title.includes('claim, open to claimed, by the agent or coordinator: pullboard claim <id>. Made 6 times.\nChecks, in order:\n the caller is the main checkout, or a worktree that joined a lane (NOT_JOINED)\n the item exists (NO_ITEM)\n the item is open or claimed (NOT_CLAIMABLE)')), 'each check in order, escaped');+ // Every arrow carries its own label: the moves made along it and how often, or its moves when none was.+ assert.deepEqual(Object.fromEntries(arrows.map((arrow) => [arrow.pair, arrow.label])), {+ 'open>claimed': 'claim 6',+ 'claimed>claimed': 'claim 1',+ 'claimed>open': 'release · lapse · escalate · refreeze (none yet)',+ 'claimed>submitted': 'submit 3',+ 'submitted>verified': 'accept 1',+ 'submitted>open': 'reject 1',+ 'open>open': 'escalate · refreeze (none yet)',+ 'open>withdrawn': 'withdraw 1',+ 'claimed>withdrawn': 'withdraw 2',+ 'submitted>withdrawn': 'withdraw 1',+ });// The clock's lapse is never logged: an item that reads open after its claim, and a claim logged// on an item the replay holds claimed, each mean the clock moved first.