Files
ARCADIA-Studio/harness/experiments/scenario-native-details-trial1-b10b28c-20260913/original/validate-timestamp.ps1
T

32 lines
2.9 KiB
PowerShell

#Requires -Version 7.0
Set-StrictMode -Version Latest
$ErrorActionPreference='Stop'
. (Join-Path $PSScriptRoot 'verify.ps1')
$stagePath=Join-Path $PSScriptRoot 'stage.ps1'
$tokens=$null;$errors=$null
[void][Management.Automation.Language.Parser]::ParseFile($stagePath,[ref]$tokens,[ref]$errors)
if($errors.Count){throw ($errors|Out-String)}
$stage=Get-Content -Raw -LiteralPath $stagePath
$expression='$binary.LastWriteTimeUtc.Ticks -ne ([DateTimeOffset]$build.binary.mtimeUtc).UtcDateTime.Ticks'
if(-not $stage.Contains($expression)){throw 'Exact candidate expression absent'}
$predicate=[scriptblock]::Create($expression)
$receiptPath='C:/Users/User/Documents/Git/ARCADIA-Studio/.local/scenario-validation-gates-b10b28c-20260913/build-receipt.json'
$build=Read-NativeJson $receiptPath
$binary=Get-Item -LiteralPath $build.binary.path
if($build.base -cne 'b10b28cefd1d0794073ba241a0c8de9a83e85f68' -or $build.cargoExitCode -ne 0 -or $binary.Length -ne 116721152 -or (Get-NativeHash $binary.FullName) -cne '7ece85c6012ae0ae75fc56ed3c3aadb8bc116448ad1782be422ef34a629dc3ce'){throw 'Exact actual GUI file/receipt required for this focused check'}
$actualParsedType=$build.binary.mtimeUtc.GetType().FullName
if($actualParsedType -cne 'System.DateTime'){throw 'The demonstrated parsed-DateTime precondition changed'}
if($binary.LastWriteTimeUtc.Ticks -ne 639249059530833854){throw 'Exact independent UTC-tick precondition changed'}
if(& $predicate){throw 'Actual parsed DateTime rejected'}
$parsedUtc=([DateTimeOffset]$build.binary.mtimeUtc).UtcDateTime
$json=[Text.Json.JsonDocument]::Parse([string](Get-Content -Raw -LiteralPath $receiptPath))
try{$rawIso=$json.RootElement.GetProperty('binary').GetProperty('mtimeUtc').GetString()}finally{$json.Dispose()}
if($rawIso -cne '2026-09-13T14:19:13.0833854Z'){throw 'Actual independent raw ISO precondition changed'}
$build.binary.mtimeUtc=$rawIso
if(& $predicate){throw 'Equivalent raw ISO rejected'}
$build.binary.mtimeUtc=$parsedUtc.AddTicks(1)
if(-not (& $predicate)){throw 'One-tick parsed DateTime mismatch admitted'}
$build.binary.mtimeUtc=$parsedUtc.AddTicks(1).ToString('o')
if(-not (& $predicate)){throw 'One-tick raw ISO mismatch admitted'}
[ordered]@{status='passed';scope='AST and exact timestamp predicate with actual closed GUI receipt/file; no stage, launch or executable invocation';source_commit='b10b28cefd1d0794073ba241a0c8de9a83e85f68';parsed_type=$actualParsedType;raw_iso=$rawIso;expected_ticks='639249059530833854';cases=@('actual_parsed_datetime_accepts','actual_raw_iso_accepts','one_tick_datetime_rejected','one_tick_iso_rejected');stage_sha256=(Get-NativeHash $stagePath);verify_sha256=(Get-NativeHash (Join-Path $PSScriptRoot 'verify.ps1'));receipt_sha256=(Get-NativeHash $receiptPath);binary_bytes=$binary.Length;binary_sha256=(Get-NativeHash $binary.FullName);stage_executed=$false;launch_executed=$false;compiler_executed=$false}|ConvertTo-Json -Depth 8