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(rigor): a catch whose log is only deleted is named [D1,D3]
Corey Olson28227062d862
diff --git a/src/rigor-quality.js b/src/rigor-quality.jsindex cb2f536a..ff039d5a 100644--- a/src/rigor-quality.js+++ b/src/rigor-quality.js@@ -257,21 +257,25 @@ const CHECKS = {.map(([path]) => ({ path, line: 1, text: 'is a new gate or check, and no test in this change runs it with no data to show it fails closed' }));},/**- * A catch the change adds, or edits, that neither throws nor writes a line. Why edits count: rewriting an existing- * catch's body into a silent fallback introduces the silence even though its header line is unchanged (#806 review).- * A catch matched to its earlier self (same header, same place among those headers) that was already silent with- * the same body stays old debt.+ * A catch the change adds, or makes silent, that neither throws nor writes a line. Each catch is matched to its earlier+ * self (same header, same place among those headers). Why compare: rewriting or only deleting an existing catch's log+ * leaves its header untouched and may add no line at all, yet introduces the silence (#806 reviews). A catch that was+ * already silent stays old debt unless the change rewrites its body.*/- 'silent-catch': (root, range, { diff }) => [...diff].filter(([path, file]) => SCRIPT.test(path) && !TEST_FILE.test(path) && file.added.length)+ 'silent-catch': (root, range, { diff }) => [...diff].filter(([path, file]) => SCRIPT.test(path) && !TEST_FILE.test(path) && file.status !== 'D').flatMap(([path, file]) => {const source = textAt(root, range.head, path) ?? '';const added = file.added.map((entry) => entry.line);const before = new Map(catches(textAt(root, range.base, path) ?? '').map((found) => [found.identity, found]));return catches(source).map((found) => ({ ...found, line: lineAt(source, found.at), last: lineAt(source, found.end) }))- .filter((found) => silent(found) && added.some((line) => line >= found.line && line <= found.last)).filter((found) => {+ if (!silent(found)) return false;const earlier = before.get(found.identity);- return added.includes(found.line) || !earlier || !silent(earlier) || bodyKey(earlier) !== bodyKey(found);+ if (added.includes(found.line)) return true;+ // No earlier self with an unchanged header means a shifted count, not a new catch: a new one adds its header.+ if (!earlier) return false;+ if (!silent(earlier)) return true;+ return bodyKey(earlier) !== bodyKey(found) && added.some((line) => line > found.line && line <= found.last);}).map((found) => ({ path, line: found.line, text: `${found.kind === 'clause' ? 'catch' : '.catch handler'} is silent: it neither throws nor logs a line that names its subject` }));}),diff --git a/test/rigor-checks.test.js b/test/rigor-checks.test.jsindex 74317958..852f1dec 100644--- a/test/rigor-checks.test.js+++ b/test/rigor-checks.test.js@@ -588,3 +588,31 @@ test('rigor reports a catch the change made silent [D1,D3]', () => {'src/settings.js:4: silent-catch: catch is silent: it neither throws nor logs a line that names its subject',], 'the catch whose logged body became a silent fallback is named at its header; the old silent catch, only reindented, is not');});++test('rigor reports a catch whose log line alone is deleted [D1,D3]', () => {+ const start = [+ 'export function settings(read) {',+ ' try {',+ ' return read();',+ ' } catch (error) {',+ ' console.warn(`settings unreadable: ${error.message}`);',+ ' return null;',+ ' }',+ '}',+ 'export function other(read) {',+ ' try {',+ ' return read();',+ ' } catch (error) {',+ ' console.warn(`other unreadable: ${error.message}`);',+ ' return null;',+ ' }',+ '}',+ '',+ ];+ const repo = qualityRepo('quality-catch-deleted', { 'src/settings.js': start.join('\n') });+ repo.commit('fix(settings): quieter reads', { 'src/settings.js': start.filter((line) => !line.includes('settings unreadable')).join('\n') });+ const breaches = qualityBreaches(repo.root, changeRange(repo.root), { rules: ['silent-catch'] });+ assert.deepEqual(breaches.map((breach) => breachLine(breach)), [+ 'src/settings.js:4: silent-catch: catch is silent: it neither throws nor logs a line that names its subject',+ ], 'a change that only deletes a catch log names that catch; the untouched logged catch is not named');+});