From d7de7d47c9c3ba2c33084aa40145ddeb0d006580 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E5=91=98=E9=98=BF=E6=B1=9F=28Relakkes?= =?UTF-8?q?=29?= Date: Tue, 14 Jul 2026 04:50:18 +0800 Subject: [PATCH] test(release): expose Windows recovery diagnostics --- desktop/scripts/windows-installer-smoke.ps1 | 38 +++++++++++++++++++++ scripts/pr/release-workflow.test.ts | 2 ++ 2 files changed, 40 insertions(+) diff --git a/desktop/scripts/windows-installer-smoke.ps1 b/desktop/scripts/windows-installer-smoke.ps1 index d456d44e..faf403a2 100644 --- a/desktop/scripts/windows-installer-smoke.ps1 +++ b/desktop/scripts/windows-installer-smoke.ps1 @@ -26,6 +26,7 @@ $localAppData = Join-Path $testRoot 'AppData\Local' $userProfile = Join-Path $testRoot 'UserProfile' $appExe = Join-Path $installDir 'Claude Code Haha.exe' $uninstaller = Join-Path $installDir 'Uninstall Claude Code Haha.exe' +$recoveryHelper = (Resolve-Path -LiteralPath (Join-Path $PSScriptRoot '..\build\recover-legacy-install-data.ps1')).Path $savedEnvironment = @{} foreach ($name in @('APPDATA', 'LOCALAPPDATA', 'USERPROFILE', 'CLAUDE_CONFIG_DIR', 'CC_HAHA_APP_PORTABLE_DIR')) { @@ -56,6 +57,42 @@ function Invoke-CheckedProcess { } } +function Invoke-LegacyRecoveryDiagnostic { + $windowsPowerShell = Join-Path $env:SystemRoot 'System32\WindowsPowerShell\v1.0\powershell.exe' + $arguments = @( + '-NoLogo', + '-NoProfile', + '-NonInteractive', + '-ExecutionPolicy', + 'Bypass', + '-File', + $recoveryHelper, + '-PerUserInstallDir', + $installDir, + '-CandidateInstallDir', + $installDir, + '-UserDataDir', + (Join-Path $appData 'Claude Code Haha'), + '-RecoveryRoot', + (Join-Path $userProfile 'Claude Code Haha Data\Recovered'), + '-ProcessName', + 'Claude Code Haha.exe', + '-InstallerIdentitySafety', + 'trusted-user' + ) + + [Console]::Out.WriteLine('Direct legacy recovery diagnostic starting...') + $output = @(& $windowsPowerShell @arguments 2>&1) + $exitCode = $LASTEXITCODE + foreach ($line in $output) { + [Console]::Out.WriteLine([string]$line) + } + if ($exitCode -ne 0) { + throw "Direct legacy recovery diagnostic failed with exit code $exitCode." + } + [Console]::Out.WriteLine('Direct legacy recovery diagnostic completed successfully.') +} + try { New-Item -ItemType Directory -Path $appData, $localAppData, $userProfile -Force | Out-Null $env:APPDATA = $appData @@ -69,6 +106,7 @@ try { throw "Fresh install did not create the application executable: $appExe" } + Invoke-LegacyRecoveryDiagnostic Invoke-CheckedProcess -FilePath $installer -Stage 'Default-mode reinstall' -Arguments @('--updated', '/S', '/currentuser', "/D=$installDir") if (-not (Test-Path -LiteralPath $appExe -PathType Leaf)) { throw "Reinstall removed the application executable: $appExe" diff --git a/scripts/pr/release-workflow.test.ts b/scripts/pr/release-workflow.test.ts index e1d660f1..fb6dd91a 100644 --- a/scripts/pr/release-workflow.test.ts +++ b/scripts/pr/release-workflow.test.ts @@ -556,6 +556,8 @@ describe('release desktop workflow', () => { } expect(installerSmoke).toContain('Invoke-CheckedProcess') + expect(installerSmoke).toContain('Invoke-LegacyRecoveryDiagnostic') + expect(installerSmoke).toContain('Direct legacy recovery diagnostic completed successfully') expect(installerSmoke).toContain("@('/S', '/currentuser'") expect(installerSmoke).toContain("@('--updated', '/S', '/currentuser'") expect(installerSmoke).toContain('$process.WaitForExit($TimeoutSeconds * 1000)')