Skip to content

DEV-8216: fix Windows MSI build — extract Node runtime via .NET ZipFile - #93

Draft
ariel-greenfeld wants to merge 2 commits into
mainfrom
dev-8216-xyte-cli-ci-windows-installer-package-fails
Draft

ariel-greenfeld wants to merge 2 commits into
mainfrom
dev-8216-xyte-cli-ci-windows-installer-package-fails

Conversation

@ariel-greenfeld

Copy link
Copy Markdown
Contributor

Linear: DEV-8216

What

windows-installer-package is red on main and on every PR. scripts/package_windows_msi.mjs extracted the Node.js Windows zip with powershell.exe -Command Expand-Archive. The CI step runs under pwsh 7, so Windows PowerShell 5.1 inherits pwsh 7's PSModulePath, loads pwsh 7's Archive module and fails with Cannot find an overload for "ExtractToDirectory" and the argument count: "3". powershell.exe still exits 0, and the build then dies on ENOENT … node.exe.

This PR cherry-picks Boris's fix from #90 (600202a): extract with [System.IO.Compression.ZipFile]::ExtractToDirectory under $ErrorActionPreference = 'Stop', so a failed extract now fails the extract step. It is a separate PR so it can land before the v0.17.0 tag; #90 conflicts with main.

Release impact

  • npm publish (publish.yml) does not run this script and is not affected.
  • release-assets.yml → windows-msi runs this script on the tag checkout. Without this fix in the tagged commit, the release gets no MSI / WinGet assets, and a force_windows_msi re-run cannot fix it. Order: merge this → update release-0.17.0 (Release 0.17.0 #92) from main → tag.

Tests

  • The PR's own windows-installer-package job (build, install, PATH and PS 5.1 smoke) — the only place the win32 path runs. The same change was green on DEV-8096: GET organization device details history (hub #9871) #90 (run 45209970966).
  • Local: node --check scripts/package_windows_msi.mjs, npx vitest run tests/windows-packaging.test.ts (8/8).

Decided for you

  • Own PR from the proven commit — instead of waiting for DEV-8096: GET organization device details history (hub #9871) #90 (conflicting, feature PR).
  • .NET ZipFile in powershell.exe — instead of tar.exe / pwsh / resetting PSModulePath (unproven on the runner, tag is tomorrow).
  • No new unit test — a mocked test could only assert a command string; the CI job builds and installs the real MSI.
  • security job left alone — green on main now, 0 high advisories on main's lockfile.

🤖 Generated with Claude Code

@xyte-genie xyte-genie left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

AI: The Windows installer build has been failing on main and on every pull request because the step that unpacks the bundled Node runtime silently reported success while doing nothing. This change unpacks the runtime through a built-in Windows library instead, and makes a failed unpack stop the build with a clear error. It is split out as its own change so it can land before the v0.17.0 release, which otherwise would ship without Windows installer assets.

reviewed@d0c90e4d9c75f92914250e4358b23e3c9423703a

Comment thread scripts/package_windows_msi.mjs Resolved
mkdirSync(extractDir, { recursive: true });

if (process.platform === 'win32') {
// Call .NET directly: Expand-Archive in powershell.exe launched from a pwsh 7 step loads

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

AI: [Decision] Windows PowerShell launched from a pwsh 7 CI step: work around the module-path clash at this one call, not in the step

  • Situation: Every Windows PowerShell 5.1 child of a pwsh 7 CI step inherits pwsh's module path; a shared-name module then loads the wrong edition, fails, and can still exit 0.
  • Chosen: Only the Node runtime extract stops using the clashing cmdlet and calls .NET directly; the inherited environment stays as it is for the other 5.1 children in CI.
  • Alternative: Fix it once at the boundary: clear or reset the module path in the build step, or run the MSI build from a non-pwsh shell, so no 5.1 child inherits it.
  • Impact: Accepted risk: any future or sibling 5.1 call in CI that uses a module both editions ship can silently fail the same way; today's other callers use none.
  • Decided by: reviewer bot (inferred)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

AI: Acknowledged — this is a release-blocking fix for the v0.17.0 tag, so it stays at the one failing call; the other powershell.exe callers use no module that both editions ship. A step-level PSModulePath reset is a reasonable follow-up if more 5.1 calls are added.

@xyte-genie

Copy link
Copy Markdown

AI: Review lenses for d0c90e4

Lens Status Why
correctness ran A single PowerShell command string is rebuilt by hand with interpolated paths; quoting, overload choice and exit-code propagation decide whether the fix actually works and actually fails loudly.
decisions ran The PR body has a 'Decided for you' section: separate PR over waiting for #​90, .NET ZipFile over tar.exe/pwsh/PSModulePath reset, no new unit test, security job left alone.
security-tenancy skipped Build script only; no auth, tenancy, tokens or request params — path quoting is covered under correctness.
data-integrity skipped No writes, jobs or records; a CI packaging script.
migrations-rollout skipped No schema, flags, jobs or cache entries.
performance skipped Extracting one ~30 MB zip once per build; no hot path.
api-compat skipped No public API or CLI contract touched.
cross-repo skipped Build script internal to xyte-cli; no sibling-repo contract.
backwards-compat skipped Only behaviour change is that a failed extract now fails the build, which is the stated intent; no defaults or records affected.
errors-observability skipped The only error surface is runOrThrow's existing 'Extract Node.js Windows runtime failed with exit code N' message, unchanged; correctness checks that the exit code now propagates.
ui-ux-product skipped No web/ or user-facing screen.
accessibility-i18n skipped No UI or user-facing text.
readability skipped Nine lines, one comment that matches the PR body's explanation; nothing to name.
spec-coverage skipped Author's explicit no-unit-test decision is weighed by the decisions lens; tests/windows-packaging.test.ts never asserted the Expand-Archive string, so nothing goes stale.
docs skipped docs/windows-installer.md describes installing the MSI, not how the build extracts Node; no doc references Expand-Archive.
design skipped No new flag, column or abstraction; a one-call swap.
over-engineering skipped Diff is 10 lines.
spec-vs-ticket skipped Ticket DEV-8216 is the CI red build the PR body describes; scope is the single extract call, no room for creep beyond what decisions already weighs.
deps-infra skipped No dependency or workflow file changes; relies on System.IO.Compression.FileSystem already shipped with .NET Framework.
skills-authoring skipped No skills, agents or AGENTS.md files touched.

@xyte-genie xyte-genie added the awaiting-author Waiting on the author: the reviewer left comments to address label Nov 23, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting-author Waiting on the author: the reviewer left comments to address

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants