Repository navigation
Define everything Refresh-Environment calls before the PSModulePath test runs it - #11194
Conversation
…est runs it
The behavioural leg extracts Refresh-Environment from studio/setup.ps1 and invokes it. It
now calls Test-ActiveCondaEnvironment, which the test never defines, so on Windows the run
dies with 'The term Test-ActiveCondaEnvironment is not recognized' and the whole file exits
1 without reaching its assertion.
It passes on Linux for a reason that hides the defect: GetEnvironmentVariables('Machine')
is empty off Windows, so the body returns before it gets that far. Windows is the only host
where this leg does anything, which makes it the only host where a missing helper shows up.
The closure is computed from the AST rather than listed, so a helper added to
Refresh-Environment later is pulled in automatically instead of breaking one Windows lane.
Whole-line comments are dropped before scanning, since a function named in prose is not a
call. It currently resolves to Test-ActiveCondaEnvironment, Get-ActiveCondaPrefixes and
Test-PathUnderCondaPrefix, and a check fails if it resolves to nothing at all.
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Swish! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review |
|
@codex security review |
|
Codex Review: Didn't find any major issues. 👍 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
🛡️ Codex Security ReviewSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
…est runs it (unslothai#11194) * Define everything Refresh-Environment calls before the PSModulePath test runs it The behavioural leg extracts Refresh-Environment from studio/setup.ps1 and invokes it. It now calls Test-ActiveCondaEnvironment, which the test never defines, so on Windows the run dies with 'The term Test-ActiveCondaEnvironment is not recognized' and the whole file exits 1 without reaching its assertion. It passes on Linux for a reason that hides the defect: GetEnvironmentVariables('Machine') is empty off Windows, so the body returns before it gets that far. Windows is the only host where this leg does anything, which makes it the only host where a missing helper shows up. The closure is computed from the AST rather than listed, so a helper added to Refresh-Environment later is pulled in automatically instead of breaking one Windows lane. Whole-line comments are dropped before scanning, since a function named in prose is not a call. It currently resolves to Test-ActiveCondaEnvironment, Get-ActiveCondaPrefixes and Test-PathUnderCondaPrefix, and a check fails if it resolves to nothing at all. * Tighten the comments on the PSModulePath closure
tests/studio/test_psmodulepath_normalization.ps1fails on every Windows runner and has done sinceRefresh-Environmentgrew a conda guard.What happens
The behavioural leg extracts
Refresh-Environmentfromstudio/setup.ps1and invokes it. That function now callsTest-ActiveCondaEnvironment, which the test never defines, so the run dies before its assertion:The whole file exits 1, which takes the
PSModulePath normalization unit testsstep ofstudio-windows-update-smoke.ymlwith it.Why it passes on Linux
GetEnvironmentVariables('Machine')is empty off Windows, so the body returns before reaching that branch. Windows is the only host where this leg does anything, which makes it the only host where a missing helper can show up. The Linux lane has been green over a broken test.The fix
Compute the closure of functions
Refresh-Environmentreaches, from the AST, and define all of them before invoking it. A helper added toRefresh-Environmentlater is then pulled in automatically rather than breaking one Windows lane weeks after the fact.Whole-line comments are dropped before scanning, since a function named in prose is not a call and pulling it in would grow the closure to satisfy a mention rather than a dependency. That is the same rule
tests/python/test_windows_installer_concurrency_guard.pyapplies to its own extraction check.Today the closure resolves to
Test-ActiveCondaEnvironment,Get-ActiveCondaPrefixesandTest-PathUnderCondaPrefix. A check fails if it ever resolves to nothing at all, so the mechanism cannot quietly become a no-op.No production code changes.