Files
kefu/deploy/my-customers-20260918/validate_customers_v1_4_26.ps1
T
2026-09-21 10:34:06 +08:00

26 lines
2.3 KiB
PowerShell

param([switch]$Finalized)
$ErrorActionPreference = 'Stop'
if (-not $Finalized) { throw 'Finalized root review required' }
$taskPlan = Get-Content -Raw -LiteralPath (Join-Path $PSScriptRoot 'customers-release-plan.json') | ConvertFrom-Json
if (-not $taskPlan.finalized -or $taskPlan.version -ne '1.4.26') { throw 'Unfinished or wrong-version release plan' }
$taskBuildLog = Get-Content -Raw -LiteralPath (Join-Path $PSScriptRoot 'customers-app-build.log')
if (-not $taskBuildLog.Contains('Packaged Qt WebEngine self-check passed')) { throw 'Packaged self-check did not pass' }
$taskPython = Join-Path $taskPlan.windowsRoot '.build-venv\Scripts\python.exe'
$env:LOCALAPPDATA = Join-Path $PSScriptRoot 'qa-profile\Local'
$env:APPDATA = Join-Path $PSScriptRoot 'qa-profile\Roaming'
$env:QT_QPA_PLATFORM = 'offscreen'
$env:PYTHONDONTWRITEBYTECODE = '1'
New-Item -ItemType Directory -Path $env:LOCALAPPDATA,$env:APPDATA -Force | Out-Null
& $taskPython -B (Join-Path $PSScriptRoot 'verify_customers_frozen.py')
if ($LASTEXITCODE -ne 0) { throw 'Frozen module/source verification failed' }
& $taskPython -B (Join-Path $PSScriptRoot 'run_customers_frozen_regressions.py') *> (Join-Path $PSScriptRoot 'customers-frozen-runner.log')
if ($LASTEXITCODE -ne 0) { throw 'Frozen synthetic regression failed' }
$taskResults = Get-Content -Raw -LiteralPath (Join-Path $PSScriptRoot 'frozen-customers-tests.json') | ConvertFrom-Json
if ($taskResults.tests_run -le 0 -or $taskResults.failures -ne 0 -or $taskResults.errors -ne 0 -or $taskResults.blocked_external_actions.Count -ne 0) { throw 'Frozen regression incomplete or attempted external operation' }
if ($taskResults.skipped -gt [int]$taskPlan.allowedSkippedTests) { throw 'Unexpected skipped frozen tests' }
& $taskPython -B (Join-Path $PSScriptRoot 'verify_customers_nsis.py')
if ($LASTEXITCODE -ne 0) { throw 'Installer integrity failed' }
$taskOld = Join-Path $taskPlan.windowsRoot 'releases\甄AI客服-安装包-v1.4.25.exe'
if ((Get-FileHash -LiteralPath $taskOld -Algorithm SHA256).Hash.ToLowerInvariant() -ne 'bd58b73c7f4b1c87a810e380867ed7caffa65337200371e85b256d25c0efc62f') { throw 'Old v1.4.25 installer changed' }
Write-Output 'v1.4.26 frozen modules, private-file exclusion, synthetic regressions and installer payload verified. Not installed or published.'