Fix Advisor retirement recommendation filtering - #77
Open
cocallaw wants to merge 2 commits into
Open
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: d64fa0ad-5725-4927-b0c3-cba195bd3272
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7741cfad-bbe0-4289-b543-33f879ebaec1
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes filtering of Azure Advisor retirement recommendations by normalizing how extended properties are read from Az.Advisor recommendation objects, ensuring the ServiceUpgradeAndRetirement subcategory is detected across multiple shapes (JSON string, dictionary, cached object, and Az.Advisor AdditionalProperties dictionaries). It strengthens the module’s robustness while adding regression coverage for mixed retirement/non-retirement datasets.
Changes:
- Update
Get-AzAdvisorExtendedPropertyto (a) ignore nullExtendedPropertyObjectcache entries, (b) fall back betweenExtendedPropertyandExtendedProperties, and (c) unwrap Az.Advisor modelAdditionalPropertiesdictionaries. - Add Pester coverage for null-cache parsing, plural
ExtendedProperties, and Az.Advisor associativeAdditionalPropertiesdictionaries to ensure filtering and description building behave correctly.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| Tests/AzRetirementMonitor.Tests.ps1 | Adds regression tests for ExtendedProperty caching/null behavior and for dictionary/AdditionalProperties shapes used by Az.Advisor. |
| Private/Get-AzAdvisorExtendedProperty.ps1 | Normalizes extraction of extended properties across string/hashtable/materialized and Az.Advisor AdditionalProperties representations. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Open
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.
Summary
AdditionalPropertiesValidation
Invoke-Pester ./Tests/AzRetirementMonitor.Tests.ps1(75 passed)