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.

fix(spec): show stale exact-row approvals before apply [S1,B26]

Corey Olson236b3202725a
diff --git a/src/cli.js b/src/cli.js
index acfdd3b7..3cf2830c 100644
--- a/src/cli.js
+++ b/src/cli.js
@@ -79,8 +79,10 @@ import {
planRowApply,
prepareRowDecisions,
restoreRowApply,
+ rowDecisionView,
writeRowApply,
} from './row-decisions.js';
+import { rowDecisionContext } from './row-decision-state.js';
import {
digestOf,
gateReport,
@@ -175,6 +177,7 @@ import { Refused } from './refused.js';
import {
applyStep,
personAsk,
+ setupDecisionRows,
} from './setup-rows.js';
import { personNeeds } from './needs.js';
import { personNeedsState } from './needs-state.js';
@@ -1586,9 +1589,7 @@ function boardSetup(ctx, card, identity) {
const rows = loadSpec(ctx.info.root, ctx.config).rows;
const approved = rows.filter(row => row.status === 'approved');
const decisions = withBoard(ctx, (board) => store.rowDecisions(board));
- // Match the current row's decision projection, not a bare id: a changed draft needs a new person decision (#848).
- const open = rows.filter(row => row.status === 'draft' || row.status === 'pending')
- .map(row => decisionProjection(decisions, row, 'spec'));
+ const open = setupDecisionRows(ctx.info.root, ctx.config, decisions, rows);
const toApply = open.filter(row => row.decision);
const drafted = open.filter(row => !row.decision);
const recordedComplete = setupReceiptMatches(ctx, identity, 'complete');
@@ -1612,7 +1613,7 @@ function boardSetup(ctx, card, identity) {
/** Preserve all existing configuration when recording one setup answer. */
const configure = patch => `node -e ${quote(`const fs=require('node:fs');const p='pullboard.json';const c=JSON.parse(fs.readFileSync(p,'utf8'));${patch};fs.writeFileSync(p,JSON.stringify(c,null,2)+${JSON.stringify('\n')})`)}`;
const steps = [
- { number: 1, done: approved.length > 0 && ((!drafted.length && !toApply.length) || completed), question: 'Ask the person: what are we building, and who will use it? Draft a few requirements, then ask the person to approve them.',
+ { number: 1, done: approved.length > 0 && ((!drafted.length && !toApply.length) || (completed && !open.some(row => row.staleDecision))), question: 'Ask the person: what are we building, and who will use it? Draft a few requirements, then ask the person to approve them.',
command: 'pullboard spec draft "<text>"',
afterAnswer: 'Record each answer with pullboard spec draft "<text>"; the person approves the returned ids in Pullboard View or runs pullboard spec approve <ids> in their own terminal; then the coordinator runs pullboard spec apply.' },
{ number: 2, done: lanes.length > 0, question: `Ask the person: how should we divide the work? Suggested folders: ${folders.join(', ') || 'app/ (create it for the app)'}.`,
@@ -1640,7 +1641,7 @@ function boardSetup(ctx, card, identity) {
// A pending question takes an answer, a draft row an approval: each gets the command that decides it.
const { personCommand, verb, seatQuestion, seatNext } = personAsk(drafted);
return { step: 1, total: 5, ...current, steps, waitingOn: 'person-approval', rowIds, ...(toApply.length ? { approvedRowIds: toApply.map(row => row.id) } : {}),
- question: seat ? seatQuestion : `Waiting for the person to ${verb} ${names}.`, command,
+ question: (seat ? seatQuestion : `Waiting for the person to ${verb} ${names}.`) + drafted.filter(row => row.staleDecision).map(row => ` ${row.stage}`).join(''), command,
personCommand,
afterAnswer: (toApply.length ? `The person already approved ${toApply.map(row => row.id).join(', ')}; pullboard spec apply writes them. ` : '') + 'The person approves draft rows and answers questions in Pullboard View or their own terminal; then the coordinator runs pullboard spec apply.',
meanwhile: seat ? 'While waiting, review independent approved work or send questions to the coordinator with pullboard shout coordinator "<what is needed>" --decision.' : 'While waiting, the agent may review independent approved work or prepare questions for the person.',
@@ -4163,8 +4164,7 @@ async function specCommand(io, { first, second, rest, values }) {
const out = values.out ? resolve(ctx.io.cwd, values.out) : join(ctx.info.gitDir, 'pullboard', 'spec.html');
const html = renderSpecView({
title: spec.title,
- spec,
- practice,
+ ...withBoard(ctx, board => rowDecisionView(ctx.info.root, ctx.config, store.rowDecisions(board), spec, practice)),
signoffs,
generatedAt: new Date().toISOString().slice(0, 16).replace('T', ' '),
files: { spec: ctx.config.spec, practice: ctx.config.practice },
@@ -4181,7 +4181,7 @@ async function specCommand(io, { first, second, rest, values }) {
const parsed = doctrineId ? practice : spec;
const id = doctrineId ? second.slice('doctrine:'.length) : second;
const source = parsed.rows.find((entry) => entry.id === id);
- const row = source && withBoard(ctx, (board) => decisionProjection(store.rowDecisions(board), source, doctrineId ? 'doctrine' : 'spec'));
+ const row = source && withBoard(ctx, (board) => decisionProjection(store.rowDecisions(board), source, doctrineId ? 'doctrine' : 'spec', rowDecisionContext(ctx.info.root, ctx.config)));
if (!row) throw new Refused('NO_ROW', `no row ${second ?? ''} in ${ctx.config.spec}`);
const standing = standings(parsed.rows, signoffs).get(row.id) ?? { met: [], stale: [] };
io.result?.({ row, standing });
diff --git a/src/health.js b/src/health.js
index c55c1440..da2f09e6 100644
--- a/src/health.js
+++ b/src/health.js
@@ -20,8 +20,10 @@ import {
openBoardReadOnly,
PERSON,
roadmap,
+ rowDecisions,
unverifiedSubmissions,
} from './board.js';
+import { staleRowDecisions } from './row-decision-state.js';
import { localReleaseRank } from './release-queue.js';
import { trunkRef } from './trusted-policy.js';
@@ -79,6 +81,13 @@ export function healthReport({ db, root, config, now }) {
const at = now.getTime();
const age = (iso) => at - Date.parse(iso);
const board = { db, clock: { now: () => now } };
+ for (const stale of staleRowDecisions(rowDecisions(board), root, config)) {
+ report.stuck.push(finding('STALE_ROW_DECISION', null, {
+ subject: `${stale.kind}:${stale.id}`, key: `STALE_ROW_DECISION:${stale.kind}:${stale.id}`,
+ since: stale.at ?? asOf, now: at, title: 'person decision is stale', why: stale.why, next: stale.next,
+ owner: { role: 'person', who: PERSON }, detail: { changed: stale.changed },
+ }));
+ }
const items = db.prepare('SELECT * FROM item ORDER BY item_id').all();
const byId = new Map(items.map((item) => [item.item_id, item]));
const history = itemHistory(db);
diff --git a/src/needs-state.js b/src/needs-state.js
index d7d1366c..452d9b3e 100644
--- a/src/needs-state.js
+++ b/src/needs-state.js
@@ -25,7 +25,7 @@ export function personNeedsState(root, { board: providedBoard = null, includeRig
const decisions = store.rowDecisions(board);
const state = projectFit(pendingFit(info.commonDir), projectRowDecisions(decisions, projectState(root, { board })));
const config = loadConfig(root);
- const rows = projectRowDecisions(decisions, { spec: loadSpec(root, config).rows, practice: loadDoctrine(root, config).rows });
+ const rows = projectRowDecisions(decisions, { root, spec: loadSpec(root, config).rows, practice: loadDoctrine(root, config).rows });
const rigorDrafts = rigorDraftNeeds(rows);
const projected = { ...state, rigorDrafts, ...(includeRigorUndrafted
? { rigorUndrafted: undraftedRigor(store.events(board), rows, { person: store.PERSON }) } : {}) };
diff --git a/src/needs.js b/src/needs.js
index 4241e33a..29bfbec1 100644
--- a/src/needs.js
+++ b/src/needs.js
@@ -7,7 +7,7 @@ export function personNeeds(state) {
};
const rows = (state.spec ?? []).filter(row => !row.decision);
const rigorDrafts = state.rigorDrafts ?? [];
- const drafts = rows.filter(row => row.status === 'draft' && !rigorDrafts.some(draft => draft.target === `spec:${row.id}`)).length;
+ const drafts = rows.filter(row => (row.status === 'draft' || row.staleDecision) && !rigorDrafts.some(draft => draft.target === `spec:${row.id}`)).length;
return [
...(state.decisions ?? []).map(ask => ({ kind: 'decision', id: ask.shout_id,
ref: name(ask.shout_from), text: ask.shout_text, what: 'decision', at: ask.shout_at })),
@@ -17,6 +17,6 @@ export function personNeeds(state) {
ref: hold.hold_lane, text: hold.hold_reason, what: 'lane held by ' + name(hold.hold_by) })),
...rigorDrafts,
...(drafts ? [{ kind: 'draft', id: 'drafts', count: drafts, ref: String(drafts),
- text: 'draft spec rows to approve or drop', what: 'review in SPEC.md', target: 'tab:spec' }] : []),
+ text: 'draft spec rows to approve or drop' + rows.filter(row => row.staleDecision).map(row => `; ${row.stage}`).join(''), what: 'review in SPEC.md', target: 'tab:spec' }] : []),
];
}
diff --git a/src/row-decision-state.js b/src/row-decision-state.js
new file mode 100644
index 00000000..e33debb2
--- /dev/null
+++ b/src/row-decision-state.js
@@ -0,0 +1,51 @@
+/** Live exact-row identity shared by approval listings and health [S1,B26]. */
+import { existsSync } from 'node:fs';
+import { readFileSync } from 'node:fs';
+import { join } from 'node:path';
+import { doctrineFile } from './config.js';
+import { loadConfig } from './config.js';
+import { parseSpec } from './spec.js';
+
+/** Read each current file once per projection; raw source stays private to this lookup. */
+export function rowDecisionContext(root, config = loadConfig(root)) {
+ const files = new Map();
+ return (kind, id) => {
+ const file = kind === 'spec' ? config.spec : doctrineFile(root, config.practice);
+ if (!files.has(file)) {
+ const path = join(root, file);
+ const source = existsSync(path) ? readFileSync(path, 'utf8') : '';
+ files.set(file, { rows: parseSpec(source).rows, lines: source.split(/\r?\n/u) });
+ }
+ const { rows, lines } = files.get(file);
+ const matches = rows.filter(row => row.id === id);
+ return { file, count: matches.length, row: matches[0], source: matches.length === 1 ? lines[matches[0].line - 1] : undefined };
+ };
+}
+
+/** Use the same exact file/source-or-replacement boundary as planRowApply, without applying it. */
+export function staleRowDecision(record, context) {
+ const current = context(record.kind, record.id);
+ const aliases = new Set(['DOCTRINE.md', 'PRACTICE.md']);
+ let changed;
+ if (current.file !== record.file && !(record.kind === 'doctrine' && aliases.has(current.file) && aliases.has(record.file))) changed = ['file'];
+ else if (current.count !== 1) changed = [current.count ? 'duplicate id' : 'missing row'];
+ else if (current.source === record.source || current.source === record.replacement) return null;
+ else {
+ const before = parseSpec(`## Decision\n${record.source}\n`).rows[0];
+ changed = before ? Object.keys(before).filter(key => !['line', 'section'].includes(key)
+ && JSON.stringify(before[key]) !== JSON.stringify(current.row[key])) : [];
+ if (!changed.length) changed = ['format'];
+ }
+ const why = `STALE: ${record.id}'s ${changed.join(', ')} changed after the person's decision`;
+ const next = `ask the person to approve ${record.id}'s current row again`;
+ return { code: 'STALE_ROW_DECISION', changed, why, next };
+}
+
+/** All blocked pending decisions, including removed rows that have no listing to decorate. */
+export function staleRowDecisions(records, root, config) {
+ const context = rowDecisionContext(root, config);
+ return records.filter(record => !record.applied).flatMap(record => {
+ const stale = staleRowDecision(record, context);
+ return stale ? [{ ...stale, id: record.id, kind: record.kind, at: record.at ?? record.on }] : [];
+ });
+}
diff --git a/src/row-decisions.js b/src/row-decisions.js
index 6f0d7dd6..3096527e 100644
--- a/src/row-decisions.js
+++ b/src/row-decisions.js
@@ -25,6 +25,8 @@ import {
verifyRowDecision,
} from './signature.js';
import { Refused } from './refused.js';
+import { rowDecisionContext } from './row-decision-state.js';
+import { staleRowDecision } from './row-decision-state.js';
/** Resolve qualified doctrine ids while bare ids continue to name the spec. */
function decisionRows(root, config, ids) {
@@ -77,18 +79,19 @@ export function prepareRowDecisions(root, config, { ids, decision, reason = '',
*/
export function pendingAnswers(root, config, ids, records) {
const { rows } = loadSpec(root, config);
+ const context = rowDecisionContext(root, config);
return new Map(ids.filter((id) => !id.startsWith('doctrine:')).flatMap((id) => {
const matches = rows.filter((row) => row.id === id);
- const record = matches.length === 1 ? pendingRowDecision(records, matches[0], 'spec') : undefined;
+ const record = matches.length === 1 ? pendingRowDecision(records, matches[0], 'spec', context) : undefined;
const answer = record ? decisionAnswer(record) : null;
return answer === null ? [] : [[id, { text: record.text, answer }]];
}));
}
/** Compare a decision with the current row, excluding inherited standard rows from file edits. */
-export function pendingRowDecision(records, row, kind) {
+export function pendingRowDecision(records, row, kind, context) {
return records.find((record) => record.kind === kind && record.id === row.id && !record.applied
- && (row.text === record.text || row.text === record.source.match(/\]\s+([^|]*)(?:\||$)/u)?.[1]?.trim()));
+ && !staleRowDecision(record, context));
}
/**
@@ -112,14 +115,19 @@ function decisionStage(record) {
}
/** Add pending status to existing rows without replacing their current file-backed status. */
-export function decisionProjection(records, row, kind) {
- const decision = pendingRowDecision(records, row, kind);
+export function decisionProjection(records, input, kind, context) {
+ const { decision: previous, staleDecision: oldStale, stage: oldStage, ...plain } = input;
+ const row = previous || oldStale ? plain : input;
+ const decision = pendingRowDecision(records, row, kind, context);
if (decision) return {
...row,
decision,
stage: `${decisionStage(decision)}, pending apply`,
...(decision.decision === 'decline' ? { reason: decision.reason } : {}),
};
+ const pending = records.find(record => record.kind === kind && record.id === row.id && !record.applied);
+ const stale = pending && staleRowDecision(pending, context);
+ if (stale) return { ...row, staleDecision: stale, stage: `${stale.why}; ${stale.next}` };
const appliedDecline = records.find((record) => record.kind === kind && record.id === row.id && record.applied
&& record.decision === 'decline' && row.status === 'wont' && row.text === record.text);
return appliedDecline ? { ...row, reason: appliedDecline.reason } : row;
@@ -127,12 +135,21 @@ export function decisionProjection(records, row, kind) {
/** Decorate the shared API state so the cockpit receives the same pending decisions as spec show. */
export function projectRowDecisions(records, state) {
+ if (!records.length) return state;
+ const context = rowDecisionContext(state.root);
return { ...state,
- spec: state.spec.map((row) => decisionProjection(records, row, 'spec')),
- practice: state.practice.map((row) => row.origin === 'standard' ? row : decisionProjection(records, row, 'doctrine')),
+ spec: state.spec.map((row) => decisionProjection(records, row, 'spec', context)),
+ practice: state.practice.map((row) => row.origin === 'standard' ? row : decisionProjection(records, row, 'doctrine', context)),
};
}
+/** Preserve parsed page metadata while projecting both file-backed row lists. */
+export function rowDecisionView(root, config, records, spec, practice) {
+ const context = rowDecisionContext(root, config);
+ return { spec: { ...spec, rows: spec.rows.map(row => decisionProjection(records, row, 'spec', context)) },
+ practice: { ...practice, rows: practice.rows.map(row => row.origin === 'standard' ? row : decisionProjection(records, row, 'doctrine', context)) } };
+}
+
/**
* The ids of blueprint questions answered by a hand edit to SPEC.md: a row that was pending with
* its ". Choices: " list at the trunk tip and now differs in status or text, with no person row
diff --git a/src/setup-rows.js b/src/setup-rows.js
index eaf6a7e5..76ffbabb 100644
--- a/src/setup-rows.js
+++ b/src/setup-rows.js
@@ -3,6 +3,15 @@
* coordinator's spec apply, never for the person again, and each open row gets the command that
* decides it, approve for a draft and answer for a pending question.
*/
+import { decisionProjection } from './row-decisions.js';
+import { rowDecisionContext } from './row-decision-state.js';
+
+/** Include stale decisions even when the current file row was already marked approved. */
+export function setupDecisionRows(root, config, records, rows) {
+ const context = rowDecisionContext(root, config);
+ return rows.map(row => decisionProjection(records, row, 'spec', context))
+ .filter(row => row.status === 'draft' || row.status === 'pending' || row.staleDecision);
+}
/**
* The setup step once every open row has a person decision that spec apply has not written yet.
diff --git a/src/view.js b/src/view.js
index 0804397d..d39427e9 100644
--- a/src/view.js
+++ b/src/view.js
@@ -53,7 +53,7 @@ function rowHtml(row, by, withSignoff) {
const label = row.status === 'wont' ? "won't build" : row.status;
const search = esc(`${row.id} ${row.status} ${label} ${row.tier} ${row.text} ${row.gate}`.toLowerCase());
const signoff = withSignoff ? `<td>${signoffCell(row, by).html}</td>` : '';
- return `<tr data-text="${search}"><td class="id">${esc(row.id)}</td><td><span class="st st-${esc(row.status)}">${esc(label)}</span>${tier}</td><td>${esc(row.text)}</td><td class="gate">${esc(row.gate)}</td><td class="id">${serves}</td>${signoff}</tr>`;
+ return `<tr data-text="${search}"><td class="id">${esc(row.id)}</td><td><span class="st st-${esc(row.status)}">${esc(label)}</span>${tier}${row.stage ? `<div>${esc(row.stage)}</div>` : ''}</td><td>${esc(row.text)}</td><td class="gate">${esc(row.gate)}</td><td class="id">${serves}</td>${signoff}</tr>`;
}
/**
diff --git a/test/row-decisions.test.js b/test/row-decisions.test.js
index 0e67edea..c3c2b3f2 100644
--- a/test/row-decisions.test.js
+++ b/test/row-decisions.test.js
@@ -531,3 +531,95 @@ test('[B26,S19,V3] a view approval binds proposed wording without changing the s
box.git(box.root, 'commit', '-q', '-m', 'docs: apply the person-approved rewrite');
assert.ok(box.git(box.root, 'show', 'HEAD:SPEC.md').includes(text), 'the exact view-approved rewrite passes the real commit hook');
});
+
+test('a same-text gate change makes an approval stale everywhere [S1,B26]', async (t) => {
+ for (const [field, before, after] of [
+ ['gate', 'Approve this row. | gate: true', 'Approve this row. | gate: false'],
+ ['tier', 'G1 [draft, must]', 'G1 [draft, aim]'],
+ ['format', 'Approve this row. | gate:', 'Approve this row. | gate:'],
+ ]) {
+ const box = project();
+ const key = makeKey(join(box.dir, 'stale-signing-key'));
+ box.git(box.root, 'config', 'user.signingkey', key.privateKey);
+ const signer = command(box, box.root, 'spec', 'signers', 'add', '--key', key.publicKey, '--by', 'CO', '--json');
+ assert.equal(signer.status, 0, signer.stderr);
+ const approval = command(box, box.root, 'spec', 'approve', 'G1', '--by', 'CO', '--json');
+ assert.equal(approval.status, 0, approval.stderr);
+ assert.ok(JSON.parse(approval.stdout).decisions[0].signature);
+ const file = join(box.root, SPEC_FILE);
+ const original = readFileSync(file, 'utf8');
+ assert.ok(original.includes(before), field + ': change exactly the intended source');
+ const edited = original.replace(before, after);
+ writeFileSync(file, edited);
+ writeFileSync(join(box.web, SPEC_FILE), edited);
+ assert.equal(sourceRow(box, SPEC_FILE, 'G1').text, 'Approve this row.');
+ const shown = command(box, box.root, 'spec', 'show', 'G1', '--json');
+ assert.equal(shown.status, 0, shown.stderr);
+ const row = JSON.parse(shown.stdout).row;
+ assert.match(row.stage ?? '', /STALE/u, field + ': the changed signed row is stale, never approved pending apply');
+ assert.equal(row.decision, undefined);
+ assert.match(row.stage, new RegExp(field));
+ assert.match(row.stage, /person.*approve.*again/u);
+ const request = await startView(t, box);
+ const boardPath = await viewBoardPath(request, box.root);
+ const state = (await (await request(`${boardPath}/state`)).json()).state;
+ assert.equal(state.spec.find(entry => entry.id === 'G1').stage, row.stage, 'the live API uses the same exact source match');
+ assert.equal(state.spec.find(entry => entry.id === 'G1').decision, undefined);
+ assert.ok(state.needs.some(need => need.kind === 'draft'), 'the changed approval returns to the person');
+ const resume = command(box, box.web, 'resume', '--json');
+ assert.equal(resume.status, 0, resume.stderr);
+ const setup = JSON.parse(resume.stdout).setup;
+ assert.ok(setup.rowIds.includes('G1'));
+ assert.ok(!setup.approvedRowIds?.includes('G1'));
+ assert.match(setup.question, /STALE/u);
+ assert.match(setup.question, new RegExp(field));
+ assert.match(setup.question, /person.*approve.*again/u);
+ const health = command(box, box.root, 'health', '--json');
+ assert.equal(health.status, 1, health.stderr);
+ const stale = JSON.parse(health.stdout).stuck.find(entry => entry.cause === 'STALE_ROW_DECISION');
+ assert.ok(stale, field + ': health names the blocked approval');
+ assert.match(stale.why, new RegExp(field));
+ assert.match(stale.next, /person.*approve.*again/u);
+ const digest = command(box, box.root, 'digest');
+ assert.equal(digest.status, 0, digest.stderr);
+ assert.match(digest.stdout, /STALE/u);
+ assert.match(digest.stdout, new RegExp(field));
+ const page = command(box, box.root, 'spec', 'view', '--json');
+ assert.equal(page.status, 0, page.stderr);
+ assert.match(readFileSync(JSON.parse(page.stdout).path, 'utf8'), /STALE/u, 'the offline listing does not hide the stale approval');
+ const apply = command(box, box.root, 'spec', 'apply', '--json');
+ assert.equal(apply.status, 1, apply.stderr);
+ assert.equal(JSON.parse(apply.stdout).error.code, 'STALE_ROW_DECISION');
+ assert.equal(readFileSync(file, 'utf8'), edited, 'refusal writes no part of the signed source');
+ const renewed = command(box, box.root, 'spec', 'approve', 'G1', '--by', 'CO', '--json');
+ assert.equal(renewed.status, 0, renewed.stderr);
+ const renewedRecord = JSON.parse(renewed.stdout).decisions[0];
+ assert.ok(renewedRecord.signature, 'the renewed person approval is signed too');
+ const current = command(box, box.root, 'spec', 'show', 'G1', '--json');
+ assert.equal(JSON.parse(current.stdout).row.stage, 'approved, pending apply', 'a new person decision clears staleness');
+
+ const renewedState = (await (await request(`${boardPath}/state`)).json()).state;
+ const renewedRow = renewedState.spec.find(entry => entry.id === 'G1');
+ assert.equal(renewedRow.stage, 'approved, pending apply', 'the live API clears the stale projection');
+ assert.ok(renewedRow.decision, 'the live API retains the renewed decision');
+ const resumed = command(box, box.web, 'resume', '--json');
+ assert.equal(resumed.status, 0, resumed.stderr);
+ const resumedSetup = JSON.parse(resumed.stdout).setup;
+ assert.ok(resumedSetup.approvedRowIds?.includes('G1'), 'resume recognizes G1 as awaiting apply');
+ assert.ok(!resumedSetup.rowIds.includes('G1'), 'resume no longer presents G1 as a draft needing a fresh decision');
+ const recoveredHealth = command(box, box.root, 'health', '--json');
+ const recoveredHealthReport = JSON.parse(recoveredHealth.stdout);
+ assert.ok(!recoveredHealthReport.stuck.some(entry => entry.cause === 'STALE_ROW_DECISION'), 'health clears the stale finding after renewed approval');
+ const recoveredDigest = command(box, box.root, 'digest');
+ assert.equal(recoveredDigest.status, 0, recoveredDigest.stderr);
+ const currentStuck = recoveredDigest.stdout.split('## Stuck and who moves it')[1].split('## Open work')[0];
+ assert.doesNotMatch(currentStuck, /STALE/u, 'digest clears the current stale warning while retaining historical shouts');
+ const recoveredPage = command(box, box.root, 'spec', 'view', '--json');
+ assert.equal(recoveredPage.status, 0, recoveredPage.stderr);
+ assert.doesNotMatch(readFileSync(JSON.parse(recoveredPage.stdout).path, 'utf8'), /STALE/u, 'offline listing clears the stale warning after renewed approval');
+
+ const applied = command(box, box.root, 'spec', 'apply', '--json');
+ assert.equal(applied.status, 0, applied.stderr);
+ assert.equal(sourceRow(box, SPEC_FILE, 'G1').status, 'approved');
+ }
+});