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
feat(view): sentinel drafts wait in Needs-you with proof [A6,D1,N26]
Corey Olson65d26c1ff882
diff --git a/src/cockpit.js b/src/cockpit.jsindex 90d7eb93..6d6544c6 100644--- a/src/cockpit.js+++ b/src/cockpit.js@@ -1095,22 +1095,24 @@ function render() {// on the board with who holds it; it is the agents' to move.const personalNeeds = personNeeds(p);// Adapt display targets and the existing hold age without reimplementing which calls belong here.- const needs = personalNeeds.filter((row) => !['draft', 'rigor-draft'].includes(row.kind)).map((row) => row.kind === 'decision'+ const needs = personalNeeds.filter((row) => !['draft', 'rigor-draft', 'sentinel-draft'].includes(row.kind)).map((row) => row.kind === 'decision'? ['decide:' + row.id, row.ref, row.text, 'decide', row.at]: row.kind === 'pending' ? ['spec:' + row.id, row.ref, row.text, 'answer ' + row.ref] // the person's words; agents get the command (#875): ['tab:shouts', row.ref, row.text, row.what, p.holds.find((hold) => hold.hold_lane === row.id)?.hold_at]);const drafts = personalNeeds.find((row) => row.kind === 'draft')?.count ?? 0;const rigorDrafts = personalNeeds.filter((row) => row.kind === 'rigor-draft');+ const sentinelDrafts = personalNeeds.filter((row) => row.kind === 'sentinel-draft');// Each of the person's calls is a row at the head of Active, shaped like an item: what it is first, then NEEDS YOU and// its kind where an item has its lane, and what to do at the right. Every call is a row; the draft rows are one row// with their count. Read-only, a row is its words, opening nothing.- $('needs').hidden = (!needs.length && !drafts && !rigorDrafts.length) || view.state !== 'active' || Boolean(view.lane);+ $('needs').hidden = (!needs.length && !drafts && !rigorDrafts.length && !sentinelDrafts.length) || view.state !== 'active' || Boolean(view.lane);const needRow = ([target, ref, text, what, at], kind, action) => '<li class="row ask"' + (readOnly ? '' : ' data-go="' + esc(target) + '"') + '><span class="dot ask"></span><div><div class="t">' + (ref ? '<span>' + esc(ref) + '</span>' : '') + rich(text, titles, !readOnly) + '</div>'+ (at ? '<span class="row-age">' + age(at) + '</span>' : '') + '<div class="meta"><span class="why"><b>NEEDS YOU</b> ' + esc(kind) + '</span></div></div><span class="chip warn">' + esc(action) + '</span></li>';const needKind = (entry) => entry[3] === 'decide' ? needRow([entry[0], '', entry[2], entry[3], entry[4]], 'a decision, asked by ' + entry[1], 'decide'): entry[0].startsWith('spec:') ? needRow(entry, 'an open question in SPEC.md', 'answer') : needRow(entry, entry[3], 'release');$('needs').innerHTML = needs.map(needKind).join('')+ rigorDrafts.map(row => needRow([row.target, row.ref, row.text], 'a proved Rigor draft', 'Approve or Decline')).join('')+ + sentinelDrafts.map(row => sentinelDraftRow(row)).join('')+ (drafts ? needRow(['tab:spec', String(drafts), 'draft spec rows to approve or drop'], 'Spec rows waiting on you', 'review') : '');const lanes = p.lanes;diff --git a/src/serve.js b/src/serve.jsindex 9bd64836..7562e8c7 100644--- a/src/serve.js+++ b/src/serve.js@@ -62,6 +62,8 @@ import { refusalDocument } from './json.js';import { relayLinkAvailability } from './relay.js';import { personNeeds } from './needs.js';import { rigorDraftNeeds } from './rigor-notices.js';+import { sentinelDraftNeeds } from './sentinels.js';+import { sentinels } from './sentinels.js';import { projectRowDecisions } from './row-decisions.js';import { loadSpec } from './spec.js';@@ -370,7 +372,7 @@ export function projectState(root, { seen = null, board: providedBoard = null, i});// Pending person decisions govern the calls on the API, sealed relay and exported page alike.const rigorRows = projectRowDecisions(store.rowDecisions(board), { root: info.root, spec: loadSpec(info.root, config).rows, practice: doctrine.rows });- const projected = { ...state, rigorDrafts: rigorDraftNeeds(rigorRows) };+ const projected = { ...state, rigorDrafts: rigorDraftNeeds(rigorRows), sentinelDrafts: sentinelDraftNeeds(sentinels(board)) };return { ...projected, needs: personNeeds(projected) };}, providedBoard);}diff --git a/src/view/page-script-4.js b/src/view/page-script-4.jsindex b4e254a3..c03712e2 100644--- a/src/view/page-script-4.js+++ b/src/view/page-script-4.js@@ -451,6 +451,20 @@ function moveMessage(move, result) {return move.args.off ? 'released the ' + move.args.lane + ' lane' : 'holding the ' + move.args.lane + ' lane: ' + move.args.reason;}+/**+ * One sentinel draft in Needs-you: a watch the person has not approved, with the proof Rigor drafted it from.+ * It says draft and waiting, never watching, so an unapproved check cannot pass for an approved one.+ */+function sentinelDraftRow(row) {+ const side = (label, proof) => label + ' commit ' + proof.commit.slice(0, 12) + ' exit ' + proof.exit;+ const evidence = row.evidence;+ const proof = evidence && evidence.proof ? 'Proof: ' + evidence.proof.check + ', ' + side('red', evidence.proof.red) + ', ' + side('green', evidence.proof.green) + '.' : '';+ const repeats = evidence ? 'Drafted from ' + evidence.occurrences + (evidence.occurrences === 1 ? ' repeat of ' : ' repeats of ') + evidence.key + (evidence.items.length ? ' on ' + evidence.items.map((item) => '#' + item.id).join(', ') : '') + '.' : 'Proposed by an agent with no repeat cited.';+ return '<li class="row ask" data-sentinel-draft="' + esc(row.ref) + '"><span class="dot ask"></span><div><div class="t"><span>' + esc(row.ref) + '</span>' + esc(row.text) + '</div>'+ + '<div class="muted sentinel-proof">' + esc(repeats + (proof ? ' ' + proof : '')) + '</div>'+ + '<div class="meta"><span class="why"><b>NEEDS YOU</b> a sentinel draft awaiting your approval, not watching yet</span></div></div><span class="chip warn">Approve or Decline</span></li>';+}+/** One blueprint fit proposal: its decision, its new text or reason, and where it came from. */function fitRow(f) {return '<div class="fit-row" data-fit="' + esc(f.target) + '"><div class="meta"><b>' + esc(f.target) + '</b><span class="chip">' + esc(f.decision) + '</span><span class="chip">unverified draft, recorded as ' + esc(f.recordedAs) + '</span></div>' + (f.text ? '<div>' + esc(f.text) + '</div>' : '') + (f.reason ? '<div>Reason: ' + esc(f.reason) + '</div>' : '') + '<div class="muted">Blueprint source: ' + esc(f.blueprint.name + ' v' + f.blueprint.version + ' ' + (f.kind === 'item' ? 'starter' : f.kind) + ' ' + f.key + ': ' + f.source) + '</div></div>';diff --git a/test/cockpit/rigor-view.test.js b/test/cockpit/rigor-view.test.jsnew file mode 100644index 00000000..92b9486b--- /dev/null+++ b/test/cockpit/rigor-view.test.js@@ -0,0 +1,61 @@+/** The view shows sentinel drafts for the person to approve, with their proof [A6,D1,N26]. */+import assert from 'node:assert/strict';+import { test } from 'node:test';+import { SPEC, machine, project, startView, openPage, boardOf } from './fixture.js';++/**+ * A sentinel-draft call as sentinelDraftNeeds shapes it, citing one repeated cause and the commits that prove its check.+ *+ * @param {object} fields - The watch name, its check and whether it cites evidence.+ * @returns {object} One call in the state's shape.+ */+function draft({ name, check, cited = true }) {+ return {+ kind: 'sentinel-draft', id: `sentinel:${name}`, ref: name,+ text: `Sentinel draft: ${name} runs ${check} hourly, reporting to coordinator`,+ what: `pullboard sentinel approve ${name}, or decline it with --reason`, target: `sentinel:${name}`,+ ...(cited ? { cause: 'row:G1', evidence: { key: 'row:G1', items: [{ id: 4, commits: [] }, { id: 7, commits: [] }], occurrences: 2,+ proof: { check, red: { commit: 'aaaaaaaaaaaa1111', exit: 1 }, green: { commit: 'bbbbbbbbbbbb2222', exit: 0 } } } } : {}),+ };+}++test('the view state carries a pending sentinel draft [A6,D1,N26]', async () => {+ const box = machine();+ const p = project(box, 'sentinel board', SPEC);+ box.run(p.repo, 'sentinel', 'propose', 'staging-site', '--check', 'true', '--every', 'hourly', '--owner', 'web');+ const view = await startView(box);+ try {+ const state = await boardOf(view, p.repo);+ assert.deepEqual(state.sentinelDrafts.map((call) => call.ref), ['staging-site'], 'the state carries the pending watch as one call');+ assert.equal(state.sentinelDrafts[0].kind, 'sentinel-draft');+ assert.ok(state.needs.some((call) => call.kind === 'sentinel-draft'), 'and Needs-you counts it');+ } finally {+ await view.stop();+ }+});++test('the view shows one sentinel draft with its proof, never as an approved sentinel [A6,D1,N26]', async () => {+ const box = machine();+ project(box, 'draft board', SPEC);+ const view = await startView(box);+ try {+ const page = await openPage(view);+ await page.run(`data.project.sentinelDrafts = ${JSON.stringify([draft({ name: 'rigor-row-g1', check: 'test -f up.txt' })])}; render();`);+ const html = page.show('needs');+ const text = html.replace(/<[^>]+>/g, ' ').replace(/\s+/g, ' ');+ assert.equal((html.match(/data-sentinel-draft=/g) || []).length, 1, 'one draft is one row');+ assert.match(text, /rigor-row-g1 Sentinel draft: rigor-row-g1 runs test -f up\.txt hourly, reporting to coordinator/, 'the row names the watch and its check');+ assert.match(text, /a sentinel draft awaiting your approval, not watching yet/, 'it is labelled a draft awaiting approval');+ assert.match(text, /Drafted from 2 repeats of row:G1 on #4, #7\./, 'it cites the repeat');+ assert.match(text, /Proof: test -f up\.txt, red commit aaaaaaaaaaaa exit 1, green commit bbbbbbbbbbbb exit 0\./, 'it shows the red and green proof');+ assert.doesNotMatch(text, /release|approved sentinel|is watching/i, 'it is neither a lane hold nor an approved sentinel');+ await page.run(`data.project.sentinelDrafts = ${JSON.stringify([draft({ name: 'x<b>y', check: 'true', cited: false })])}; render();`);+ const bare = page.show('needs');+ assert.match(bare, /Proposed by an agent with no repeat cited\./, 'a draft with no evidence says so');+ assert.ok(!bare.includes('<b>y'), 'the name is escaped');+ await page.run('data.project.sentinelDrafts = []; render();');+ assert.equal(page.show('needs').includes('data-sentinel-draft'), false, 'an approved or declined draft leaves Needs-you');+ } finally {+ await view.stop();+ }+});