From 15d7dcb7219335d59847b9901a6d8263c77e1d14 Mon Sep 17 00:00:00 2001 From: Tate McCauley Date: Tue, 3 Mar 2026 08:04:48 -0700 Subject: [PATCH] fix(ci): pass --use-test-data to scoring engine when USE_SCORING_TEST_DATA is set E2E step was failing because the server never forwarded the env var to Python; the scoring script was doing live fetches in CI. Now the server adds --use-test-data when USE_SCORING_TEST_DATA=1 so the engine uses built-in test data and the scan succeeds without network calls. Made-with: Cursor --- Server/server.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Server/server.js b/Server/server.js index e5d415b..6ce23fa 100644 --- a/Server/server.js +++ b/Server/server.js @@ -184,6 +184,12 @@ app.get("/scan", (req, res) => { console.log(`[${new Date().toISOString()}] Scanning: ${targetDomain}`); + // When USE_SCORING_TEST_DATA=1 (e.g. in CI), pass --use-test-data so the scoring + // engine uses built-in test data instead of live fetches (avoids network/timeouts). + const useTestData = /^(1|true|yes)$/i.test(String(process.env.USE_SCORING_TEST_DATA || "").trim()); + const pythonArgv = ["-t", targetDomain]; + if (useTestData) pythonArgv.push("--use-test-data"); + // Try multiple python executables in order to be robust across systems. // On Windows users may have 'python', the 'py' launcher, or rarely 'python3'. // On Unix-like systems prefer 'python3' then 'python'. We attempt each @@ -216,7 +222,7 @@ app.get("/scan", (req, res) => { let responded = false; - spawnPythonWithFallback(pythonScript, ["-t", targetDomain], { + spawnPythonWithFallback(pythonScript, pythonArgv, { cwd: path.dirname(pythonScript), }) .then((py) => {