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): keep lifecycle labels clear of routes [N26,B3]
Corey Olsonab20c382e805
diff --git a/src/cockpit.js b/src/cockpit.jsindex 33416b34..38c46301 100644--- a/src/cockpit.js+++ b/src/cockpit.js@@ -662,6 +662,15 @@ function flowSvg(p) {up.said = told([up.pair]);up.lines = wrap(up.said.words, Math.abs(up.start - up.end) - 20, 12);}+ // Higher routes cross this level vertically; put its words in the widest gap between them.+ for (const up of ups) {+ const left = Math.min(up.start, up.end), right = Math.max(up.start, up.end);+ const cuts = [left, ...ups.filter((other) => other.span > up.span).flatMap((other) => [other.start, other.end]).filter((x) => x > left && x < right), right].sort((a, b) => a - b);+ const rooms = cuts.slice(1).map((end, index) => ({ left: cuts[index], right: end })).sort((a, b) => (b.right - b.left) - (a.right - a.left));+ const room = rooms[0];+ up.labelX = (room.left + room.right) / 2;+ up.lines = wrap(up.said.words, room.right - room.left - 20, 12);+ }// Each level stands clear of the words of the level below it.const rise = [];for (const level of spans.keys()) {@@ -687,12 +696,15 @@ function flowSvg(p) {// Straight along the row.for (const pair of pairs.filter((pair) => col(pair.from) >= 0 && col(pair.to) === col(pair.from) + 1)) {const a = pos.get(pair.from), b = pos.get(pair.to), said = told([pair]);- routes.push(group([pair], { d: path([[a.x + BW / 2, Y], [b.x - BW / 2 - 1, Y]]) }, text((a.x + b.x) / 2, Y - 8, said.words.join(' · '), tone(said))));+ const words = said.words.join(' · ');+ // A long label sits above the boxes when the gap cannot hold it with clearance.+ const labelY = wide(words, 12) + 8 > b.x - a.x - BW ? top - 8 : Y - 8;+ routes.push(group([pair], { d: path([[a.x + BW / 2, Y], [b.x - BW / 2 - 1, Y]]) }, text((a.x + b.x) / 2, labelY, words, tone(said))));}// Square, above the row.for (const up of ups) {const isBack = col(up.pair.to) < col(up.pair.from), y = top - rise[up.level];- routes.push(group([up.pair], { back: isBack, d: path([[up.start, top], [up.start, y], [up.end, y], [up.end, top - 1]]) }, lines((up.start + up.end) / 2, y - 7, up.lines, tone(up.said, isBack ? ' back' : ''))));+ routes.push(group([up.pair], { back: isBack, d: path([[up.start, top], [up.start, y], [up.end, y], [up.end, top - 1]]) }, lines(up.labelX, y - 7, up.lines, tone(up.said, isBack ? ' back' : ''))));}// Down from the row, joining into one route per state below, labelled once on the way in.for (const s of below) {diff --git a/test/cockpit/activity.test.js b/test/cockpit/activity.test.jsindex dfc7df3b..52a5ee7f 100644--- a/test/cockpit/activity.test.js+++ b/test/cockpit/activity.test.js@@ -8,6 +8,8 @@ import { test } from 'node:test';import { MACHINE } from '../../src/machine.js';import { machine, project, build, sendBack, fetchLive, startView, styleOf, element, storage, openPage, timelineRows, agentEntries, drawing, textBoxes, meet, accept, itemRow, chromeExecutable, openSnapshotChrome, closeSnapshotChrome } from './fixture.js';+const verifiedIsFinal = Boolean(MACHINE.states.find((state) => state.id === 'verified').final);+/** Verify a verified stay ends at its next state move, while a quiet merge remains untimed. */test('the timeline times a verified item that goes back to open [N26, M1]', async () => {@@ -133,7 +135,7 @@ test("the history is a timeline of the item's states [N26]", async () => {['tl-verified', 'accept coordinator (unknown)'],['tl-verified tl-quiet', 'merged coordinator (unknown)'],], 'a dot per event in the colour of the state it led to; a merge moves nothing');- assert.deepEqual(done.map((row) => row.stay.replace(/ for .*/, ' for')), ['open for', 'claimed for', 'submitted for', 'sent back for', 'claimed for', 'submitted for', '', ''], 'each stay until the next move; a final state has none');+ assert.deepEqual(done.map((row) => row.stay.replace(/ for .*/, ' for')), ['open for', 'claimed for', 'submitted for', 'sent back for', 'claimed for', 'submitted for', verifiedIsFinal ? '' : 'verified for', ''], 'each stay until the next move; a final state has none and a quiet merge stays untimed');assert.ok(done.slice(0, 6).every((row) => / for (under a minute|\d+m)$/.test(row.stay)), done.map((row) => row.stay).join(', '));assert.ok(done.every((row) => /^\d\d:\d\d$/.test(row.time)), 'every event keeps its time');@@ -230,9 +232,10 @@ test('the activity tab draws the lifecycle from the declaration, as the README d'claimed>submitted': 'submit 3','submitted>verified': 'accept 1','submitted>open': 'reject 1',- 'open>withdrawn': 'withdraw 4',- 'claimed>withdrawn': null,- 'submitted>withdrawn': null,+ 'open>withdrawn': verifiedIsFinal ? 'withdraw 4' : 'withdraw 1',+ 'claimed>withdrawn': verifiedIsFinal ? null : 'withdraw 2',+ 'submitted>withdrawn': verifiedIsFinal ? null : 'withdraw 1',+ ...(!verifiedIsFinal ? { 'verified>open': 'reopen (none yet)' } : {}),});// Every route is square, and the ones back to an earlier state are dashed, each at its own height.@@ -248,6 +251,14 @@ test('the activity tab draws the lifecycle from the declaration, as the README dconst texts = textBoxes(svg);const rects = [...svg.matchAll(/<rect class="box" x="([\d.]+)" y="([\d.]+)" width="([\d.]+)" height="([\d.]+)"/g)].map(([, x, y, w, h]) => ({ left: Number(x), top: Number(y), right: Number(x) + Number(w), bottom: Number(y) + Number(h) }));const segments = routes.flatMap((route) => route.points.slice(1).map(([x, y], n) => ({ left: Math.min(x, route.points[n][0]), right: Math.max(x, route.points[n][0]) + 0.01, top: Math.min(y, route.points[n][1]), bottom: Math.max(y, route.points[n][1]) + 0.01 })));+ if (!verifiedIsFinal) {+ const verifiedReturn = routes.find((route) => route.pair === 'verified>open');+ assert.ok(verifiedReturn, 'the non-final verified state has a route back to open');+ assert.equal(verifiedReturn.label, 'reopen (none yet)', 'the verified return route carries its label');+ assert.equal(verifiedReturn.back, false, 'the lower-lane return is not an above-row back route');+ assert.equal(verifiedReturn.points[1][1], verifiedReturn.points[2][1], 'the verified return runs through a horizontal lower lane');+ assert.ok(verifiedReturn.points[1][1] > Math.max(...rects.map((rect) => rect.bottom)), 'the lower lane clears every state box');+ }texts.forEach((one, n) => {for (const other of texts.slice(n + 1)) assert.ok(!meet(one, other, 2), `"${one.words}" and "${other.words}" overlap`);const home = rects.filter((rect) => meet(one, rect, one.inside ? 0 : 2));