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(cli): keep changed drafts awaiting a current decision [S1,I1,P6]
Corey Olson802f19a03a85
diff --git a/src/cli.js b/src/cli.jsindex bc362f3d..0f953d40 100644--- a/src/cli.js+++ b/src/cli.js@@ -1582,12 +1582,12 @@ function recordSetupState(ctx, identity, state) {function boardSetup(ctx, card, identity) {const rows = loadSpec(ctx.info.root, ctx.config).rows;const approved = rows.filter(row => row.status === 'approved');- const open = rows.filter(row => row.status === 'draft' || row.status === 'pending');- // A row the person has already decided waits for the coordinator's spec apply, not for the person (#848):- // telling her to approve it again is the loop a newcomer's agents fell into.- const decided = new Set(withBoard(ctx, (board) => store.rowDecisions(board)).filter(record => record.kind === 'spec' && !record.applied).map(record => record.id));- const toApply = open.filter(row => decided.has(row.id));- const drafted = open.filter(row => !decided.has(row.id));+ 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 toApply = open.filter(row => row.decision);+ const drafted = open.filter(row => !row.decision);const recordedComplete = setupReceiptMatches(ctx, identity, 'complete');const started = setupReceiptMatches(ctx, identity, 'started');const lanes = laneNames(ctx.config).filter(lane => !['review', COORDINATOR].includes(lane));diff --git a/test/spec.test.js b/test/spec.test.jsindex 7a8298d4..8d51a6ac 100644--- a/test/spec.test.js+++ b/test/spec.test.js@@ -991,3 +991,28 @@ test('a joined seat requests answers for pending questions [S1,I1,P6]', t => {'the draft still gets approval while the question gets its answer');}});+++test('a changed approved draft needs a new decision before apply [S1,I1,P6]', t => {+ const box = specBox(t, { specSource: '# Spec\n\n## A · Setup\n- A1 [draft, must] Every page works at phone width. | gate: review\n' });+ assert.equal(box.run('approve', 'A1').status, 0);+ const path = join(box.root, box.specName);+ writeFileSync(path, readFileSync(path, 'utf8').replace('phone width', 'desktop width'));+ const staleApply = box.run('apply');+ assert.equal(staleApply.status, 1, staleApply.stdout + staleApply.stderr);+ assert.match(staleApply.stderr, /STALE_ROW_DECISION/u);+ const read = runIn(box, box.root, ['resume', '--json']);+ assert.equal(read.status, 0, read.stderr + read.stdout);+ const card = JSON.parse(read.stdout);+ assert.equal(card.setup.waitingOn, 'person-approval', 'the old decision does not approve the changed text');+ assert.deepEqual(card.setup.rowIds, ['A1']);+ assert.equal(card.setup.personCommand, 'pullboard spec approve A1');+ assert.doesNotMatch(card.next, /spec apply/u, 'applying the stale receipt would loop');+ assert.equal(box.run('approve', 'A1').status, 0, 'the person can approve the current text');+ const decided = JSON.parse(runIn(box, box.root, ['resume', '--json']).stdout);+ assert.equal(decided.setup.waitingOn, 'coordinator-apply');+ assert.equal(box.run('apply').status, 0);+ runFixtureGit(['commit', '-q', '-m', 'docs(spec): apply current row decision', '--', box.specName], { cwd: box.root, env: box.env, encoding: 'utf8' });+ const applied = JSON.parse(runIn(box, box.root, ['resume', '--json']).stdout);+ assert.doesNotMatch(applied.next, /spec apply|approve A1/u);+});