Skip to content

fix(providers/azure): case-insensitive + whitespace-tolerant SKU validation (closes #675) - #676

Merged
cristim merged 2 commits into
feat/multicloud-web-frontendfrom
fix/issue-675-azure-sku-eqfold
May 22, 2026
Merged

fix(providers/azure): case-insensitive + whitespace-tolerant SKU validation (closes #675)#676
cristim merged 2 commits into
feat/multicloud-web-frontendfrom
fix/issue-675-azure-sku-eqfold

Conversation

@cristim

@cristim cristim commented May 22, 2026

Copy link
Copy Markdown
Member

Summary

  • Replace exact == comparison in ValidateOffering with strings.EqualFold(sku, strings.TrimSpace(rec.ResourceType)) across compute, database, cache, search, and cosmosdb Azure service clients
  • Matches the pattern already shipped for synapse (commit 1313332)
  • Add case_insensitive and whitespace_trimmed regression sub-tests for each affected service

Test plan

  • go test github.com/LeanerCloud/CUDly/providers/azure/services/compute -- pass
  • go test github.com/LeanerCloud/CUDly/providers/azure/services/database -- pass
  • go test github.com/LeanerCloud/CUDly/providers/azure/services/cache -- pass
  • go test github.com/LeanerCloud/CUDly/providers/azure/services/cosmosdb -- pass
  • go test github.com/LeanerCloud/CUDly/providers/azure/services/search -- pre-existing build failure (missing go.sum entry), not introduced by this PR
  • 12 new CaseInsensitive sub-tests (case_insensitive + whitespace_trimmed across 4 buildable services) all pass
  • gofmt, go vet, go build clean on all 5 packages

Summary by CodeRabbit

  • Bug Fixes
    • Azure resource type validation now accepts values regardless of letter casing and surrounding whitespace across cache, compute, database, search, and Cosmos DB services, reducing unnecessary validation errors.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 22, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 68fa327f-c048-4b17-a1b3-94ca40c3cc66

📥 Commits

Reviewing files that changed from the base of the PR and between dc2ee71 and 358b30b.

📒 Files selected for processing (10)
  • providers/azure/services/cache/client.go
  • providers/azure/services/cache/client_test.go
  • providers/azure/services/compute/client.go
  • providers/azure/services/compute/client_test.go
  • providers/azure/services/cosmosdb/client.go
  • providers/azure/services/cosmosdb/client_test.go
  • providers/azure/services/database/client.go
  • providers/azure/services/database/client_test.go
  • providers/azure/services/search/client.go
  • providers/azure/services/search/client_test.go

📝 Walkthrough

Walkthrough

This PR applies a consistent normalization pattern to SKU validation across five Azure service clients: cache, compute, cosmosdb, database, and search. Each ValidateOffering method now trims whitespace and performs case-insensitive comparison instead of requiring exact case-sensitive matches.

Changes

SKU Validation Normalization Across Azure Services

Layer / File(s) Summary
SKU validation normalization implementations
providers/azure/services/cache/client.go, providers/azure/services/compute/client.go, providers/azure/services/cosmosdb/client.go, providers/azure/services/database/client.go, providers/azure/services/search/client.go
Each ValidateOffering method now normalizes rec.ResourceType by trimming whitespace and uses strings.EqualFold for case-insensitive SKU matching instead of exact case-sensitive comparison.
SKU normalization test cases
providers/azure/services/cache/client_test.go, providers/azure/services/compute/client_test.go, providers/azure/services/cosmosdb/client_test.go, providers/azure/services/database/client_test.go, providers/azure/services/search/client_test.go
New TestXXXClient_ValidateOffering_CaseInsensitive test functions added for each service, verifying ValidateOffering accepts SKU values with case variance and leading/trailing whitespace.

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly Related Issues

Suggested Labels

urgency/this-quarter

Poem

🐰 Five services now align their ways,
With gentle trimming, EqualFold's grace,
No more case-fighting, no more frays,
Consistency blooms in every place! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 7.69% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically summarizes the main change: applying case-insensitive and whitespace-tolerant SKU validation across Azure service clients.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/issue-675-azure-sku-eqfold

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

@cristim cristim added triaged Item has been triaged priority/p3 Polish / idea / may never ship severity/low Minor harm urgency/eventually No deadline impact/few Limited audience effort/s Hours type/bug Defect labels May 22, 2026
@cristim

cristim commented May 22, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented May 22, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@cristim cristim closed this May 22, 2026
@cristim cristim reopened this May 22, 2026
cristim added 2 commits May 22, 2026 17:12
…dation (closes #675)

Replace exact `==` comparison in ValidateOffering with
`strings.EqualFold(sku, strings.TrimSpace(rec.ResourceType))` across
compute, database, cache, search, and cosmosdb service clients, matching
the pattern already applied to synapse (commit 1313332).

Add regression sub-tests for case-insensitive and whitespace-padded SKU
inputs to each affected service.
@cristim
cristim force-pushed the fix/issue-675-azure-sku-eqfold branch from 964176d to 358b30b Compare May 22, 2026 15:15
@cristim

cristim commented May 22, 2026

Copy link
Copy Markdown
Member Author

Rebased onto latest feat/multicloud-web-frontend. Single conflict in providers/azure/services/search/client_test.go: upstream PR #641 added searchPurchaseURLFromMock + TestSearchClient_PurchaseCommitment_IdempotentReDrive in the same trailing region where this branch added TestSearchClient_ValidateOffering_CaseInsensitive. Both additions are orthogonal so I kept them side-by-side with their proper closing braces restored. No semantic conflicts on the 5 ValidateOffering bodies (auto-merge resolved cleanly). All 532 azure-provider tests pass locally.

@cristim

cristim commented May 22, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented May 22, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@cristim
cristim merged commit b727ecb into feat/multicloud-web-frontend May 22, 2026
4 checks passed
@cristim
cristim deleted the fix/issue-675-azure-sku-eqfold branch May 22, 2026 16:36
@cristim

cristim commented May 22, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented May 22, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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

Labels

effort/s Hours impact/few Limited audience priority/p3 Polish / idea / may never ship severity/low Minor harm triaged Item has been triaged type/bug Defect urgency/eventually No deadline

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant