Repository navigation
Handle scalar RequiredModules in local repository manifests - #2077
Open
Dimitriy Leontev (dleontev) wants to merge 1 commit into
Open
Dimitriy Leontev (dleontev) wants to merge 1 commit into
Dimitriy Leontev (dleontev) wants to merge 1 commit into
Conversation
Normalize RequiredModules with PowerShell's array conversion before reading local-repository dependency metadata. Accept scalar module names and hashtables while preserving existing array and version behavior. Add regression coverage for supported dependency representations, optional values, and version constraints. Fixes PowerShell#2059.
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues require resolution for the local manifest dependency normalization change.
No open issues 🎉
What changed in this PR
This PR fixes local repository manifest parsing for scalar RequiredModules values, addressing issue #2059 so package discovery can proceed for Find, Save, and Install.
Changes:
- Uses PowerShell array conversion to normalize scalar and array dependencies, treating null as an empty list.
- Adds 12 regression cases covering dependency representations, empty/null/omitted values, and version constraints.
| File | Description |
|---|---|
| test/PSResourceInfo.Tests.ps1 | Adds regression coverage for dependency normalization and version ranges. |
| src/code/PSResourceInfo.cs | Normalizes RequiredModules before enumerating local manifest dependencies. |
Review effort: Balanced
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Summary
Normalize local module-manifest
RequiredModulesvalues with PowerShell's array conversion before reading dependency information. Single module-name strings and single hashtables now follow the same path as arrays, and null values produce an empty dependency list.Add 12 regression cases covering scalar and array representations, mixed dependencies, empty/null/omitted values and dependency version ranges.
Fixes #2059.
PR Context
PowerShell accepts a single string or hashtable for
RequiredModules. The local-repository conversion code previously cast this value toObject[], yielding null for valid scalar values and then failing when enumerating it. This prevented package discovery before Find/Save/Install could continue.The change follows the normalization approach used by
PublishHelper.ParseRequiredModulesand preserves the existing dependency-version parsing.Validation
net472with the repository's pinned .NET SDK 10.0.403 passed.PSResourceInfo.Tests.ps1passed on both PowerShell 7.6.5 and Windows PowerShell 5.1.26100.9818.ManualValidationOnly.-SkipDependencyCheck.AI assistance: Codex prepared the code and regression tests and ran the local validation described above.
PR Checklist