fix(01): WR-02 recover interrupted Windows runs without invented clocks
This commit is contained in:
1 parent
548c97aa58
commit
2608517c37
5 files changed
+86
-2
No files matched your search
@@ -177,6 +177,37 @@ try {
|
||||
Assert-True ($saved.status -eq $state -and $saved.artifacts.Count -eq 1 -and $saved.events -is [array] -and $saved.events.Count -eq 0 -and $saved.acceptance.state -eq 'open') 'Terminal fixture changed'
|
||||
}
|
||||
}
|
||||
Check 'incomplete-only interrupted recovery preserves launch bytes and absent end clocks' {
|
||||
$script:SessionId = 'fixture-interrupted'
|
||||
$interruptedRun = Join-Path $bundleRoot ('results/' + $SessionId)
|
||||
$null = [IO.Directory]::CreateDirectory($interruptedRun)
|
||||
$initial = New-FidelityReceipt $SessionId 'fresh-natural-ordinary' 'continuous' 'synthetic' 'incomplete' @{os='test';execution='synthetic'} $clock 'Interrupted synthetic collector'
|
||||
Write-FidelityJson (Join-Path $interruptedRun 'incomplete.json') $initial
|
||||
$before = Get-FidelityIdentity (Join-Path $interruptedRun 'incomplete.json')
|
||||
$script:AnnotationPath = Join-Path $temporary 'interrupted-notes.json'
|
||||
Write-FidelityJson $AnnotationPath @{schema_version=1;artifacts=@(@{path='raw.mkv';role='video';duration_seconds=2});events=@();derivatives=@();limitations=@('Recovered synthetic media only')}
|
||||
$script:Reason = 'Interrupted before final collector state'
|
||||
$script:Outcome = 'captured'
|
||||
Assert-Throws { Complete-FidelityRun }
|
||||
Assert-True (-not (Test-Path -LiteralPath (Join-Path $interruptedRun 'receipt.json'))) 'Interrupted record promoted'
|
||||
$script:Outcome = 'aborted'
|
||||
[IO.File]::Delete($AnnotationPath)
|
||||
Write-FidelityJson $AnnotationPath @{schema_version=1;artifacts=@();events=@(@{name='invented';artifact='raw.mkv';elapsed_seconds=1});derivatives=@();limitations=@()}
|
||||
Assert-Throws { Complete-FidelityRun }
|
||||
Assert-True (-not (Test-Path -LiteralPath (Join-Path $interruptedRun 'recovery-initial.json'))) 'Invalid recovery wrote evidence'
|
||||
[IO.File]::Delete($AnnotationPath)
|
||||
Write-FidelityJson $AnnotationPath @{schema_version=1;artifacts=@(@{path='raw.mkv';role='video';duration_seconds=2});events=@();derivatives=@();limitations=@('Recovered synthetic media only')}
|
||||
Complete-FidelityRun
|
||||
$saved = Read-FidelityJson (Join-Path $interruptedRun 'receipt.json')
|
||||
Assert-True ($saved.status -eq 'aborted' -and $saved.acceptance.state -eq 'open' -and $saved.session_id -ceq $SessionId) 'Recovery changed launch/status'
|
||||
Assert-True ($saved.clocks.PSObject.Properties.Name -notcontains 'wall_end' -and $saved.clocks.PSObject.Properties.Name -notcontains 'monotonic_end') 'Recovery invented end clocks'
|
||||
$rawInitial = Read-FidelityJson (Join-Path $interruptedRun 'incomplete.json')
|
||||
Assert-True ($saved.clocks.wall_start -eq $rawInitial.clocks.wall_start -and $saved.clocks.monotonic_start -eq $rawInitial.clocks.monotonic_start) 'Recovery changed initial clocks'
|
||||
Assert-True ((Get-FidelityIdentity (Join-Path $interruptedRun 'incomplete.json')).sha256 -eq $before.sha256) 'Recovery changed raw initial bytes'
|
||||
Assert-True ($saved.artifacts[0].path -eq 'recovery-initial.json' -and $saved.artifacts[0].sha256 -eq $before.sha256) 'Missing raw initial identity'
|
||||
Assert-True (Test-Path -LiteralPath (Join-Path $interruptedRun 'media/raw.mkv')) 'Missing recovered media'
|
||||
Assert-Throws { Complete-FidelityRun }
|
||||
}
|
||||
if ($FixtureOutput) {
|
||||
if (Test-Path -LiteralPath $FixtureOutput) { throw 'Fixture output must be new' }
|
||||
$null = [IO.Directory]::CreateDirectory($FixtureOutput)
|
||||
|
||||
Reference in new issue
Block a user