From dbc822ba8bafd08f1dad5012df4ee76e93d60026 Mon Sep 17 00:00:00 2001 From: Danny Martini Date: Wed, 23 Sep 2026 11:33:35 +0000 Subject: [PATCH] fix: Exempt ADR Links fields from the paragraph length rule (no-changelog) (#39384) Co-authored-by: Claude Fable 5.1 --- .../src/rules/adr-conventions.rule.test.ts | 30 +++++++++++++++++++ .../src/rules/adr-conventions.rule.ts | 7 +++-- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/packages/testing/code-health/src/rules/adr-conventions.rule.test.ts b/packages/testing/code-health/src/rules/adr-conventions.rule.test.ts index 95078b86f64..77213fc4e83 100644 --- a/packages/testing/code-health/src/rules/adr-conventions.rule.test.ts +++ b/packages/testing/code-health/src/rules/adr-conventions.rule.test.ts @@ -532,6 +532,36 @@ describe('AdrConventionsRule', () => { ).toBe(true); }); + it('allows Links field lines longer than 100 characters', async () => { + addTestFile( + tmpDir, + 'docs/adr/ADR-20260828-obtain-trigger-output-before-creating-the-execution.md', + validAdr({ + title: 'Obtain trigger output before creating the execution', + date: '2026-08-28', + }), + ); + addTestFile( + tmpDir, + 'docs/adr/ADR-20260904-store-the-workflow-revision-that-ran-with-the-execution.md', + validAdr({ + title: 'Store the workflow revision that ran with the execution', + date: '2026-09-04', + }), + ); + addTestFile( + tmpDir, + 'docs/adr/ADR-20260922-adopt-a-stable-interface.md', + validAdr({ + relatedAdrs: + 'ADR-20260828-obtain-trigger-output-before-creating-the-execution, ' + + 'ADR-20260904-store-the-workflow-revision-that-ran-with-the-execution', + }), + ); + + await expect(rule.analyze(context())).resolves.toEqual([]); + }); + it.each([ { name: 'a missing Links field', diff --git a/packages/testing/code-health/src/rules/adr-conventions.rule.ts b/packages/testing/code-health/src/rules/adr-conventions.rule.ts index 87430b77949..9481ef933ad 100644 --- a/packages/testing/code-health/src/rules/adr-conventions.rule.ts +++ b/packages/testing/code-health/src/rules/adr-conventions.rule.ts @@ -38,7 +38,7 @@ const MAX_PARAGRAPH_LINE_LENGTH = 100; * - Use full ADR IDs in supersession metadata. * - Add the required RFC, Documentation, and Related ADRs link fields. * - Resolve local ADR references and allow references in external URLs. - * - Limit paragraph lines to 100 characters. + * - Limit paragraph lines before the Links section to 100 characters. * - Apply structural rules to the root ADR template. */ export class AdrConventionsRule extends BaseRule { @@ -92,8 +92,12 @@ export class AdrConventionsRule extends BaseRule { const violations: Violation[] = []; const { filePath, relativePath, fileName } = file; const isTemplate = relativePath === 'docs/ADR_TEMPLATE.md'; + const headingResult = validateHeadings(file.tokens); + // Links fields hold ADR IDs and URLs, not prose. Their length is not limited. + const linksLine = headingResult.valid ? headingResult.indexes.at(-1)! : Infinity; for (const { line, length } of findLongParagraphLines(file, MAX_PARAGRAPH_LINE_LENGTH)) { + if (line > linksLine) continue; violations.push( this.createViolation( filePath, @@ -168,7 +172,6 @@ export class AdrConventionsRule extends BaseRule { ); } - const headingResult = validateHeadings(file.tokens); if (!headingResult.valid) { violations.push( this.createViolation(