Files
ARCADIA-Studio/harness/experiments/grapheme-windows-cb91525-20260911/preserve-build.ps1
T

60 lines
4.0 KiB
PowerShell

# Historical preparation only. Root deferred this build for the saved-destination fix.
throw 'Superseded: cb91525 GUI build/preservation was not executed; root owns the combined build.'
$ErrorActionPreference = 'Stop'
$gateRoot = $PSScriptRoot
$mainRoot = 'C:/Users/User/Documents/Git/ARCADIA-Studio'
$sourceCommit = 'cb91525cfd9da7ac15ea1b21b962145c77bb9922'
$gateNames = @('short-bin-tests', 'desktop-all-targets', 'desktop-clippy', 'studio-build')
$gateRecords = @{}
foreach ($name in $gateNames) {
$record = Get-Content -LiteralPath (Join-Path $gateRoot ($name + '-status.json')) -Raw | ConvertFrom-Json
if ($record.exit -ne 0 -or [string]::IsNullOrWhiteSpace($record.completed_utc)) { throw "Closed exit0 required: $name" }
$gateRecords[$name] = $record
}
$verificationPath = Join-Path $gateRoot 'after-build-verify-head.json'
$binaryManifest = Join-Path $gateRoot 'binary-manifest.json'
$binRoot = Join-Path $gateRoot 'bin'
foreach ($fresh in @($verificationPath, $binaryManifest, $binRoot)) {
if (Test-Path -LiteralPath $fresh) { throw "Refusing existing output: $fresh" }
}
$verification = & 'C:/Users/User/.cache/codex-runtimes/codex-primary-runtime/dependencies/python/python.exe' (Join-Path $mainRoot '.local/grapheme-fixed-inputs.py') verify-head
if ($LASTEXITCODE -ne 0) { throw '529 frozen inputs changed after Studio build' }
[IO.File]::WriteAllText($verificationPath, ($verification -join "`n"))
$verified = ($verification -join "`n") | ConvertFrom-Json
if (-not $verified.pass -or $verified.files -ne 529 -or $verified.manifest_sha256 -ne '8f787f119e8d82acb52c4f28bf4c3c6635d8970f1bc9d669deb7c1fcc8373eb5') { throw 'Unexpected frozen inputs' }
$guiSource = Join-Path $mainRoot 'target/debug/arcadia-studio.exe'
$dllSource = Join-Path $mainRoot '.local/toolchain/llvm-mingw-20260908-ucrt-x86_64/bin/libunwind.dll'
$expectedDll = 'AA282FA47BB2C4E210CEA5E470CDBDCA58568F0BE0BC73E404D86AB9CD95EF6A'
if ((Get-FileHash -LiteralPath $dllSource -Algorithm SHA256).Hash -cne $expectedDll) { throw 'Configured libunwind.dll hash mismatch' }
[void][IO.Directory]::CreateDirectory($binRoot)
$records = foreach ($source in @($guiSource, $dllSource)) {
$item = Get-Item -LiteralPath $source
$beforeBytes = $item.Length
$beforeHash = (Get-FileHash -LiteralPath $source -Algorithm SHA256).Hash
$destination = Join-Path $binRoot $item.Name
if (Test-Path -LiteralPath $destination) { throw "Destination exists: $destination" }
[IO.File]::Copy($source, $destination, $false)
$copied = Get-Item -LiteralPath $destination
$copyHash = (Get-FileHash -LiteralPath $destination -Algorithm SHA256).Hash
$sourceAfterHash = (Get-FileHash -LiteralPath $source -Algorithm SHA256).Hash
$sourceAfterBytes = (Get-Item -LiteralPath $source).Length
if ($beforeHash -cne $copyHash -or $beforeHash -cne $sourceAfterHash -or $beforeBytes -ne $copied.Length -or $beforeBytes -ne $sourceAfterBytes) { throw "Copy/readback mismatch: $source" }
$copied.IsReadOnly = $true
[ordered]@{ source=$source; copy=$destination; source_bytes=$beforeBytes; copy_bytes=$copied.Length; source_after_bytes=$sourceAfterBytes; source_sha256=$beforeHash; copy_sha256=$copyHash; source_after_sha256=$sourceAfterHash; read_only=$copied.IsReadOnly }
}
$manifest = [ordered]@{
preserved_utc=[DateTime]::UtcNow.ToString('o')
scope='Corrected Windows source/test/build gates and immutable copies only; no native launch or package acceptance'
source_commit=$sourceCommit
source_identity='Root supplied exact commit; all529 frozen files independently verified against worktree HEAD before/between/after gates'
worktree=(Join-Path $mainRoot '.local/canvas-union-ytr83r-20260911')
input_manifest_sha256=$verified.manifest_sha256
verified_inputs=$verified.files
verified_input_bytes=$verified.bytes
gates=$gateRecords
binaries=@($records)
}
$manifest | ConvertTo-Json -Depth 9 | Set-Content -LiteralPath $binaryManifest
Get-Content -LiteralPath $verificationPath
Get-Content -LiteralPath $binaryManifest