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): render shared headings once [D1,D3]
Corey Olson40e3998fde8c
diff --git a/src/doctrine.js b/src/doctrine.jsindex 9d76bf93..c2d8ec48 100644--- a/src/doctrine.js+++ b/src/doctrine.js@@ -32,6 +32,14 @@ export function loadDoctrine(root, config = {}) {const standard = standardDoctrine();const inherited = new Set(standard.rows.map((row) => row.id));const overrides = new Set(repo.rows.filter((row) => inherited.has(row.id)).map((row) => row.id));+ // Readers group rows by heading name, so one shared heading must not render the rows twice.+ const sectionNames = new Set();+ const sections = [...standard.sections, ...repo.sections.map((section) => ({ ...section, origin: 'repo' }))]+ .filter((section) => {+ if (sectionNames.has(section.name)) return false;+ sectionNames.add(section.name);+ return true;+ });const problems = [...standard.problems, ...repo.problems];for (const row of repo.rows) {if (/^PB\d/.test(row.id) && !inherited.has(row.id)) {@@ -45,7 +53,7 @@ export function loadDoctrine(root, config = {}) {title: repo.title || 'Doctrine', intro: repo.intro, name, file: repo.file,exists: true, repoExists: repo.exists, version: STANDARD_VERSION, repo,problems,- sections: [...standard.sections, ...repo.sections.map((section) => ({ ...section, origin: 'repo' }))],+ sections,rows: [...standard.rows.filter((row) => !overrides.has(row.id)),...repo.rows.map((row) => ({ ...row, origin: 'repo', version: null, reason: declineReason(row), file: name })),diff --git a/test/doctrine.test.js b/test/doctrine.test.jsindex d41368cb..e6db7558 100644--- a/test/doctrine.test.js+++ b/test/doctrine.test.js@@ -7,6 +7,7 @@ import { test } from 'node:test';import { packText } from '../src/run.js';import { doctrineText, loadDoctrine, standardDoctrine, STANDARD_VERSION } from '../src/doctrine.js';import { lintSpec, parseSpec } from '../src/spec.js';+import { renderSpecView } from '../src/view.js';/** A private repo's configured practice file, automatically removed after its test. */function practiceBox(t, text, name = 'PRACTICE.md') {@@ -75,3 +76,12 @@ test('cold-start run pack uses configured legacy practice and labels each sourceassert.doesNotMatch(pack, /PB2 \(standard 1\)/);assert.equal(readFileSync(join(box.root, 'ways.md'), 'utf8'), text);});++test('a shared section heading renders inherited and repo rules once each [D1,D3]', (t) => {+ const box = practiceBox(t, '# Local rules\n\n## Rules\n- PB2 [fact] A repo override.\n- R1 [fact] A repo addition.\n');+ const practice = loadDoctrine(box.root, box.config);+ const html = renderSpecView({ title: 'Fixture', spec: parseSpec('# Fixture\n\n## Goals\n- G1 [fact] A goal.\n'), practice, signoffs: [], generatedAt: 'fixture', files: { spec: 'SPEC.md', practice: 'PRACTICE.md' } });+ assert.equal((html.match(/>PB1<\/td>/g) ?? []).length, 1, 'the inherited rule appears once');+ assert.equal((html.match(/>PB2<\/td>/g) ?? []).length, 1, 'the override appears once');+ assert.equal((html.match(/>R1<\/td>/g) ?? []).length, 1, 'the repo addition appears once');+});