fix(inspection): normalize diagnostic-looking Windows filenames

This commit is contained in:
haelyra committed 2026-10-20 18:41:19 -04:00
1 parent c04d00c15e
commit a6db53f835
2 files changed
+19 -1

No files matched your search

+1 -1
View File
@@ -27,7 +27,7 @@ function normalizeFailureReason(reason) {
// Directories may contain spaces, but trailing whitespace separates diagnostic prose.
// Unquoted spaced leaves allow one final dotted token; longer prose stays diagnostic.
// Quote paths with multiple spaces in the final filename to remove ambiguity.
.replace(/(?:\b[a-z]:|\\)[\\/](?:[^\\/:*?"<>|\r\n]*[^\s\\/:*?"<>|][\\/])*[^\s\\/:*?"<>|(),;]+(?: (?!failed\b|timed\b|could\b|cannot\b|unable\b|error\b)[^\s\\/:*?"<>|]+\.[^\s\\/:*?"<>|]+(?=:))?[\\/]*/gu, '<path>')
.replace(/(?:\b[a-z]:|\\)[\\/](?:[^\\/:*?"<>|\r\n]*[^\s\\/:*?"<>|][\\/])*[^\s\\/:*?"<>|(),;]+(?: [^\s\\/:*?"<>|]+\.[^\s\\/:*?"<>|]+(?=:))?[\\/]*/gu, '<path>')
// Strip remaining file paths
.replace(/(?:\b[a-z]:)?[\\/][\w./\\-]+/g, '<path>')
// Collapse whitespace
+18
View File
@@ -185,6 +185,24 @@ async function runTests() {
assert.strictEqual(groupFailures(runs).size, 2);
})) passed += 1; else failed += 1;
if (await test('groups Windows filenames with diagnostic-looking words', async () => {
const reasons = [
String.raw`Command C:\work\app error.log: permission denied`,
String.raw`Command D:\work\app output.log: permission denied`,
String.raw`Command E:\work\my failed-test.js: permission denied`,
];
assert.deepStrictEqual(reasons.map(normalizeFailureReason), [
'command <path>: permission denied',
'command <path>: permission denied',
'command <path>: permission denied',
]);
const runs = reasons.map((failureReason, index) => makeSkillRun({ id: `filename-${index}`, failureReason }));
assert.strictEqual(groupFailures(runs).size, 1);
const patterns = detectPatterns(runs);
assert.strictEqual(patterns.length, 1);
assert.strictEqual(patterns[0].count, 3);
})) passed += 1; else failed += 1;
if (await test('groupFailures handles mixed outcome casing', async () => {
const runs = [
makeSkillRun({ id: 'r1', outcome: 'FAILURE', failureReason: 'timeout' }),