From f274ca2c013a04cdafe8498661f2155ac0d0ed88 Mon Sep 17 00:00:00 2001 From: Paul Bakaus Date: Thu, 30 Jul 2026 09:43:58 -0700 Subject: [PATCH] Reject empty collection coverage AI assistance: Codex validated and addressed the Greptile empty-collection review finding with focused regression coverage. --- skill/scripts/lib/staleness-deep.mjs | 5 +++- tests/doctor.test.mjs | 38 ++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/skill/scripts/lib/staleness-deep.mjs b/skill/scripts/lib/staleness-deep.mjs index d98c97d19..8981b654a 100644 --- a/skill/scripts/lib/staleness-deep.mjs +++ b/skill/scripts/lib/staleness-deep.mjs @@ -122,7 +122,10 @@ function hasCoverageValue(value) { if (value && typeof value === 'object') { return Object.values(value).some(hasCoverageValue); } - if (typeof value === 'string') return value.trim().length > 0; + if (typeof value === 'string') { + const trimmed = value.trim(); + return trimmed.length > 0 && !/^(?:\[\s*\]|\{\s*\})$/.test(trimmed); + } return false; } diff --git a/tests/doctor.test.mjs b/tests/doctor.test.mjs index 41ab21063..fbd9db19d 100644 --- a/tests/doctor.test.mjs +++ b/tests/doctor.test.mjs @@ -239,6 +239,44 @@ describe('checkDesignCoverage', () => { } }); + it('does not count empty frontmatter collection literals as section coverage', () => { + for (const colors of ['[]', '{}']) { + const design = [ + '---', + 'name: X', + `colors: ${colors}`, + 'typography:', + ' body:', + ' fontFamily: Inter', + 'components:', + ' button:', + ' backgroundColor: "#111111"', + '---', + '', + '# Design System: X', + '', + ].join('\n'); + const findings = checkDesignCoverage({ design, designPath: 'DESIGN.md', parseDesignMd }); + assert.deepEqual(ids(findings), ['design-md-coverage']); + assert.match(findings[0].summary, /no colors section/); + } + }); + + it('counts populated frontmatter array literals as section coverage', () => { + const design = [ + '---', + 'name: X', + 'colors: ["#111111"]', + 'typography: [Inter]', + 'components: [button]', + '---', + '', + '# Design System: X', + '', + ].join('\n'); + assert.deepEqual(checkDesignCoverage({ design, designPath: 'DESIGN.md', parseDesignMd }), []); + }); + it('reports nothing without a DESIGN.md', () => { assert.deepEqual(checkDesignCoverage({ design: null, parseDesignMd }), []); });