44 lines
2.7 KiB
PowerShell
44 lines
2.7 KiB
PowerShell
param(
|
|
[Parameter(Mandatory)][ValidateSet('lifeline','machine')][string]$Trial,
|
|
[Parameter(Mandatory)][ValidatePattern('^[a-z0-9-]+$')][string]$Run
|
|
)
|
|
$ErrorActionPreference = 'Stop'
|
|
$trialRepo = 'C:\Users\User\Documents\Git\ARCADIA-Studio'
|
|
$evidence = Join-Path $trialRepo '.local/contextual-source-layout-20260911'
|
|
$verified = Join-Path $evidence 'gui-verified'
|
|
$nativeTrial = Join-Path $trialRepo ".local/native-qa/contextual-source-20260911-v2/$Trial"
|
|
$launchDir = Join-Path $nativeTrial "runs/$Run"
|
|
if (Test-Path -LiteralPath $launchDir) { throw 'Refuse to overwrite a native run' }
|
|
if (Get-Process -Name arcadia-studio -ErrorAction SilentlyContinue) { throw 'Studio already running' }
|
|
$preflight = Get-Content -LiteralPath (Join-Path (Split-Path $nativeTrial) 'preflight.json') -Raw | ConvertFrom-Json
|
|
if (@($preflight.checks | Where-Object exitCode -ne 0).Count) { throw 'Native input oracle did not pass' }
|
|
$manifest = Get-Content -LiteralPath (Join-Path $verified 'manifest.json') -Raw | ConvertFrom-Json
|
|
foreach ($artifact in $manifest.artifacts) {
|
|
if ((Get-FileHash -LiteralPath (Join-Path $verified $artifact.file) -Algorithm SHA256).Hash -ne $artifact.sha256) { throw 'Verified artifact changed' }
|
|
}
|
|
foreach ($gate in 'focused4','clippy1','fmt1','gui1') {
|
|
$status = Get-Content -LiteralPath (Join-Path $evidence ($gate + '-status.json')) -Raw | ConvertFrom-Json
|
|
if ($status.exitCode -ne 0) { throw "Unpassed build gate $gate" }
|
|
}
|
|
New-Item -ItemType Directory -Path $launchDir | Out-Null
|
|
foreach ($part in 'local','roaming') {
|
|
$profilePart = Join-Path $nativeTrial "profile/$part"
|
|
if (-not (Test-Path -LiteralPath $profilePart)) { New-Item -ItemType Directory -Path $profilePart | Out-Null }
|
|
}
|
|
$savedPath = $env:PATH
|
|
$savedAppData = $env:APPDATA
|
|
$savedLocalAppData = $env:LOCALAPPDATA
|
|
try {
|
|
$env:PATH = "$verified;$env:SystemRoot\System32;$env:SystemRoot"
|
|
$env:APPDATA = "$nativeTrial/profile/roaming"
|
|
$env:LOCALAPPDATA = "$nativeTrial/profile/local"
|
|
$binary = Join-Path $verified 'arcadia-studio.exe'
|
|
$child = Start-Process -FilePath $binary -WorkingDirectory $verified -WindowStyle Hidden -PassThru -RedirectStandardOutput "$launchDir/stdout.log" -RedirectStandardError "$launchDir/stderr.log"
|
|
[ordered]@{pid=$child.Id;startedUtc=[DateTimeOffset]::UtcNow.ToString('o');trial=$Trial;run=$Run;executable=$binary;artifacts=$manifest.artifacts;profile="$nativeTrial/profile";workingModel="$nativeTrial/work/project.arcadia";scope='Matching corrected source-layout GUI; native assertions remain separate'} | ConvertTo-Json -Depth 6 | Set-Content -LiteralPath "$launchDir/launch.json"
|
|
$child | Select-Object Id,ProcessName
|
|
} finally {
|
|
$env:PATH = $savedPath
|
|
$env:APPDATA = $savedAppData
|
|
$env:LOCALAPPDATA = $savedLocalAppData
|
|
}
|