Skip to content

fix(install): qualify Windows archive extraction - #652

Merged
zimeg merged 5 commits into
slackapi:mainfrom
codywilliamson:codex/fix-windows-expand-archive
Aug 28, 2026
Merged

fix(install): qualify Windows archive extraction#652
zimeg merged 5 commits into
slackapi:mainfrom
codywilliamson:codex/fix-windows-expand-archive

Conversation

@codywilliamson

Copy link
Copy Markdown
Contributor

Changelog

The Windows installer now extracts the CLI reliably when another PowerShell module defines Expand-Archive.

Summary

PowerShell resolves an unqualified command name before binding its parameters. When Pscx 3.3.2 is loaded, the installer selects Pscx's Expand-Archive, which does not accept -DestinationPath; the ZIP downloads successfully, but extraction and the PATH update never happen. Both release and development installers now address Microsoft.PowerShell.Archive explicitly.

Fixes #651.

The regression test is the part worth the closest review. It keeps the change dependency-free: it parses both mirrored installers to require the qualified command, then performs a real extraction while a same-named function shadows unqualified command resolution.

Testing

pwsh -NoProfile -File ./scripts/install-windows-test.ps1
powershell.exe -NoProfile -NonInteractive -ExecutionPolicy Bypass -File ./scripts/install-windows-test.ps1

Both commands pass locally. go test ./... was also attempted with the repository-requested Go 1.26.6 toolchain on Windows/386, but unrelated command packages simultaneously reached the suite's 11-minute watchdog. The pull request's macOS Go suite remains the authoritative repository-wide check.

Notes

The CLI runtime and non-Windows installers are unchanged. The added Windows job runs only the focused, Pester-free installer regression.

Requirements

Use the Microsoft.PowerShell.Archive cmdlet explicitly so modules such as Pscx cannot shadow the installer extraction command. Add a focused Windows regression test for both installer variants.\n\nFixes slackapi#651.
@codywilliamson
codywilliamson requested a review from a team as a code owner August 27, 2026 21:02
@salesforce-cla salesforce-cla Bot added the cla:missing The CLA was not signed label Aug 27, 2026
@salesforce-cla

Copy link
Copy Markdown

Thanks for the contribution! Before we can merge this, we need @codywilliamson to sign the Salesforce Inc. Contributor License Agreement.

@zimeg zimeg closed this Aug 28, 2026
@zimeg zimeg reopened this Aug 28, 2026
@salesforce-cla salesforce-cla Bot added cla:signed The CLA was signed by the pull request author and removed cla:missing The CLA was not signed labels Aug 28, 2026
@zimeg zimeg added bug M-T: confirmed bug report. Issues are confirmed when the reproduction steps are documented semver:patch Use on pull requests to describe the release version increment labels Aug 28, 2026
@zimeg zimeg added this to the Next Release milestone Aug 28, 2026

@zimeg zimeg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@codywilliamson Super appreciate this changeset landing here! I'm finding it continues to work as we hope and the tests are nice to confirm this.

Before merging I'm hoping to make a few small changes to tests and CI so we can keep this confidence high 🏆


delay 0.3 "Extracting the executable to:`n $slack_cli_new_binary_path"
Expand-Archive "$($slack_cli_dir)\slack_cli.zip" -DestinationPath "$($slack_cli_dir)" -Force
Microsoft.PowerShell.Archive\Expand-Archive "$($slack_cli_dir)\slack_cli.zip" -DestinationPath "$($slack_cli_dir)" -Force

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🌟 praise: Thanks for making this step more stable!

The prior Windows test only lint-checked the AST for the qualified
Expand-Archive call, then exercised a re-implemented extraction snippet
that shadowed a *function* named Expand-Archive — it never ran the
installer, so it could not catch the module-command shadow that slackapi#651
actually hit (Pscx's Expand-Archive winning unqualified resolution).

Rework it to mirror the Unix install-test.sh pattern: for each Windows
installer (release + dev), keep the AST guard, then actually invoke the
installer and assert the aliased binary lands and reports a version.

Move install tests out of the macOS-only lint-test job into a dedicated
install-tests job with an OS matrix (macos/ubuntu/windows) so all three
platforms' installers are exercised on every PR. Unix runs
make test-install; Windows runs the reworked script.

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
@codecov

codecov Bot commented Aug 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.58%. Comparing base (2f62b9c) to head (65b47ca).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #652      +/-   ##
==========================================
+ Coverage   72.55%   72.58%   +0.02%     
==========================================
  Files         239      239              
  Lines       20229    20229              
==========================================
+ Hits        14677    14683       +6     
+ Misses       4277     4274       -3     
+ Partials     1275     1272       -3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

zimeg and others added 3 commits August 28, 2026 13:41
The Windows install test's real end-to-end run hangs in CI: after
extraction, install-windows.ps1's post-install courtesy check runs
`& slack _fingerprint | Tee-Object -Variable | Out-Null`, which blocks
under pwsh 7 on current Windows runner images (a native-command pipeline
with no console never returns). Confirmed against two CI runs -- a cold
install hung for 12 min then cancelled, while an older-image run of the
same installer completed -- so the hang tracks the runner image/pwsh
build, not this branch's change, and is independent of the install alias.

Revert the Windows leg to a static AST guard: parse each installer and
assert it calls Microsoft.PowerShell.Archive\Expand-Archive exactly once
(the slackapi#651 fix). This verifies the regression is present without running
the installer, so the check is fast and can't hang. The installer's
_fingerprint hang is a real pre-existing bug tracked separately.

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Per review on slackapi#652: the guard checked `Count -ne 1`, which breaks the
moment an installer legitimately extracts more than once and points its
error at the count rather than the qualification. Invert it to the actual
invariant -- every *Expand-Archive command must be the qualified
Microsoft.PowerShell.Archive\Expand-Archive form, and at least one must
exist so a removed extraction can't pass vacuously.

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Drop the two explanatory comment blocks; keep the issue reference as a
trailing comment on the $qualifiedCommand line. Logic unchanged.

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
@zimeg

zimeg commented Aug 28, 2026

Copy link
Copy Markdown
Member

@codywilliamson Thanks once more for sending this in! I'm hoping in follow up changes we can strengthen CI coverage of this installation script but for now let's fix this issue so I will merge the PR.

@zimeg
zimeg merged commit 69846ee into slackapi:main Aug 28, 2026
10 checks passed
@codywilliamson
codywilliamson deleted the codex/fix-windows-expand-archive branch August 28, 2026 21:17
@zimeg zimeg added the changelog Use on updates to be included in the release notes label Aug 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug M-T: confirmed bug report. Issues are confirmed when the reproduction steps are documented changelog Use on updates to be included in the release notes cla:signed The CLA was signed by the pull request author semver:patch Use on pull requests to describe the release version increment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows installer fails when Pscx shadows Expand-Archive

2 participants