47 lines
3.1 KiB
PowerShell
47 lines
3.1 KiB
PowerShell
$ErrorActionPreference = 'Stop'
|
|
$gateRoot = $PSScriptRoot
|
|
$mainRoot = 'C:/Users/User/Documents/Git/ARCADIA-Studio'
|
|
$buildStatus = Get-Content -LiteralPath (Join-Path $gateRoot 'studio-build-status.json') -Raw | ConvertFrom-Json
|
|
$clippyStatus = Get-Content -LiteralPath (Join-Path $gateRoot 'desktop-clippy-status.json') -Raw | ConvertFrom-Json
|
|
if ($buildStatus.exit -ne 0 -or $clippyStatus.exit -ne 0) { throw 'Both gate exits must be zero before preservation' }
|
|
$verificationPath = Join-Path $gateRoot 'after-build-verify-head.json'
|
|
if (Test-Path -LiteralPath $verificationPath) { throw 'Post-build verification receipt already exists' }
|
|
$verification = & 'C:/Users/User/.cache/codex-runtimes/codex-primary-runtime/dependencies/python/python.exe' (Join-Path $mainRoot '.local/canvas-union-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
|
|
$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' }
|
|
$binRoot = Join-Path $gateRoot 'bin'
|
|
if (Test-Path -LiteralPath $binRoot) { throw 'Immutable binary directory already exists' }
|
|
New-Item -ItemType Directory -Path $binRoot | Out-Null
|
|
$records = foreach ($source in @($guiSource,$dllSource)) {
|
|
$item = Get-Item -LiteralPath $source
|
|
$before = (Get-FileHash -LiteralPath $source -Algorithm SHA256).Hash
|
|
$destination = Join-Path $binRoot $item.Name
|
|
Copy-Item -LiteralPath $source -Destination $destination
|
|
$copied = Get-Item -LiteralPath $destination
|
|
$readback = (Get-FileHash -LiteralPath $destination -Algorithm SHA256).Hash
|
|
$sourceAfter = (Get-FileHash -LiteralPath $source -Algorithm SHA256).Hash
|
|
if ($before -cne $readback -or $before -cne $sourceAfter -or $item.Length -ne $copied.Length) { throw "Binary copy/readback mismatch: $source" }
|
|
$copied.IsReadOnly = $true
|
|
@{source=$source;copy=$destination;bytes=$copied.Length;source_sha256=$before;copy_sha256=$readback;source_after_sha256=$sourceAfter;read_only=$copied.IsReadOnly}
|
|
}
|
|
$manifest = @{
|
|
preserved_utc=[DateTime]::UtcNow.ToString('o')
|
|
scope='Windows source/build gates and immutable copies only; no native launch or package acceptance'
|
|
source_commit='a57c334 (root-reported; all 529 frozen inputs independently verified against worktree HEAD)'
|
|
worktree=(Join-Path $mainRoot '.local/canvas-union-ytr83r-20260911')
|
|
input_manifest_sha256=$verified.manifest_sha256
|
|
verified_inputs=$verified.files
|
|
verified_input_bytes=$verified.bytes
|
|
clippy=$clippyStatus
|
|
build=$buildStatus
|
|
binaries=@($records)
|
|
}
|
|
$manifest | ConvertTo-Json -Depth 8 | Set-Content -LiteralPath (Join-Path $gateRoot 'binary-manifest.json')
|
|
Get-Content -LiteralPath $verificationPath
|
|
Get-Content -LiteralPath (Join-Path $gateRoot 'binary-manifest.json')
|