Skip to content

Fix resourceCache to return proper modules when PS modules are installed during run#748

Merged
SteveL-MSFT merged 18 commits intoPowerShell:mainfrom
Gijsreyn:fix-module-add-run-ps
Apr 13, 2025
Merged

Fix resourceCache to return proper modules when PS modules are installed during run#748
SteveL-MSFT merged 18 commits intoPowerShell:mainfrom
Gijsreyn:fix-module-add-run-ps

Conversation

@Gijsreyn
Copy link
Copy Markdown
Collaborator

PR Summary

This PR addresses the issue described in #745. When modules are installed during a document being applied, the subsequent modules that are checked in the cache are overwritten. Example:

  1. The first run initiates the resource cache (dsc resource list) as no cache is found.
  2. The first configuration is applied, installing new PowerShell modules (triggering the cache on module paths to be stale).
  3. The assertion triggers the Invoke-DscCacheRefresh -Module '<module>', flushing out the cache with only that particular module.
  4. Modules underneath aren't found anymore in the same sequence.

It's a pretty rough edge case and quite interesting to debug. Nevertheless, there isn't any test added because it would either introduce an external dependency or require internal work to be implemented. Of course, I can be wrong on this and would appreciate some help to write one.

@Gijsreyn
Copy link
Copy Markdown
Collaborator Author

Gijsreyn commented Apr 11, 2025

@SteveL-MSFT, if you have some time, you might taking a glimpse? In the issue, I've also mentioned steps to reproduce it through the module.

Copy link
Copy Markdown
Member

@SteveL-MSFT SteveL-MSFT left a comment

Choose a reason for hiding this comment

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

Can you repro the original issue by having a test case that executes a test resource that adds a new test resource?

@Gijsreyn Gijsreyn force-pushed the fix-module-add-run-ps branch from 992c730 to c8da022 Compare April 13, 2025 13:50
@Gijsreyn Gijsreyn mentioned this pull request Apr 13, 2025
3 tasks
@Gijsreyn
Copy link
Copy Markdown
Collaborator Author

Should be good to go @SteveL-MSFT . Workstation did not cooperate today. I hadn't re-requested a review yet, you sharp eye ;)

@Gijsreyn Gijsreyn requested a review from SteveL-MSFT April 13, 2025 16:03
@SteveL-MSFT SteveL-MSFT added this pull request to the merge queue Apr 13, 2025
Merged via the queue into PowerShell:main with commit 9fc9a80 Apr 13, 2025
4 checks passed
@Gijsreyn Gijsreyn deleted the fix-module-add-run-ps branch April 14, 2025 04:00
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.

2 participants