From de3018512aacaf915635c56531170beebfad29e4 Mon Sep 17 00:00:00 2001 From: cproudlock Date: Fri, 22 May 2026 14:09:10 -0400 Subject: [PATCH] 09-Setup-WaxAndTrace: fix broken-filename detection (Get-ChildItem -Filter) The direct-copy bypass added earlier was never firing - Get-ChildItem -Filter uses Win32 filename filtering and does NOT honor PowerShell wildcards or character classes. The previous detection filter '*[0-9] _*.txt' matched literal bracket-zero-through-nine text, which never appears in any filename. $hasBrokenFilenames was therefore always False, and every 218-378-13 series cal apply fell through to the vendor setup.exe which crashes with System.ArgumentException (exit -532462766). Confirmed via debug-waxtrace-cal.ps1 log on WJF00159: section 6 reports the on-disk script has the direct-copy fix, section 7 shows the actual runtime log line 'running cal Setup.exe' followed by exit -532462766. The "fix" was never executing because the gate was broken. Replace -Filter with Get-ChildItem -File + Where-Object regex match on ' _\d+\.txt$' which catches the actual buggy filename pattern (space- underscore-digits-.txt at end of name) regardless of probe series. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../gea-shopfloor-waxtrace/09-Setup-WaxAndTrace.ps1 | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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 9112367..1421444 100644 --- a/playbook/shopfloor-setup/gea-shopfloor-waxtrace/09-Setup-WaxAndTrace.ps1 +++ b/playbook/shopfloor-setup/gea-shopfloor-waxtrace/09-Setup-WaxAndTrace.ps1 @@ -195,7 +195,15 @@ if (-not $asset) { $hasBrokenFilenames = $false if (Test-Path -LiteralPath $srcDataDir) { - $hasBrokenFilenames = [bool](Get-ChildItem -LiteralPath $srcDataDir -Filter '*[0-9] _*.txt' -ErrorAction SilentlyContinue | Select-Object -First 1) + # Get-ChildItem -Filter uses Win32 filtering and does NOT + # honor PowerShell wildcards / character classes - '[0-9]' + # would match literal bracketed text. Use -Include + + # Where-Object regex instead. The bug signature is + # ' _' (space-underscore) inside the filename, e.g. + # 'Linear_X_218-378-13 _100072210.txt'. + $hasBrokenFilenames = [bool](Get-ChildItem -LiteralPath $srcDataDir -File -ErrorAction SilentlyContinue | + Where-Object { $_.Name -match ' _\d+\.txt$' } | + Select-Object -First 1) } if ($hasBrokenFilenames) {