From da380fbcd70ba632c3137774bf00a88139b7fdd9 Mon Sep 17 00:00:00 2001 From: cproudlock Date: Mon, 8 Jun 2026 17:13:03 -0400 Subject: [PATCH] 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) --- .../09-Setup-WaxAndTrace.ps1 | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/playbook/shopfloor-setup/gea-shopfloor-waxtrace/09-Setup-WaxAndTrace.ps1 b/playbook/shopfloor-setup/gea-shopfloor-waxtrace/09-Setup-WaxAndTrace.ps1 index be7fe63..5b419b4 100644 --- a/playbook/shopfloor-setup/gea-shopfloor-waxtrace/09-Setup-WaxAndTrace.ps1 +++ b/playbook/shopfloor-setup/gea-shopfloor-waxtrace/09-Setup-WaxAndTrace.ps1 @@ -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 = Get-ChildItem $calDir -Filter "CAL-${asset}_*.iso" -ErrorAction SilentlyContinue | Select-Object -First 1 - if (-not $candidate) { + $candidate = $null + if (-not $haveBackup) { + $candidate = Get-ChildItem $calDir -Filter "CAL-${asset}_*.iso" -ErrorAction SilentlyContinue | Select-Object -First 1 + } + 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)"