What
downloadReleaseBinary can return a path to a binary that was never extracted, instead of raising.
The Windows extraction path runs:
powershell -NoProfile -Command "Expand-Archive ..."
Expand-Archive's error on a corrupt archive is non-terminating, so PowerShell exits 0. The exit-code check in binary-upgrade.ts therefore passes, and the function proceeds to return the expected output path — which does not exist, or holds stale content from a previous install.
Impact
A corrupted or truncated download surfaces as a confusing downstream failure (a missing or stale binary) rather than as an extraction error at the point it happened. The catch intended to report it is effectively dead in practice.
How it was found
Discovered while covering binary-upgrade.ts for #522 phase 3. Verified by running the exact production command against a deliberately corrupt archive and observing exit code 0. Covering the surrounding branch in tests required stubbing the spawn, which is what made the dead path visible.
Suggested fix
Add -ErrorAction Stop to the Expand-Archive invocation (promoting the non-terminating error to terminating so PowerShell exits non-zero), and/or verify the expected output file exists before returning. A regression test should assert that a corrupt archive raises rather than returning a path.
Found during #522 phase 3 (#553).
What
downloadReleaseBinarycan return a path to a binary that was never extracted, instead of raising.The Windows extraction path runs:
Expand-Archive's error on a corrupt archive is non-terminating, so PowerShell exits0. The exit-code check inbinary-upgrade.tstherefore passes, and the function proceeds to return the expected output path — which does not exist, or holds stale content from a previous install.Impact
A corrupted or truncated download surfaces as a confusing downstream failure (a missing or stale binary) rather than as an extraction error at the point it happened. The
catchintended to report it is effectively dead in practice.How it was found
Discovered while covering
binary-upgrade.tsfor #522 phase 3. Verified by running the exact production command against a deliberately corrupt archive and observing exit code0. Covering the surrounding branch in tests required stubbing the spawn, which is what made the dead path visible.Suggested fix
Add
-ErrorAction Stopto theExpand-Archiveinvocation (promoting the non-terminating error to terminating so PowerShell exits non-zero), and/or verify the expected output file exists before returning. A regression test should assert that a corrupt archive raises rather than returning a path.Found during #522 phase 3 (#553).