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(land): refresh badges inside the final item merge [B3,R3]
Corey Olson3b462783adce
diff --git a/src/land.js b/src/land.jsindex 03ea873c..02597cd2 100644--- a/src/land.js+++ b/src/land.js@@ -244,7 +244,17 @@ async function mergeGroup(state, items) {const changed = writeBadges(batch.root, badgeCounts(state.board));if (changed.length) {git(batch.root, ['add', '--', ...changed]);- git(batch.root, ['commit', '-m', 'chore: refresh board badge counts']);+ const tip = headCommit(batch.root);+ const parents = git(batch.root, ['rev-list', '--parents', '-n', '1', tip]).split(' ');+ if (tip !== batch.base && parents.length === 3 && merged.some(entry => entry.merge === tip)) {+ // Badges belong to the final item merge, preserving its parents/trailer and first-containing receipt.+ git(batch.root, ['commit', '--amend', '--no-edit']);+ const refreshed = headCommit(batch.root);+ for (const entry of merged) if (entry.merge === tip) entry.merge = refreshed;+ } else {+ // An already-contained item may create no merge: never amend the existing trunk's history.+ git(batch.root, ['commit', '-m', 'chore: refresh board badge counts']);+ }}}let doctrineCounts = [];diff --git a/test/badge-fixture.js b/test/badge-fixture.jsindex 47cd9db2..eea97997 100644--- a/test/badge-fixture.js+++ b/test/badge-fixture.js@@ -28,10 +28,17 @@ export function assertBadgeLanding(e2e) {const accepted = box.run(box.repo, 'verify', String(id), 'accept', '--as', 'coordinator', '--note', 'The private native probe passed at the submitted commit.');assert.equal(accepted.code, 0, `${accepted.err}\n${accepted.out}`);} finally { box.git(box.repo, 'switch', '-q', 'main'); }+ const beforeLanding = box.git(box.repo, 'rev-parse', 'main');const result = box.run(box.repo, 'land', '--json');assert.equal(result.code, 0, `${result.err}\n${result.out}`);const landed = JSON.parse(result.out);assert.deepEqual(landed.landed, [id]);+ const recorded = JSON.parse(box.run(box.repo, 'show', String(id), '--json').out);+ assert.equal(recorded.item_merged_commit, landed.batch.tip, 'badge refresh remains inside the first-containing item merge');+ assert.deepEqual(box.git(box.repo, 'rev-list', '--parents', '-n', '1', landed.batch.tip).split(' '),+ [landed.batch.tip, beforeLanding, commit], 'the badge refresh preserves both actual merge parents');+ assert.equal(box.git(box.repo, 'log', '-1', '--format=%b', landed.batch.tip).trim(), `Pullboard-Item: #${id}`);+const documents = ['items', 'checked'].map(name => JSON.parse(box.git(box.repo, 'show', `${landed.batch.tip}:docs/badges/${name}.json`)));assert.equal(documents[0].message, '1 items');assert.equal(documents[1].message, '100%');diff --git a/test/land.test.js b/test/land.test.jsindex 4fd74516..ea3f28b0 100644--- a/test/land.test.js+++ b/test/land.test.js@@ -547,7 +547,8 @@ test('land bisects a real red, blocks stale proof and refuses an unverified stacassert.equal(result.culprits[0].tests[0].file, FILES[2]);assert.match(result.culprits[0].tests[0].name, /keeps the landed behavior/u);assert.ok(json(box, box.repo, 'show', String(entries[2].item)).thread.some((entry) => entry.type === 'fact' && entry.text.includes(FILES[2])));- assert.deepEqual(calls(box).slice(beforeCalls), [[], ['--alone', FILES[2]], [], []], 'one red batch, one isolated diagnostic and two bisection gates; cached green tree is not retested');+ assert.deepEqual(calls(box).slice(beforeCalls), [[], ['--alone', FILES[2]], [], [], []],+ 'one red batch, one diagnostic, two bisection gates, then the final tree: returning its culprit changes badge counts, so that different tree needs its own gate');assert.equal(json(box, box.repo, 'show', String(entries[0].item)).item_merged_commit, result.batch.tip);for (const entry of entries.slice(1)) assert.equal(json(box, box.repo, 'show', String(entry.item)).item_merged_commit, null);assert.equal(box.git(box.remote, 'rev-parse', 'main'), result.batch.tip);