30 lines
2.3 KiB
PowerShell
30 lines
2.3 KiB
PowerShell
#Requires -Version 7.0
|
|
param([Parameter(Mandatory=$true)][ValidatePattern('^(before|after|(check|list|focused|all|clippy|build)-(before|after))$')][string]$Stage)
|
|
Set-StrictMode -Version Latest
|
|
$ErrorActionPreference='Stop'
|
|
$taskWorkspace='C:\Users\User\Documents\Git\ARCADIA-Studio\.local\scenario-layout-ytr83r-20260913'
|
|
$taskPin='694efd6e5921efe51901b34a481a3b51f992377f'
|
|
$taskOutput=Join-Path $PSScriptRoot ('inputs-complete-'+$Stage+'.json')
|
|
if(Test-Path -LiteralPath $taskOutput){throw 'Preserve existing input evidence; choose a new gate directory for retries.'}
|
|
Push-Location -LiteralPath $taskWorkspace
|
|
try {
|
|
$taskBase=git rev-parse HEAD
|
|
if($LASTEXITCODE -ne 0 -or $taskBase -cne $taskPin){throw 'Wrong source commit.'}
|
|
$taskPaths=@('Cargo.toml','Cargo.lock')+@(rg --files crates docs examples build harness/fixtures harness/experiments/textual-authoring-20260911)
|
|
if($LASTEXITCODE -ne 0){throw 'Input enumeration failed.'}
|
|
$taskPaths=@($taskPaths | ForEach-Object { $_.Replace('\','/') } | Sort-Object -Unique)
|
|
$taskEntries=@($taskPaths | ForEach-Object { $item=Get-Item -LiteralPath $_; [ordered]@{path=$_;bytes=$item.Length;sha256=(Get-FileHash -Algorithm SHA256 -LiteralPath $_).Hash.ToLowerInvariant()} })
|
|
if($taskEntries.Count -ne 584){throw 'Expected exactly 584 frozen inputs.'}
|
|
$taskRecord=[ordered]@{capturedUtc=[DateTime]::UtcNow.ToString('o');workspace=$taskWorkspace;base=$taskBase;branch=(git branch --show-current);count=$taskEntries.Count;files=$taskEntries}
|
|
$taskRecord | ConvertTo-Json -Depth 6 | Set-Content -LiteralPath $taskOutput -Encoding utf8
|
|
if($Stage -ne 'before'){
|
|
$baseline=Get-Content -Raw -LiteralPath (Join-Path $PSScriptRoot 'inputs-complete-before.json') | ConvertFrom-Json
|
|
if($baseline.base -cne $taskPin -or $baseline.count -ne 584){throw 'Wrong baseline binding.'}
|
|
$expected=@{}
|
|
foreach($f in $baseline.files){if($expected.ContainsKey($f.path)){throw 'Duplicate baseline input.'};$expected[$f.path]=$f}
|
|
foreach($f in $taskEntries){if(-not $expected.ContainsKey($f.path)){throw 'Unexpected input.'};$old=$expected[$f.path];if($f.bytes -ne $old.bytes -or $f.sha256 -cne $old.sha256){throw ('Input changed: '+$f.path)};$expected.Remove($f.path)}
|
|
if($expected.Count){throw 'Missing input.'}
|
|
}
|
|
Write-Output ('Captured and verified 584 inputs: '+$Stage)
|
|
}finally{Pop-Location}
|