Skip to content

Conversation

@haodeon
Copy link
Contributor

@haodeon haodeon commented May 7, 2025

PR Summary

Fixes #745 by ensuring a full Get-DscResource refresh is triggered when $env:PSModulePath changes.

Also reorders the cache staleness checks to prioritize detecting PSModulePath differences before evaluating stale resource entries.

Fixes #807 by ensuring a full cache refresh is triggered when cache is cold. It now builds a list $namedModules which determines whether targeted module refresh occurs, using this list if it does.

PR Context

When $env:PSModulePath changes, the cache may be rebuilt incorrectly if $Module remains set. The module environment may have changed outside the scope defined by $Module, but the refresh will only consider the provided modules.

When a module is deleted, the stale entries check will detect the change and initiate a cache refresh, skipping the check for stale paths. If the removed module is not in $Module, the stale entries get captured in $existingDscResourceCacheEntries and remain in the refreshed cache.

A change in PSModulePath should result in a full cache refresh and take priority over stale resource entries.

@haodeon
Copy link
Contributor Author

haodeon commented May 12, 2025

Now also fixes #807

@haodeon haodeon force-pushed the fix/diff-get-all branch 2 times, most recently from 6c16fae to 6fd7145 Compare May 13, 2025 21:59
@haodeon haodeon force-pushed the fix/diff-get-all branch from 6fd7145 to e11c2dd Compare May 17, 2025 06:20
@haodeon haodeon changed the title fix: Get all resources when PSModulePath changes fix: win_psDscAdapter targeted module cache refreshes May 19, 2025
@SteveL-MSFT SteveL-MSFT added this pull request to the merge queue May 19, 2025
Merged via the queue into PowerShell:main with commit 35dabc9 May 19, 2025
4 checks passed
@haodeon haodeon deleted the fix/diff-get-all branch May 27, 2025 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

win_psDscAdapter targeted module cache refreshes lead to broken cache state win_psDscAdapter fails to find resources during config run

2 participants