diff --git a/monitor/sarif-read.mjs b/monitor/sarif-read.mjs index 23cf79f3..39f03ab3 100644 --- a/monitor/sarif-read.mjs +++ b/monitor/sarif-read.mjs @@ -154,7 +154,10 @@ const FILE_PARTIAL_IDS = Object.freeze({ 'Fixpoint timeout': 'fixpoint-timeout', }); // The third shape is Semgrep giving up on a whole file: "Timeout at line ::", no rule. -const FILE_OF = [/ on (.+?):\s*$/s, /^(?:Other )?(?:Syntax|Lexical) error at line (.+?):\d+:/, /^Timeout at line (.+?):\d+:/, +// Semgrep writes "Other syntax error" with a lower-case `s` (measured on machdep.h, 2026-11-29), so +// the syntax/lexical pattern is case-insensitive. Without the flag that notice yields no uri and the +// file is dropped from the coverage count — the silent-clean class this list exists to close. +const FILE_OF = [/ on (.+?):\s*$/s, /^(?:Other )?(?:Syntax|Lexical) error at line (.+?):\d+:/i, /^Timeout at line (.+?):\d+:/, /^Fixpoint timeout while performing taint analysis at (.+?):\d+:\d+/]; /** The reasons bin/semgrep-retry.mjs re-measures; the others are about parsing, which a retry repeats. */ export const RETRIED_REASONS = Object.freeze(['timeout', 'fixpoint-timeout']); diff --git a/monitor/test/unit-sarif-read-partial-analysis.test.mjs b/monitor/test/unit-sarif-read-partial-analysis.test.mjs index baabf770..66080c13 100644 --- a/monitor/test/unit-sarif-read-partial-analysis.test.mjs +++ b/monitor/test/unit-sarif-read-partial-analysis.test.mjs @@ -48,3 +48,13 @@ test('sorts output rows by uri then rule', () => { ] }]; assert.deepEqual(partialAnalysis(inv), [{ uri: "a.js", reasons: ["timeout"], notices: 1 }, { uri: "z.js", reasons: ["timeout"], notices: 1 }]); }); + +test('resolves the uri from an "Other syntax error" notice, which Semgrep writes with a lower-case s', () => { + const inv = [{ toolExecutionNotifications: [{ descriptor: { id: 'Other syntax error' }, message: { text: 'Other syntax error at line machdep.h:1:\n Failure: found invalid inline assembler statement as expression' } }] }]; + assert.deepEqual(partialAnalysis(inv), [{ uri: "machdep.h", reasons: ["syntax-error"], notices: 1 }]); +}); + +test('still resolves the uri from a capitalised "Syntax error" notice', () => { + const inv = [{ toolExecutionNotifications: [{ descriptor: { id: 'Syntax error' }, message: { text: 'Syntax error at line src/c.c:12:\n unexpected' } }] }]; + assert.deepEqual(partialAnalysis(inv), [{ uri: "src/c.c", reasons: ["syntax-error"], notices: 1 }]); +}); diff --git a/package.json b/package.json index 7cccc60d..201b2ab2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "commitwork", - "version": "0.6.347", + "version": "0.6.348", "description": "Repository security scanner, local CI runner and scheduled monitor, with remediation and compliance-evidence tooling. Manifest-driven; runs against any git repository.", "homepage": "https://www.commitwork.online", "repository": {