Bind empty-profile receipts to the file ID recorded before publication
Rust development slice / linux (push) Failing after 6s

This commit is contained in:
2026-11-15 20:37:49 +01:00
parent b614b6f5be
commit e7cf1aed73
2 changed files with 37 additions and 8 deletions
@@ -1,13 +1,13 @@
#requires -Version 5.1
#requires -RunAsAdministrator
# The relay receives a fixed public receipt. There is no command reader.
param([Parameter(Mandatory)][DateTimeOffset]$Until)
param([Parameter(Mandatory)][DateTimeOffset]$Until, [switch]$ResumeEmpty)
$ErrorActionPreference = 'Stop'
$deadline = [DateTimeOffset]::UtcNow.AddMinutes(12)
if ($deadline -gt $until) { $deadline = $until }
if ($deadline -le [DateTimeOffset]::UtcNow) { throw 'Das Wartungsfenster ist abgelaufen.' }
$base = 'https://gitea.incoso.eu/kevin_janssen/rust-discovery/raw/commit/38e6df51ea57a76ec2d5462513d59e855f36c0f4/deploy/windows'
$base = 'https://gitea.incoso.eu/kevin_janssen/rust-discovery/raw/commit/b614b6f5be9d700eef20586a038aa9643356049a/deploy/windows'
$bootstrap = 'C:\ProgramData\RustDiscoveryBootstrap'
$caseId = 'ad9fd154-b2be-4f5d-9e17-65abb721ceaf'
$case = Join-Path $bootstrap "time-profile-$caseId"
@@ -24,7 +24,7 @@ $null = New-Item -ItemType Directory -Path $work
$listener = $null
$ssh = $null
$scripts = [ordered]@{
'Complete-OriginalTimeProfile.ps1' = 'c2fb92ebd0f4ab19545b55ad92d7a9b21ec6e3604d33107d0dd78882162be131'
'Complete-OriginalTimeProfile.ps1' = 'aacc56321dccc6efe496a782d4cf67defba5b0be6759cba08d9e0b775913210b'
'Read-PassiveTimeSamples.ps1' = 'd9e2b9344c19af1296b86ec70ba754ef820f369ac5ec897979bd4233e0722d04'
}
try {
@@ -45,17 +45,25 @@ try {
$ssh = Start-Process -FilePath "$sshBin\ssh.exe" -ArgumentList $options -PassThru -NoNewWindow
if ($ssh.WaitForExit(1800)) { throw "SSH Exit $($ssh.ExitCode)" }
Write-Host 'Wartungsfenster aktiv. Dieses Fenster offen lassen. Strg+C beendet es.'
$receipt = [ordered]@{session=$session; case_id=$caseId; method='initial_create'; phase='preflight'; read_only_channel=$true}
$result = Join-Path $case 'console-initial-create-result.json'
$intentPath = Join-Path $case 'console-initial-create-intent.json'
$failurePath = Join-Path $case 'console-initial-create-error.json'
$method = 'initial_create'
$prefix = 'console-initial-create'
$arguments = @{ InitialCreate=$true }
if ($ResumeEmpty) {
$method = 'resume_empty'
$prefix = 'console-resume-empty'
$arguments = @{ ResumeEmpty=$true }
}
$receipt = [ordered]@{session=$session; case_id=$caseId; method=$method; phase='preflight'; read_only_channel=$true}
$result = Join-Path $case "$prefix-result.json"
$intentPath = Join-Path $case "$prefix-intent.json"
$failurePath = Join-Path $case "$prefix-error.json"
$receipt.finalizer_invoked = $false
try {
if (Test-Path -LiteralPath $failurePath) { throw 'Previous profile finalization error recorded' }
if (!(Test-Path -LiteralPath $result)) {
if (Test-Path -LiteralPath $intentPath) { throw 'Previous profile finalization intent without result' }
$receipt.finalizer_invoked = $true
$null = & (Join-Path $work 'Complete-OriginalTimeProfile.ps1') -InitialCreate
$null = & (Join-Path $work 'Complete-OriginalTimeProfile.ps1') @arguments
}
$record = Get-Content -LiteralPath $result -Raw | ConvertFrom-Json
$actual = Get-FileHash -LiteralPath 'C:\ProgramData\RustDiscoverySystem\time-attestation.json'
@@ -68,6 +76,13 @@ try {
$marker.config_sha256 -ne $actual.Hash -or $record.configuration.sha256 -ne $actual.Hash -or
$record.original_candidate.file_id -cne '6d990300000003000000000000000000' -or
$record.configuration.file_id -cnotmatch '^[0-9a-f]{32}$' -or $record.configuration.file_id -ceq '6d990300000003000000000000000000') { throw 'Unexpected finalization intent' }
if ($ResumeEmpty) {
if ($record.resumed_empty -ne $true -or $marker.target_id -cne $record.configuration.file_id) {
throw 'Recovered profile file identity differs from the recovery intent'
}
$receipt.resumed_empty = $true
$receipt.reserved_target_id = $marker.target_id
}
$receipt.phase = 'published'
$receipt.publication_since = $record.publication_since
$receipt.initial_create = $record.initial_create