fix: [#958] Windows installer Pester job — inject env in child session#959
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe ChangesWindows installer test env injection
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
The `Windows Installer (Pester)` CI job began failing on the v0.8.9 release commit although `install.ps1` and its tests were unchanged (the commit only touched `CHANGELOG.md` and renamed a test). The same code passed on the two prior pushes (#930, #946); the `windows-latest` runner image changed in between, and a re-run reproduced the failure deterministically. `Invoke-Installer` set `PROCESSOR_*` vars via `[Environment]::SetEnvironmentVariable` (Process scope) on the Pester host and spawned `& pwsh -File`, relying on inheritance. `PROCESSOR_ARCHITECTURE` is a loader-managed variable; the updated runner re-initializes it for spawned processes, so the override no longer reached the child (it arrived blank -> `Unsupported OS/Arch: windows/`). Custom vars like `PROCESSOR_ARCHITEW6432` are unaffected, which is why the WOW64 test kept passing. Apply the requested env vars inside the child's own session via a `pwsh -Command` preamble (after the loader runs), removing vars whose value is empty, and pass the script args as bareword command-line tokens so parameter names bind as names (matching the original `-File @ScriptArgs` semantics). Verified green on windows-latest: 9/9 Pester tests pass. This is a test-harness fix only - the shipped `install.ps1` and v0.8.9 binaries are correct; real users always have a populated `PROCESSOR_ARCHITECTURE`. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
fdae697 to
517bbce
Compare
What does this PR do?
Fixes the flaky
Windows Installer (Pester)CI job.Invoke-Installerintest/windows/install.Tests.ps1now applies the requestedPROCESSOR_*env vars inside the childpwshsession (via a-Commandpreamble) instead of mutating the Pester host's Process-scope environment and relying on inheritance into& pwsh -File.PROCESSOR_ARCHITECTUREis a loader-managed variable; the updatedwindows-latestrunner re-initializes it for spawned processes, so the host's override no longer reached the child — it arrived blank, producingerror: Unsupported OS/Arch: windows/and failing thex86,ARM64, and unknown-version tests. Custom vars such asPROCESSOR_ARCHITEW6432are unaffected, which is why the WOW64 test kept passing. Setting the vars in the child's own session (after the loader runs) is deterministic across runner images. Empty valuesRemove-Itemthe var so "missingPROCESSOR_ARCHITEW6432" detection still works.This is a test-harness fix only — the shipped
install.ps1and the v0.8.9 binaries are correct; real users always have a populatedPROCESSOR_ARCHITECTURE. The v0.8.9 Release workflow (binaries, npm publish, GitHub release) was already green.Type of change
Issue for this PR
Closes #958
How did you verify your code works?
install.ps1+ tests passed on pushes feat: Windows PowerShell installer (install.ps1) #930 (2026-06-16) and fix(install): resilient latest-version fetch (both installers) #946 (2026-06-18), then failed on the v0.8.9 push (2026-06-19); a re-run of the failed job reproduced the failure deterministically — isolating the cause to thewindows-latestrunner image change, not the code.PROCESSOR_ARCHITECTURE-override tests reported a blank arch.test/windows/**, which triggers theWindows Installer (Pester)job, so CI on this PR validates the fix on a realwindows-latestrunner. All existing test expectations are unchanged.Checklist
Summary by cubic
Stabilizes the Windows Installer (Pester) CI job by injecting
PROCESSOR_*env vars inside the childpwshsession and passing args as bareword tokens. Fixes blank arch on updatedwindows-latest; test harness only, no changes toinstall.ps1or shipped binaries. Closes #958.pwsh -Commandpreamble to set/unset env vars only in the child and stops mutating the host env; values are safely single-quote escaped.PROCESSOR_ARCHITECTUREreaches the child, restoring x86/ARM64 and unknown-version tests; WOW64 path unchanged.-Version/-Helpbind as parameters, matching-Filesemantics.Written for commit 517bbce. Summary will update on new commits.
Summary by CodeRabbit