Wax/Trace: prefer backup ZIP over cal ISO when both exist

Standardize the calibration source. Step 3b already restores a per-asset
backup ZIP (HKLM + data + config, incl. the probe cal tables) for any bay
that has one - which is now every migrated bay. When that ZIP is staged,
skip the redundant and fragile cal-ISO mount/vendor-Setup step so all
bays follow one flow (app ISO + backup restore), matching the bays that
never had a cal ISO. A future bay with a cal ISO but no backup still
falls through to the ISO path unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
cproudlock
2026-06-08 17:13:03 -04:00
parent a935c04e1f
commit da380fbcd7

View File

@@ -224,9 +224,24 @@ if (Test-Path -LiteralPath $mnPath) {
if (-not $asset) {
Write-WTLog "machine-number.txt missing or empty - skipping calibration apply" 'WARN'
} else {
# Consistency: a per-asset backup ZIP (restored in Step 3b with HKLM + data
# + config, including the probe cal tables) is the single authoritative cal
# source. When one is staged - true for every migrated bay - skip the
# redundant, fragile cal-ISO mount/vendor-Setup path so all bays follow one
# flow (app ISO + backup restore), same as bays that never had a cal ISO.
# A future bay with a cal ISO but no backup still falls through to the ISO.
$haveBackup = @('C:\WaxTrace-Install\backups','C:\WaxTrace-Install\backup') |
Where-Object { Test-Path -LiteralPath $_ } |
ForEach-Object { Get-ChildItem -LiteralPath $_ -Filter "${asset}*.zip" -File -ErrorAction SilentlyContinue } |
Select-Object -First 1
$calDir = Join-Path $stagingRoot 'calibrations'
$candidate = $null
if (-not $haveBackup) {
$candidate = Get-ChildItem $calDir -Filter "CAL-${asset}_*.iso" -ErrorAction SilentlyContinue | Select-Object -First 1
if (-not $candidate) {
}
if ($haveBackup) {
Write-WTLog "Per-asset backup ZIP present ($($haveBackup.Name)) - skipping cal ISO; calibration restored from backup (Step 3b)"
} elseif (-not $candidate) {
Write-WTLog "No cal ISO matched CAL-${asset}_*.iso in $calDir - skipping" 'WARN'
} else {
Write-WTLog "Mounting cal ISO: $($candidate.FullName)"