Files
kefu/deploy/contact-recovery-20260918/validate_contact_recovery_v1_4_28.ps1
T
2026-09-21 10:34:06 +08:00

30 lines
2.6 KiB
PowerShell

param([switch]$Finalized)
$ErrorActionPreference = 'Stop'
if (-not $Finalized) { throw 'Finalized root review required' }
$taskPlan = Get-Content -Raw -LiteralPath (Join-Path $PSScriptRoot 'contact-recovery-release-plan.json') | ConvertFrom-Json
if (-not $taskPlan.finalized -or $taskPlan.version -ne '1.4.28') { throw 'Unfinished or wrong-version release plan' }
$taskBuildLog = Get-Content -Raw -LiteralPath (Join-Path $PSScriptRoot 'contact-recovery-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_contact_recovery_frozen.py')
if ($LASTEXITCODE -ne 0) { throw 'Frozen module/source verification failed' }
& $taskPython -B (Join-Path $PSScriptRoot 'run_contact_recovery_frozen_regressions.py') *> (Join-Path $PSScriptRoot 'contact-recovery-frozen-runner.log')
if ($LASTEXITCODE -ne 0) { throw 'Frozen synthetic regression failed' }
$taskResults = Get-Content -Raw -LiteralPath (Join-Path $PSScriptRoot 'frozen-contact-recovery-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_frozen_contact_recovery_notifications.py')
if ($LASTEXITCODE -ne 0) { throw 'Frozen review/manual notification tests failed' }
& $taskPython -I -S (Join-Path $PSScriptRoot 'verify_frozen_offline_asr.py')
if ($LASTEXITCODE -ne 0) { throw 'Actual frozen offline ASR verification failed' }
& $taskPython -B (Join-Path $PSScriptRoot 'verify_contact_recovery_nsis.py')
if ($LASTEXITCODE -ne 0) { throw 'Installer integrity failed' }
$taskOld = Join-Path $taskPlan.windowsRoot 'releases\甄AI客服-安装包-v1.4.27.exe'
if ((Get-FileHash -LiteralPath $taskOld -Algorithm SHA256).Hash.ToLowerInvariant() -ne '1ef5f2155992423cdb0ac3d3c0f29bcbd5f401baae13d359a98292d02c036fff') { throw 'Old v1.4.27 installer changed' }
Write-Output 'v1.4.28 frozen modules, private-file exclusion, synthetic regressions and installer payload verified. Not installed or published.'