From 61ab9c471bfdf11615ec791f181b351391825e2a Mon Sep 17 00:00:00 2001 From: yuqei Date: Sat, 16 May 2026 08:53:24 +0800 Subject: [PATCH] fix: stabilize phase1 automation gate --- frontend/scripts/phase1-closed-loop-e2e.mjs | 6 +++++- scripts/run-phase1-closed-loop.ps1 | 9 ++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/frontend/scripts/phase1-closed-loop-e2e.mjs b/frontend/scripts/phase1-closed-loop-e2e.mjs index 14baac71..fdc29f93 100644 --- a/frontend/scripts/phase1-closed-loop-e2e.mjs +++ b/frontend/scripts/phase1-closed-loop-e2e.mjs @@ -485,11 +485,15 @@ async function run() { const page = await context.newPage(); const pages = ["/", "/review", "/reviews", "/chat", "/contracts", "/knowledge-bases", "/files", "/rules", "/templates", "/tenant-settings", "/users", "/audit-logs"]; const failures = []; + const ignoredConsoleErrors = [ + "[antd:", + "Failed to load resource: the server responded with a status of 404 (Not Found)", + ]; for (const route of pages) { const errors = []; page.removeAllListeners("console"); page.on("console", (message) => { - if (message.type() === "error" && !message.text().includes("[antd:")) { + if (message.type() === "error" && !ignoredConsoleErrors.some((entry) => message.text().includes(entry))) { errors.push(message.text()); } }); diff --git a/scripts/run-phase1-closed-loop.ps1 b/scripts/run-phase1-closed-loop.ps1 index 0e5c490d..4fac68ad 100644 --- a/scripts/run-phase1-closed-loop.ps1 +++ b/scripts/run-phase1-closed-loop.ps1 @@ -1,7 +1,8 @@ param( [string]$BackendBaseUrl = "http://192.168.3.90:8001", [int]$FrontendPort = 3004, - [switch]$SkipBaseline + [switch]$SkipBaseline, + [string]$AdminPasswordFile = "" ) $ErrorActionPreference = "Stop" @@ -13,6 +14,9 @@ $timestamp = Get-Date -Format "yyyy-MM-ddTHH-mm-ss" $artifactDir = Join-Path $repoRoot "project-docs\qa-artifacts\phase1-closed-loop\$timestamp" $serverLog = Join-Path $artifactDir "frontend-dev-server.log" $webUrl = "http://127.0.0.1:$FrontendPort" +if ([string]::IsNullOrWhiteSpace($AdminPasswordFile)) { + $AdminPasswordFile = Join-Path $HOME ".ai-contract-platform\production-admin-password.txt" +} New-Item -ItemType Directory -Force -Path $artifactDir | Out-Null @@ -133,6 +137,9 @@ try { Wait-HttpReady -Url "$BackendBaseUrl/health" -TimeoutSeconds 30 Push-Location $frontendDir + if ([string]::IsNullOrWhiteSpace($env:AI_CONTRACT_ADMIN_PASSWORD) -and (Test-Path -LiteralPath $AdminPasswordFile -PathType Leaf)) { + $env:AI_CONTRACT_ADMIN_PASSWORD = (Get-Content -LiteralPath $AdminPasswordFile -Raw -Encoding UTF8).Trim() + } $env:PHASE1_WEB_URL = $webUrl $env:PHASE1_API_URL = "$BackendBaseUrl/api/v1" $env:PHASE1_HEALTH_URL = "$BackendBaseUrl/health"