$ErrorActionPreference = 'Stop' $trialRepo = 'C:\Users\User\Documents\Git\ARCADIA-Studio' $priorTrial = Join-Path $trialRepo '.local/native-qa/contextual-source-20260911-v1' $reopenTrial = Join-Path $trialRepo '.local/native-qa/contextual-source-20260911-reopen2' if (Test-Path -LiteralPath $reopenTrial) { throw 'Reopen stage already exists' } if (Get-Process -Name arcadia-studio -ErrorAction SilentlyContinue) { throw 'Studio already running' } $binary = Join-Path $priorTrial 'bin/arcadia-studio.exe' $binaryHash = (Get-FileHash -LiteralPath $binary -Algorithm SHA256).Hash if ($binaryHash -ne '52DE82E434B636E18DB02D381842AA6DB84B721CFFD5502063F784F37246ACCE') { throw 'Old GUI changed' } $dllHash = (Get-FileHash -LiteralPath (Join-Path $priorTrial 'bin/libunwind.dll') -Algorithm SHA256).Hash if ($dllHash -ne 'F45604A12E8BCD839FD86F667C1BE1CC7C4F9DA2B3C69FF381AC708F0E1AE7D4') { throw 'Runtime changed' } New-Item -ItemType Directory -Path "$reopenTrial/profile/local", "$reopenTrial/profile/roaming" | Out-Null Copy-Item -LiteralPath (Join-Path $priorTrial 'checkpoint-machine') -Destination "$reopenTrial/work" -Recurse $savedPath = $env:PATH $savedAppData = $env:APPDATA $savedLocalAppData = $env:LOCALAPPDATA try { $env:PATH = "$priorTrial/bin;$env:SystemRoot\System32;$env:SystemRoot" $env:APPDATA = "$reopenTrial/profile/roaming" $env:LOCALAPPDATA = "$reopenTrial/profile/local" $child = Start-Process -FilePath $binary -WorkingDirectory "$priorTrial/bin" -WindowStyle Hidden -PassThru -RedirectStandardOutput "$reopenTrial/stdout.log" -RedirectStandardError "$reopenTrial/stderr.log" [ordered]@{pid=$child.Id; startedUtc=[DateTimeOffset]::UtcNow.ToString('o'); executable=$binary; sha256=$binaryHash; dllSha256=$dllHash; profile="$reopenTrial/profile"; workingModel="$reopenTrial/work/project.arcadia"; originalCheckpoint="$priorTrial/checkpoint-machine"; sourceScope='Immutable prior GUI52; this does not validate current display WIP'} | ConvertTo-Json | Set-Content -LiteralPath "$reopenTrial/launch.json" $child | Select-Object Id,ProcessName } finally { $env:PATH = $savedPath $env:APPDATA = $savedAppData $env:LOCALAPPDATA = $savedLocalAppData }