Skip to content

Backport resourcehealth deserializationfix#2293

Merged
vcolin7 merged 1 commit intorelease/azure/2.xfrom
vcolin7/backport-resourcehealth-deserialization
Mar 31, 2026
Merged

Backport resourcehealth deserializationfix#2293
vcolin7 merged 1 commit intorelease/azure/2.xfrom
vcolin7/backport-resourcehealth-deserialization

Conversation

@vcolin7
Copy link
Copy Markdown
Contributor

@vcolin7 vcolin7 commented Mar 31, 2026

What does this PR do?

Backport 105990a from PR #2292

GitHub issue number?

#2000

Pre-merge Checklist

  • Required for All PRs
    • Read contribution guidelines
    • PR title clearly describes the change
    • Commit history is clean with descriptive messages (cleanup guide)
    • Added comprehensive tests for new/modified functionality
    • Created a changelog entry if the change falls among the following: new feature, bug fix, UI/UX update, breaking change, or updated dependencies. Follow the changelog entry guide
  • For MCP tool changes:
    • One tool per PR: This PR adds or modifies only one MCP tool for faster review cycles
    • Updated servers/Azure.Mcp.Server/README.md and/or servers/Fabric.Mcp.Server/README.md documentation
    • Validate README.md changes running the script ./eng/scripts/Process-PackageReadMe.ps1. See Package README
    • For new or modified tool descriptions, ran ToolDescriptionEvaluator and obtained a score of 0.4 or more and a top 3 ranking for all related test prompts
    • For tools with new names, including new tools or renamed tools, update consolidated-tools.json
    • For renamed tools, follow the Tool Rename Checklist and tag the PR with the breaking-change label
    • For new tools associated with Azure services or publicly available tools/APIs/products, add URL to documentation in the PR description
  • Extra steps for Azure MCP Server tool changes:
    • Updated command list in servers/Azure.Mcp.Server/docs/azmcp-commands.md
    • Ran ./eng/scripts/Update-AzCommandsMetadata.ps1 to update tool metadata in azmcp-commands.md (required for CI)
    • Updated test prompts in servers/Azure.Mcp.Server/docs/e2eTestPrompts.md
    • 👉 For Community (non-Microsoft team member) PRs:
      • Security review: Reviewed code for security vulnerabilities, malicious code, or suspicious activities before running tests (crypto mining, spam, data exfiltration, etc.)
      • Manual tests run: added comment /azp run mcp - pullrequest - live to run Live Test Pipeline

…`DateTimeOffset?` (#2292)

Changed approach to use `string?` instead of `DateTimeOffset?`
@vcolin7 vcolin7 requested a review from a team as a code owner March 31, 2026 00:05
@vcolin7 vcolin7 requested review from KarishmaGhiya, chidozieononiwu, Copilot, fanyang-mono, jairmyree, jongio, joshfree and tmeschter and removed request for a team March 31, 2026 00:05
@vcolin7 vcolin7 changed the title Updated resourcehealth deserialization to use string? instead of DateTimeOffset? (#2292) Backport resourcehealth deserializationfix Mar 31, 2026
@github-project-automation github-project-automation Bot moved this from Untriaged to In Progress in Azure MCP Server Mar 31, 2026
@vcolin7 vcolin7 enabled auto-merge (squash) March 31, 2026 00:08
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Backports the Resource Health fix for Azure API responses that include datetime strings without timezone designators (notably the 0001-01-01T00:00:00 sentinel), preventing System.Text.Json deserialization failures in the resourcehealth tools.

Changes:

  • Changed internal Resource Health response models to deserialize datetime fields as string? instead of DateTimeOffset?.
  • Added a lenient string? -> DateTimeOffset? parsing helper during internal-to-public model conversion.
  • Added unit tests covering mixed timezone/no-timezone datetime formats for service health events and availability status.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tools/Azure.Mcp.Tools.ResourceHealth/src/Models/Internal/ServiceHealthEventResponse.cs Switches datetime fields to string? for resilient JSON deserialization.
tools/Azure.Mcp.Tools.ResourceHealth/src/Models/Internal/AvailabilityStatusResponse.cs Switches datetime fields to string? for resilient JSON deserialization.
tools/Azure.Mcp.Tools.ResourceHealth/src/Models/Internal/ResponseModelExtensions.cs Adds lenient datetime parsing when mapping internal responses to public models.
tools/Azure.Mcp.Tools.ResourceHealth/tests/Azure.Mcp.Tools.ResourceHealth.UnitTests/ServiceHealthEvents/ServiceHealthEventDeserializationTests.cs Adds coverage for service health event datetime formats (with/without timezone, nulls, mixed).
tools/Azure.Mcp.Tools.ResourceHealth/tests/Azure.Mcp.Tools.ResourceHealth.UnitTests/AvailabilityStatus/AvailabilityStatusDeserializationTests.cs Adds coverage for availability status datetime formats (with/without timezone, nulls, single vs list).

@vcolin7 vcolin7 merged commit 1269ac5 into release/azure/2.x Mar 31, 2026
28 checks passed
@vcolin7 vcolin7 deleted the vcolin7/backport-resourcehealth-deserialization branch March 31, 2026 00:29
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Azure MCP Server Mar 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants