Skip to content

fix(azure): leave AZConfig and Deployment empty on a managed-instance page error - #240

Merged
cristim merged 3 commits into
mainfrom
fix/azure-azconfig-page-error-94
Oct 6, 2026
Merged

cristim merged 3 commits into
mainfrom
fix/azure-azconfig-page-error-94

Conversation

@cristim

@cristim cristim commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

What

walkManagedInstances now reports whether the walk completed. On a page error, context cancellation or pager-construction failure, fetchServerInfo returns empty AZConfig and Deployment instead of deriving them from the partial sample.

Why

A failure on page two made page one's counts look like the whole subscription, stamping a confident "zoneRedundant"/"none" AZConfig (and a Deployment value) on recommendations.

Behaviour change

Pager-construction failure previously could still yield Deployment="single" when regular servers existed; it now leaves Deployment empty, matching the logged 'AZConfig/Deployment signal unavailable'. Conversion still does not fail.

Verified

  • New test with page 1 ok, page 2 error: fails on pre-fix code (AZConfig=zoneRedundant, Deployment=managed), passes after.
  • Table test with regular servers present (page 1 error, page 2 error after instances, context cancelled mid-walk): AZConfig and Deployment stay empty, so Deployment is not falsely "single". Mutation checks: disabling the complete guard or treating cancellation as complete makes these tests fail.
  • No test for pager-construction failure: the pager is built from a real credential when none is injected, so there is no cheap injection point.
  • Control: complete two-page walk still derives zoneRedundant/managed.
  • go vet, go test ./... and golangci-lint run in providers/azure: clean.

Note: serverInfoOnce caches an empty result for the client's lifetime (client.go, cachedDominantAZConfig). This is pre-existing and tracked separately.

Closes #94

Summary by CodeRabbit

  • Bug Fixes
    • Azure SQL recommendations are no longer derived from incomplete managed-instance listings. If listing fails or is canceled, configuration and deployment recommendations remain empty.
    • Recommendations continue to be generated when the full listing completes, including across multiple pages.

… page error

A page error or cancellation mid-walk returned the partial counts, and fetchServerInfo derived AZConfig and Deployment from them as if complete. Report completeness from walkManagedInstances and emit empty signals when the walk did not finish.
@cristim cristim added priority/p2 Backlog-worthy severity/medium Moderate harm triaged Item has been triaged urgency/this-quarter Within the quarter impact/few Limited audience effort/xs Trivial / one-liner type/bug Defect labels Oct 6, 2026
@cristim

cristim commented Oct 6, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Full review finished.

@coderabbitai

coderabbitai Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: LeanerCloud/cloud-commitments-go/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: b08f6d9c-477f-433e-ba0b-66d218ae851e
📥 Commits

Reviewing files that changed from the base of the PR and between 6191fd2 and 751db4e.

📒 Files selected for processing (2)
  • providers/azure/services/database/client.go
  • providers/azure/services/database/client_test.go

Included review availability: This review used your included allowance. 0 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 2 reviews per hour.


📝 Walkthrough

Walkthrough

The managed-instance pager walk now reports whether it completed. Conversion leaves AZConfig and Deployment empty when the walk is incomplete. Tests cover failed and complete multi-page walks.

Changes

Azure managed-instance signals

Layer / File(s) Summary
Managed-instance walk and conversion
providers/azure/services/database/client.go, providers/azure/services/database/client_test.go
The pager walk returns a completion flag. Conversion leaves AZConfig and Deployment empty if the walk does not complete. Tests cover pagination errors, cancellation, and a complete multi-page walk.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 751db

Incomplete managed-instance walks now leave AZConfig and Deployment empty instead of deriving them from partial counts. No merge-blocking risk was found in the supplied changes.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: leaving AZConfig and Deployment empty when managed-instance pagination fails.
Linked Issues check ✅ Passed Issue #94 requires incomplete managed-instance walks to avoid deriving subscription-wide AZConfig from partial counts. walkManagedInstances now marks pager creation errors, page errors, and cancella…
Out of Scope Changes check ✅ Passed The implementation and tests address issue #94. Leaving Deployment empty on incomplete walks prevents a partial sample from producing a misleading deployment signal and matches the unavailable-signal …
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/xs Trivial / one-liner impact/few Limited audience priority/p2 Backlog-worthy severity/medium Moderate harm triaged Item has been triaged type/bug Defect urgency/this-quarter Within the quarter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(azure): AZConfig is derived from managed-instance counts cut short by a page error

1 participant