From 73a4aef95f6ac24675e124296442fd3b78fa5523 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 05:06:30 +0800 Subject: [PATCH] fix(desktop): skip empty shared install scans --- desktop/build/recover-legacy-install-data.ps1 | 10 +++++++--- scripts/pr/release-workflow.test.ts | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/desktop/build/recover-legacy-install-data.ps1 b/desktop/build/recover-legacy-install-data.ps1 index f314de4d..dd2d6d49 100644 --- a/desktop/build/recover-legacy-install-data.ps1 +++ b/desktop/build/recover-legacy-install-data.ps1 @@ -636,7 +636,7 @@ function Write-AppModeAtomically { function Invoke-LegacyRecovery { param( [Parameter(Mandatory = $true)][string[]]$InstallDirs, - [string[]]$SharedInstallDirs = @(), + [AllowEmptyCollection()][AllowEmptyString()][string[]]$SharedInstallDirs = @(), [Parameter(Mandatory = $true)][string]$UserDataDir, [Parameter(Mandatory = $true)][string]$RecoveryRoot, [Parameter(Mandatory = $true)][string]$ProcessName, @@ -657,8 +657,12 @@ function Invoke-LegacyRecovery { -UserDataDir $UserDataDir ` -ActiveConfigDir $ActiveConfigDir ` -ActiveConfigManaged $ActiveConfigManaged - $potentialSharedInstallDirs = @(Get-PotentialInstallDirs -InstallDirs $SharedInstallDirs) - $existingSharedInstallDirs = @(Get-ExistingInstallDirs -InstallDirs $potentialSharedInstallDirs) + $sharedInstallDirInputs = @($SharedInstallDirs | Where-Object { -not [string]::IsNullOrWhiteSpace($_) }) + $existingSharedInstallDirs = @() + if ($sharedInstallDirInputs.Count -gt 0) { + $potentialSharedInstallDirs = @(Get-PotentialInstallDirs -InstallDirs $sharedInstallDirInputs) + $existingSharedInstallDirs = @(Get-ExistingInstallDirs -InstallDirs $potentialSharedInstallDirs) + } if ($existingSharedInstallDirs.Count -gt 0) { Assert-NoUndiscoveredLegacySources -InstallDirs $existingSharedInstallDirs -ActiveSource $source } diff --git a/scripts/pr/release-workflow.test.ts b/scripts/pr/release-workflow.test.ts index dc7cbdc1..8e86d14c 100644 --- a/scripts/pr/release-workflow.test.ts +++ b/scripts/pr/release-workflow.test.ts @@ -532,6 +532,7 @@ describe('release desktop workflow', () => { expect(recoveryHelper).toContain('Active CLAUDE_CONFIG_DIR is managed outside Claude Code Haha') expect(recoveryHelper).toContain('Test-LexicalPathAtOrBelow') expect(recoveryHelper).toContain('-SharedInstallDirs @($PerMachineInstallDir)') + expect(recoveryHelper).toContain('$sharedInstallDirInputs.Count -gt 0') expect(recoveryHelper).toContain('per-user default-mode reinstall scanned the packaged application tree') expect(recoveryHelper).toContain('untrusted-elevated') expect(recoveryHelper).toContain('External CLAUDE_CONFIG_DIR is active while install-contained legacy data still exists')