You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Multiple tests fail in the ReleaseAutomationTest comparison of 7.7.0-preview.1 against the 7.6.0-rc.1 baseline. They share a common theme - how MyDocuments / SHARED_MODULES / $PSHOME/Modules paths interact with elevated, service-account, and ZIP/TAR distribution sessions - but split into distinct root causes.
#
Case
Lanes
Root cause
Tracking
1
ModuleIntrinsics.GetPSModulePath API tests
All elevated Linux/macOS lanes (User variant); all elevated Windows + Linux/macOS lanes (Machine variant, test 100145)
User variant: sudo -E drops HOME; Machine variant: cross-platform PSModulePath construction regression - top suspect PR #26565
This issue (below)
2
Module-path construction tests fail on portable (ZIP/TAR) and additional lanes
All elevated lanes (Windows / Linux / macOS, portable + package-installed)
Confirmed regression vs rc.1; top suspect is PR #26565 (AddToPath -> UpdatePath rewrite) - same code path as #27346. Unrelated to #27305
This issue (below)
All cases appear as "New Failure" because the ReleaseAutomationTest comparator matches failures by test name/ID against the baseline; tests added, renamed, or running for the first time on a newly-enabled lane in release/v7.7.0-preview.1 are reported as new.
First failing build: ReleaseAutomationTest-27557-ps-671171.
Shared context: PR #27305 "Enable usage in AppContainers"
release/v7.7.0-preview.1 commit 1218a29b8 (merged to master via bec015ffc / PR #27266) changed ModuleIntrinsics.GetPersonalModulePath on Windows from:
SpecialFolderOption.None returns "" if the folder does not physically exist; DoNotVerify always returns a non-empty path. It also added SafeDoesPathExist in FileSystemProvider.cs for AppContainer-friendly drive-root validation. PR #26269 made the same DoNotVerify switch in CorePsPlatform.SafeDeriveFromSpecialFolder earlier.
This change is correct for AppContainer scenarios but is only directly relevant to Case 1. Case 3 is independent of #27305 (see Case 3 for details).
Delta between v7.6.0-rc.1 and release/v7.7.0-preview.1 relevant to these cases
1218a29b8 [release/v7.7.0-preview.1] Enable usage in AppContainers (#27305)
7498139ba Update `Microsoft.PowerShell.PSResourceGet` version to 1.2.0 (#27003)
212c5f97e Update to .NET 11 SDK and update dependencies (#26783)
012529a96 Update Microsoft.PowerShell.PSResourceGet version to 1.2.0-rc3 (#26753)
276989fa5 Update Microsoft.PowerShell.PSResourceGet version to 1.2.0-rc1 (#26691)
592668bd0 Refactor the module path construction code to make it more robust and easier to maintain (#26565)
2a49561af Update `Microsoft.PowerShell.PSResourceGet` to `v1.2.0-preview5` (#26589)
c7ee0d294 Fix checks for local user config file paths (#26269)
Case 1 - ModuleIntrinsics.GetPSModulePath "User" on elevated lanes
Expected '/root/.local/share/powershell/Modules' to be found in collection
@('/home/cloudtest/PSPackage/download/PowerShell/Modules',
'/home/cloudtest/PSPackage/download/Test/test/tools/Modules',
'/home/cloudtest/.local/share/powershell/Modules'),
but it was not found.
at <ScriptBlock>, test/powershell/engine/Module/ModulePath.Tests.ps1: line 247
247: $currentModulePathElements | Should -Contain $mPath
Root cause
The test assumes [ModuleIntrinsics]::GetPSModulePath("User") must already be present in the inherited $env:PSModulePath, which does not hold for the elevated test leg:
The elevated leg is launched via sudo -E pwsh ... from build.psm1#L2020.
sudo -E preserves $env:PSModulePath from the launching user (cloudtest) but most sudoers configurations reset HOME to /root.
GetPSModulePath("User") is computed live from the new HOME via Platform.SelectProductNameForDirectory(USER_MODULES), producing /root/.local/share/powershell/Modules.
The inherited $env:PSModulePath still contains /home/cloudtest/.local/share/powershell/Modules, so $currentModulePathElements | Should -Contain $mPath fails.
The same shape applies on elevated Windows lanes - the elevated process is launched from a wrapper that already established PSModulePath, and elevation/service-account contexts can produce a different MyDocuments folder than the one baked into the inherited PSModulePath. PR #27305 surfaces the Windows variant because DoNotVerify now returns a value that previously would have been "".
Fix
This is a test bug. Two reasonable options:
Option A - Skip when elevation crossed a user boundary (smallest change):
# test/powershell/engine/Module/ModulePath.Tests.ps1, inside the "User" caseif ($Name-eq''User'') {
$userPath= [System.Management.Automation.ModuleIntrinsics]::GetPSModulePath(''User'')
if ($currentModulePathElements-notcontains$userPath) {
Set-ItResult-Skipped -Because ''Elevation session has a different HOME/MyDocuments than the launching user; the inherited PSModulePath does not reflect current user-scope.''return
}
}
Option B - Reconcile $env:PSModulePath after elevation (in the test harness):
Add to the elevated test entry point (e.g. around build.psm1#L2020):
Note: ReleaseAutomationTest test IDs are run-relative and not stable between runs. The same It blocks were tracked as 100120 / 100144 in an earlier draft; only test names are stable.
Lanes affected (all elevated)
win_arm64
WindowsServer2016ZIP
ubuntu22_TAR, ubuntu22
ubi9
arm64
macOS TAR, macOS
linux_arm32
debian12
azurelinux30
The coverage spans both portable (ZIP/TAR) and package-installed lanes, ruling out portable-distribution-only theories.
Confirmed regression
Both tests passed on the v7.6.0-rc.1 baseline (confirmed via the rc.1 ReleaseAutomationTest xUnit output: both result="Success" success="True" executed="True" for PSResourceGet - Module tests (Admin) and PowerShellGet - Module tests (Admin)). They now fail on preview.1, so this is a real product-side regression, not a comparator artifact.
That value does not depend on HOME / sudo -E, so this case is NOT caused by #27305. The test files themselves are unchanged between v7.6.0-rc.1 and release/v7.7.0-preview.1 (git log v7.6.0-rc.1..release/v7.7.0-preview.1 -- <path> returns no commits), so it is not a rename/new-test artifact either.
Real candidates (delta commits between v7.6.0-rc.1 and release/v7.7.0-preview.1)
Commit
Why it matters
Case relevance
7498139ba - PR #27003 bump Microsoft.PowerShell.PSResourceGet to 1.2.0 (final GA)
New GA could change Install-PSResource -Scope AllUsers install path logic
PowerShellGet 2.2.5 was not version-bumped between the two releases. Because 101755 also regressed and PowerShellGet itself did not change, the PSResourceGet 1.2.0 GA bump cannot be the sole explanation - a shared product-side change is required. The strongest single-suspect candidate that would explain regressions in both Install-PSResource -Scope AllUsers (test 100798) andInstall-Module -Scope AllUsers (test 101755) is PR #26565 (592668bd0), via the same AddToPath -> UpdatePath rewrite already confirmed responsible for the test 108309 regression tracked in #27346.
Likely mechanism
The failing assertion is:
$module=Get-Module$TestModule-ListAvailable
$module.ModuleBase.StartsWith($script:programFilesModulesPath, [StringComparison]::OrdinalIgnoreCase) | Should -BeTrue
$script:programFilesModulesPath is byte-identical between rc.1 and preview.1 (/usr/local/share/powershell/Modules on Linux, $env:ProgramFiles/PowerShell/Modules on Windows). The install cmdlet is documented to land AllUsers-scoped modules under that root, so the only way the assertion fails is if Get-Module -ListAvailable returns a $module whose ModuleBase is not under $programFilesModulesPath - i.e. another copy of the module is being resolved first from a different PSModulePath entry.
Get-Module -ListAvailable enumerates PSModulePath in order. PR #26565 changed:
AddToPath -> UpdatePath (HashSet<string> dedup using Path.TrimEndingDirectorySeparator)
insertPosition now advances after each insert (forward order), where rc.1's AddToPath did not advance it (reverse order)
Any of these can change the relative ordering of (a) the AllUsers install root and (b) other paths on PSModulePath that may also contain a copy of $TestModule (e.g. test-tools modules folder, downloaded test scaffolding). If a non-programFilesModulesPath location now sorts earlier on preview.1, Get-Module -ListAvailable | Select-Object -First 1 returns it, and StartsWith($programFilesModulesPath) fails.
This is consistent with the regression being across all elevated lanes (the change is in path construction, not platform-specific) and with PowerShellGet 2.2.5 being unchanged (the bug isn't in the install cmdlet, it's in which copy Get-Module -ListAvailable resolves first).
Fix plan
Verify the mechanism. On a preview.1 build, on any failing lane, after Install-PSResource -Name $TestModule -Scope AllUsers run Get-Module $TestModule -ListAvailable | Select-Object Name, ModuleBase and inspect (a) which paths are returned and (b) the current $env:PSModulePath ordering. Compare against rc.1.
Per .github/instructions/code-review-branch-strategy.instructions.md, release branches should not carry workarounds for issues that also exist on master.
Files affected
test/powershell/engine/Module/ModulePath.Tests.ps1 (lines 206-250) - Case 1 (User variant test fix)
build.psm1 (line 2020) - Case 1 User variant (option B only)
test/powershell/Modules/Microsoft.PowerShell.PSResourceGet/Microsoft.PowerShell.PSResourceGet.Tests.ps1 (line 241) - Case 3 (test 100798; file unchanged between rc.1 and preview.1)
test/powershell/Modules/PowerShellGet/PowerShellGet.Tests.ps1 (line 172) - Case 3 (test 101755; file unchanged between rc.1 and preview.1)
Summary
Multiple tests fail in the
ReleaseAutomationTestcomparison of 7.7.0-preview.1 against the 7.6.0-rc.1 baseline. They share a common theme - howMyDocuments/SHARED_MODULES/$PSHOME/Modulespaths interact with elevated, service-account, and ZIP/TAR distribution sessions - but split into distinct root causes.ModuleIntrinsics.GetPSModulePathAPI testssudo -EdropsHOME; Machine variant: cross-platform PSModulePath construction regression - top suspect PR #26565WindowsServer2016ZIP - Unelevated,ubuntu22 TAR,mariner ARM64,macOS TAR,macOS,linux ARM32,debian12,azurelinux30v7.6.0-rc.1AllUsersinstallAddToPath->UpdatePathrewrite) - same code path as #27346. Unrelated to #27305All cases appear as "New Failure" because the
ReleaseAutomationTestcomparator matches failures by test name/ID against the baseline; tests added, renamed, or running for the first time on a newly-enabled lane inrelease/v7.7.0-preview.1are reported as new.First failing build:
ReleaseAutomationTest-27557-ps-671171.Shared context: PR #27305 "Enable usage in AppContainers"
release/v7.7.0-preview.1commit1218a29b8(merged tomasterviabec015ffc/ PR #27266) changedModuleIntrinsics.GetPersonalModulePathon Windows from:to:
SpecialFolderOption.Nonereturns""if the folder does not physically exist;DoNotVerifyalways returns a non-empty path. It also addedSafeDoesPathExistinFileSystemProvider.csfor AppContainer-friendly drive-root validation. PR #26269 made the sameDoNotVerifyswitch inCorePsPlatform.SafeDeriveFromSpecialFolderearlier.This change is correct for AppContainer scenarios but is only directly relevant to Case 1. Case 3 is independent of #27305 (see Case 3 for details).
Delta between v7.6.0-rc.1 and release/v7.7.0-preview.1 relevant to these cases
Case 1 -
ModuleIntrinsics.GetPSModulePath "User"on elevated lanesLanes affected
mariner_ARM64,Ubuntu22,debian12,linux_Arm32,ubi9macOS,macOS Tarwin_arm64,Windows Server 2016Sample failure
Root cause
The test assumes
[ModuleIntrinsics]::GetPSModulePath("User")must already be present in the inherited$env:PSModulePath, which does not hold for the elevated test leg:sudo -E pwsh ...frombuild.psm1#L2020.sudo -Epreserves$env:PSModulePathfrom the launching user (cloudtest) but most sudoers configurations resetHOMEto/root.GetPSModulePath("User")is computed live from the newHOMEviaPlatform.SelectProductNameForDirectory(USER_MODULES), producing/root/.local/share/powershell/Modules.$env:PSModulePathstill contains/home/cloudtest/.local/share/powershell/Modules, so$currentModulePathElements | Should -Contain $mPathfails.The same shape applies on elevated Windows lanes - the elevated process is launched from a wrapper that already established
PSModulePath, and elevation/service-account contexts can produce a differentMyDocumentsfolder than the one baked into the inheritedPSModulePath. PR #27305 surfaces the Windows variant becauseDoNotVerifynow returns a value that previously would have been"".Fix
This is a test bug. Two reasonable options:
Option A - Skip when elevation crossed a user boundary (smallest change):
Option B - Reconcile
$env:PSModulePathafter elevation (in the test harness):Add to the elevated test entry point (e.g. around
build.psm1#L2020):Option A is lower-risk. Option B also makes
Install-Module -Scope CurrentUserinside elevated legs behave more intuitively.Case 3 - PSResourceGet / PowerShellGet AllUsers install on all elevated lanes
Tests
PSResourceGet - Module tests (Admin) - Should install a module correctly to the required location with AllUsers scopetest/powershell/Modules/Microsoft.PowerShell.PSResourceGet/Microsoft.PowerShell.PSResourceGet.Tests.ps1#L241-L249PowerShellGet - Module tests (Admin) - Should install a module correctly to the required location with AllUsers scopetest/powershell/Modules/PowerShellGet/PowerShellGet.Tests.ps1#L172-L178Note:
ReleaseAutomationTesttest IDs are run-relative and not stable between runs. The sameItblocks were tracked as100120/100144in an earlier draft; only test names are stable.Lanes affected (all elevated)
win_arm64WindowsServer2016ZIPubuntu22_TAR,ubuntu22ubi9arm64macOS TAR,macOSlinux_arm32debian12azurelinux30The coverage spans both portable (ZIP/TAR) and package-installed lanes, ruling out portable-distribution-only theories.
Confirmed regression
Both tests passed on the v7.6.0-rc.1 baseline (confirmed via the rc.1
ReleaseAutomationTestxUnit output: bothresult="Success" success="True" executed="True"forPSResourceGet - Module tests (Admin)andPowerShellGet - Module tests (Admin)). They now fail on preview.1, so this is a real product-side regression, not a comparator artifact.Key assertion
$programFilesModulesPathis built from[Platform]::SelectProductNameForDirectory("SHARED_MODULES"), which on Linux is hardcoded:That value does not depend on
HOME/sudo -E, so this case is NOT caused by #27305. The test files themselves are unchanged betweenv7.6.0-rc.1andrelease/v7.7.0-preview.1(git log v7.6.0-rc.1..release/v7.7.0-preview.1 -- <path>returns no commits), so it is not a rename/new-test artifact either.Real candidates (delta commits between v7.6.0-rc.1 and release/v7.7.0-preview.1)
7498139ba- PR #27003 bumpMicrosoft.PowerShell.PSResourceGetto1.2.0(final GA)Install-PSResource -Scope AllUsersinstall path logic012529a96- PR #26753PSResourceGet 1.2.0-rc3592668bd0- PR #26565 "Refactor module path construction"UpdatePath, static-initializedSetModulePath, changed dedup to usePath.TrimEndingDirectorySeparator+HashSet<string>212c5f97e- PR #26783 .NET 10 -> .NET 11 SDKGetFolderPath/ path semantics can shift subtly across SDK majors1218a29b8/bec015ffc- PR #27305 AppContainersPowerShellGet
2.2.5was not version-bumped between the two releases. Because 101755 also regressed and PowerShellGet itself did not change, the PSResourceGet 1.2.0 GA bump cannot be the sole explanation - a shared product-side change is required. The strongest single-suspect candidate that would explain regressions in bothInstall-PSResource -Scope AllUsers(test 100798) andInstall-Module -Scope AllUsers(test 101755) is PR #26565 (592668bd0), via the sameAddToPath->UpdatePathrewrite already confirmed responsible for the test 108309 regression tracked in #27346.Likely mechanism
The failing assertion is:
$script:programFilesModulesPathis byte-identical between rc.1 and preview.1 (/usr/local/share/powershell/Moduleson Linux,$env:ProgramFiles/PowerShell/Moduleson Windows). The install cmdlet is documented to landAllUsers-scoped modules under that root, so the only way the assertion fails is ifGet-Module -ListAvailablereturns a$modulewhoseModuleBaseis not under$programFilesModulesPath- i.e. another copy of the module is being resolved first from a differentPSModulePathentry.Get-Module -ListAvailableenumeratesPSModulePathin order. PR #26565 changed:AddToPath->UpdatePath(HashSet<string>dedup usingPath.TrimEndingDirectorySeparator)insertPositionnow advances after each insert (forward order), where rc.1'sAddToPathdid not advance it (reverse order)static ModuleIntrinsics() { SetModulePath(); }initializer addedAny of these can change the relative ordering of (a) the
AllUsersinstall root and (b) other paths onPSModulePaththat may also contain a copy of$TestModule(e.g. test-tools modules folder, downloaded test scaffolding). If a non-programFilesModulesPathlocation now sorts earlier on preview.1,Get-Module -ListAvailable | Select-Object -First 1returns it, andStartsWith($programFilesModulesPath)fails.This is consistent with the regression being across all elevated lanes (the change is in path construction, not platform-specific) and with PowerShellGet 2.2.5 being unchanged (the bug isn't in the install cmdlet, it's in which copy
Get-Module -ListAvailableresolves first).Fix plan
Install-PSResource -Name $TestModule -Scope AllUsersrunGet-Module $TestModule -ListAvailable | Select-Object Name, ModuleBaseand inspect (a) which paths are returned and (b) the current$env:PSModulePathordering. Compare against rc.1.ModuleIntrinsics.GetModulePath/UpdatePathand is the same family of change as the Test failures from module-path refactor PR #26565: tests 103778 / 103842 / 108309 fail on ZIP/TAR/portable distribution lanes #27346 fix - either always includepsHomeModulePathalongside HKLM (as proposed in Test failures from module-path refactor PR #26565: tests 103778 / 103842 / 108309 fail on ZIP/TAR/portable distribution lanes #27346) or restore rc.1's reverse-insertion ordering for the affected branch.Branch strategy
Both remaining cases exist on
masteras well asrelease/v7.7.0-preview.1:sudo -Ewrapper are identical on both. Fix master first, backport test change to preview.1.ModuleIntrinsicsregression as Test failures from module-path refactor PR #26565: tests 103778 / 103842 / 108309 fail on ZIP/TAR/portable distribution lanes #27346 / Case 3. Fix master first, backport.ModuleIntrinsics(PR Refactor the module path construction code to make it more robust and easier to maintain #26565). Fix master first, backport to preview.1. Coordinate with the Test failures from module-path refactor PR #26565: tests 103778 / 103842 / 108309 fail on ZIP/TAR/portable distribution lanes #27346 product-side fix since both target the same code path. If bisect re-points at PSResourceGet 1.2.0 GA, the product delta lives in the NuGet package; either ship a patched 1.2.x bump or revert the PSResourceGet bump on the release branch.Per
.github/instructions/code-review-branch-strategy.instructions.md, release branches should not carry workarounds for issues that also exist on master.Files affected
test/powershell/engine/Module/ModulePath.Tests.ps1(lines 206-250) - Case 1 (User variant test fix)build.psm1(line 2020) - Case 1 User variant (option B only)src/System.Management.Automation/engine/Modules/ModuleIntrinsics.cs- Case 1 Machine variant (test 100145) and Case 3 (top suspect; same code path as Test failures from module-path refactor PR #26565: tests 103778 / 103842 / 108309 fail on ZIP/TAR/portable distribution lanes #27346)test/powershell/Modules/Microsoft.PowerShell.PSResourceGet/Microsoft.PowerShell.PSResourceGet.Tests.ps1(line 241) - Case 3 (test 100798; file unchanged between rc.1 and preview.1)test/powershell/Modules/PowerShellGet/PowerShellGet.Tests.ps1(line 172) - Case 3 (test 101755; file unchanged between rc.1 and preview.1)src/Modules/PSGalleryModules.csproj- Case 3 (only if bisect re-points at Update Microsoft.PowerShell.PSResourceGet version to 1.2.0 #27003)Related
9a42b9152, Feb 19 2026)ReleaseAutomationTest-27557-ps-671171