fix: normalize path separators in no-direct-agent-server-calls test for Windows (#488)

On Windows, path.relative() returns backslash-separated paths, but
ALLOWED_AD_HOC_HTTP_FILES uses forward slashes. The Set.has() check
therefore never matches on Windows, causing false positive violations.

Normalize relPath to forward slashes before the check so the test
passes correctly on all platforms.

Co-authored-by: openhands <openhands@all-hands.dev>
This commit is contained in:
Rohit Malhotra
2026-05-15 14:42:45 -04:00
committed by GitHub
co-authored by openhands
parent e9b5e07293
commit 38121aaf2f
+3 -1
View File
@@ -12,7 +12,9 @@ const ALLOWED_AD_HOC_HTTP_FILES = new Set([
function collectSourceFiles(dir: string): string[] {
return readdirSync(dir, { withFileTypes: true }).flatMap((entry) => {
const fullPath = join(dir, entry.name);
const relPath = relative(SRC_ROOT, fullPath);
// Normalize to forward slashes so the path matches ALLOWED_AD_HOC_HTTP_FILES
// entries on Windows where path.relative() returns backslash-separated paths.
const relPath = relative(SRC_ROOT, fullPath).replace(/\\/g, "/");
if (entry.isDirectory()) {
if (EXCLUDED_SEGMENTS.has(entry.name)) return [];