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(doctrine): read history at pinned revision [N26]
Corey Olson9a4a43d33d31
diff --git a/src/doctrine.js b/src/doctrine.jsindex 50292141..4e093a66 100644--- a/src/doctrine.js+++ b/src/doctrine.js@@ -63,11 +63,11 @@ export function loadDoctrine(root, config = {}) {};}-/** Retain committed row ids across the conventional filename change, even before its rename commit. */-export function doctrineHistory(root, name) {- const history = committedIds(root, name);+/** Retain committed row ids across the conventional filename change at the requested revisions. */+export function doctrineHistory(root, name, revs = ['HEAD']) {+ const history = committedIds(root, name, revs);if (![DOCTRINE_FILE, LEGACY_DOCTRINE_FILE].includes(name)) return history;- const other = committedIds(root, name === DOCTRINE_FILE ? LEGACY_DOCTRINE_FILE : DOCTRINE_FILE);+ const other = committedIds(root, name === DOCTRINE_FILE ? LEGACY_DOCTRINE_FILE : DOCTRINE_FILE, revs);for (const [id, commit] of other.ids) if (!history.ids.has(id)) history.ids.set(id, commit);return { ...history, since: history.since ?? other.since };}diff --git a/test/doctrine-name.test.js b/test/doctrine-name.test.jsindex b37b8fee..cc8c6bf1 100644--- a/test/doctrine-name.test.js+++ b/test/doctrine-name.test.js@@ -7,6 +7,7 @@ import { join, resolve } from 'node:path';import { after, test } from 'node:test';import { projectState } from '../src/serve.js';import { checkAtCommit } from '../src/trusted-policy.js';+import { doctrineHistory } from '../src/doctrine.js';const BIN = resolve(import.meta.dirname, '../bin/pullboard.js');const DOCTRINE = 'DOCTRINE.md';@@ -260,6 +261,36 @@ test('[D4,A5] canonical collisions stay errors without legacy rename history', fassert.match(check.stdout, /DOCTRINE\.md:4 G1 error: duplicate id; also appears at SPEC\.md:4/u);});+/** Keep both conventional doctrine paths readable at an older pinned revision. */+test('doctrine history reads at a pinned revision [N26]', function doctrineHistoryAtPinnedRevision() {+ const box = sandbox();+ const root = join(box.dir, 'pinned-history');+ mkdirSync(root);+ box.git(root, 'init', '-q', '-b', 'main');+ const first = '# Doctrine\n\n## L · Local\n- L1 [fact] First legacy rule.\n';+ writeFileSync(join(root, PRACTICE), first);+ box.git(root, 'add', PRACTICE);+ box.git(root, 'commit', '-q', '-m', 'docs: add first legacy rule');+ const pinned = box.git(root, 'rev-parse', 'HEAD');++ writeFileSync(join(root, PRACTICE), `${first}- L2 [fact] Second legacy rule.\n`);+ box.git(root, 'add', PRACTICE);+ box.git(root, 'commit', '-q', '-m', 'docs: add second legacy rule');+ const legacyPinned = doctrineHistory(root, PRACTICE, [pinned]);+ assert.deepEqual([...legacyPinned.ids.keys()].sort(), ['L1'], 'the legacy filename honors the requested revision');+ assert.deepEqual([...doctrineHistory(root, PRACTICE).ids.keys()].sort(), ['L1', 'L2'], 'the default still reads current HEAD');++ box.git(root, 'mv', PRACTICE, DOCTRINE);+ box.git(root, 'commit', '-q', '-m', 'docs: rename practice to doctrine');+ writeFileSync(join(root, DOCTRINE), `${readFileSync(join(root, DOCTRINE), 'utf8')}- L3 [fact] Third doctrine rule.\n`);+ box.git(root, 'add', DOCTRINE);+ box.git(root, 'commit', '-q', '-m', 'docs: add third doctrine rule');++ const currentPinned = doctrineHistory(root, DOCTRINE, [pinned]);+ assert.deepEqual([...currentPinned.ids.keys()].sort(), ['L1'], 'the current filename recovers the pinned legacy history without later rows');+ assert.deepEqual([...doctrineHistory(root, DOCTRINE).ids.keys()].sort(), ['L1', 'L2', 'L3'], 'the current filename default includes history through the rename');+});+test('[D4,A5] a staged rename keeps known duplicates before its rename commit', function stagedRenameKeepsKnownDuplicates() {const box = sandbox();