Skip to content

Fix Advisor retirement recommendation filtering - #77

Open
cocallaw wants to merge 2 commits into
mainfrom
cocallaw-fix-advisor-recommendation-filter
Open

Fix Advisor retirement recommendation filtering#77
cocallaw wants to merge 2 commits into
mainfrom
cocallaw-fix-advisor-recommendation-filter

Conversation

@cocallaw

@cocallaw cocallaw commented Aug 7, 2026

Copy link
Copy Markdown
Owner

Summary

  • normalize Az.Advisor associative extended properties through AdditionalProperties
  • preserve existing JSON, dictionary, and cached-property handling
  • add regression coverage for mixed retirement and non-retirement recommendations

Validation

  • Invoke-Pester ./Tests/AzRetirementMonitor.Tests.ps1 (75 passed)
  • PSScriptAnalyzer with PSGallery settings

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
Copilot AI lite review requested due to automatic review settings August 7, 2026 23:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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-AzAdvisorExtendedProperty to (a) ignore null ExtendedPropertyObject cache entries, (b) fall back between ExtendedProperty and ExtendedProperties, and (c) unwrap Az.Advisor model AdditionalProperties dictionaries.
  • Add Pester coverage for null-cache parsing, plural ExtendedProperties, and Az.Advisor associative AdditionalProperties dictionaries 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.

@cocallaw cocallaw self-assigned this Aug 7, 2026
@cocallaw cocallaw added the bug Something isn't working label Aug 7, 2026
@github-actions github-actions Bot mentioned this pull request Aug 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants