fix: normalize paths to forward slashes for Windows RegExp compatibility

Windows path.relative() produces backslashes (e.g., memory\2026-02-16.md)
which fail to match RegExp patterns using forward slashes.

Normalize relative paths to forward slashes before RegExp matching
using rel.split(path.sep).join('/').

Fixes 4 test failures on Windows CI.
This commit is contained in:
康熙
2026-02-16 21:49:47 +08:00
committed by Peter Steinberger
parent 811c4f5e91
commit 65a1787f92

View File

@@ -30,7 +30,9 @@ export function auditPostCompactionReads(
// RegExp — match against relative paths from workspace
const found = readFilePaths.some((p) => {
const rel = path.relative(workspaceDir, path.resolve(workspaceDir, p));
return required.test(rel);
// Normalize to forward slashes for cross-platform RegExp matching
const normalizedRel = rel.split(path.sep).join("/");
return required.test(normalizedRel);
});
if (!found) {
missingPatterns.push(required.source);