Skip to content

fix(providers/azure): wire Azure Search client into provider (closes #473 partially)#560

Open
cristim wants to merge 3 commits into
feat/multicloud-web-frontendfrom
fix/issue-473-azure-search-wiring
Open

fix(providers/azure): wire Azure Search client into provider (closes #473 partially)#560
cristim wants to merge 3 commits into
feat/multicloud-web-frontendfrom
fix/issue-473-azure-search-wiring

Conversation

@cristim
Copy link
Copy Markdown
Member

@cristim cristim commented May 20, 2026

Summary

providers/azure/services/search/ has been a fully-implemented Azure Cognitive Search reserved capacity client since it was first added, but it was unreachable because GetSupportedServices() did not list ServiceSearch and GetServiceClient() had no matching case. This PR wires the client into the provider, making Azure Search visible to every caller that enumerates supported services or constructs service clients (the UI recommendations table, the CLI scan loop, and the purchase flow).

What changed

  • providers/azure/provider.go: added common.ServiceSearch to GetSupportedServices() return slice; added case common.ServiceSearch: return NewSearchClient(...) to GetServiceClient().
  • providers/azure/services.go: added NewSearchClient factory function and the search package import, mirroring the pattern used for compute/database/cache/cosmosdb.
  • providers/azure/services/search/client.go: fixed pre-existing misclassification - GetServiceType(), convertSearchReservation(), and convertAzureSearchRecommendation() all returned/set common.ServiceOther instead of common.ServiceSearch.
  • go.mod / go.sum: added armsearch v1.4.0 to the root module so the root-level go build ./... resolves the transitive dependency that the services.go import now pulls in.
  • providers/azure/provider_test.go: extended TestAzureProvider_GetSupportedServices and TestAzureProvider_GetServiceClient_AllServiceTypes to cover ServiceSearch.
  • providers/azure/services_test.go: added TestNewSearchClient factory test.
  • providers/azure/services/search/client_test.go: updated two assertions that expected ServiceOther to expect ServiceSearch.

Why

Feature parity gap: every other Azure service client (compute, database, cache, cosmosdb) is wired into the provider. The search client existed but was dead code because the dispatch tables did not reference it.

Test plan

  • cd providers/azure && go test ./... -count=1 -short passes (348 tests, all green)
  • go build ./... from repo root passes with armsearch dep added
  • TestAzureProvider_GetSupportedServices asserts ServiceSearch is present
  • TestAzureProvider_GetServiceClient_AllServiceTypes/search constructs a non-nil client
  • TestNewSearchClient asserts GetServiceType() == ServiceSearch
  • TestSearchClient_GetServiceType asserts ServiceSearch

Refs #473

Summary by CodeRabbit

  • New Features

    • Added Azure Search service integration: provider now recognizes and returns a Search service client for configured regions, enabling discovery and management of Azure Search resources.
  • Tests

    • Expanded test coverage to validate Azure Search is reported as supported and to verify Search client creation, service type, and region behavior.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 20, 2026

Warning

Review limit reached

@cristim, we couldn't start this review because you've used your available PR reviews for now.

Your plan currently allows 2 reviews/hour. Refill in 15 seconds.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more review capacity refills, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than trial, open-source, and free plans. In all cases, review capacity refills continuously over time.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6d92ecd1-72d2-45a5-a297-4dba6fbac4f9

📥 Commits

Reviewing files that changed from the base of the PR and between 00e445a and ced589e.

📒 Files selected for processing (4)
  • providers/azure/provider_test.go
  • providers/azure/services/search/client.go
  • providers/azure/services/search/client_test.go
  • providers/azure/services_test.go
📝 Walkthrough

Walkthrough

This PR adds Azure Search as a supported service in the Azure provider by adding the Azure Search SDK dependency, introducing a NewSearchClient factory, wiring ServiceSearch into provider discovery/routing, and updating the search client and tests to classify the service as ServiceSearch.

Changes

Azure Search Service Support

Layer / File(s) Summary
Dependency and Search Client Factory
go.mod, providers/azure/services.go
Azure Search SDK dependency (armsearch v1.4.0) is added to go.mod, and a NewSearchClient factory is introduced to create configured search client instances.
Provider Service Discovery and Client Wiring
providers/azure/provider.go, providers/azure/provider_test.go
Azure provider's GetSupportedServices() now includes common.ServiceSearch, and GetServiceClient() routes ServiceSearch requests to NewSearchClient; provider tests updated to include and exercise ServiceSearch.
Search Client Service Type Classification
providers/azure/services/search/client.go, providers/azure/services/search/client_test.go
SearchClient.GetServiceType() and conversion functions now use common.ServiceSearch instead of common.ServiceOther; tests updated to expect ServiceSearch.
Search Client Factory Test Coverage
providers/azure/services_test.go
Added TestNewSearchClient to assert NewSearchClient returns a non-nil client with ServiceSearch type and correct region.

🎯 2 (Simple) | ⏱️ ~8 minutes

Suggested labels

impact/many

Poem

🐰 I hopped through modules, small and spry,

Added Search so queries can fly,
A factory born, tests give a cheer,
ServiceSearch now stands quite clear,
Hooray — the search blooms bright and nigh.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 18.18% 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 accurately and concisely describes the main change: wiring the Azure Search client into the provider to make it discoverable and constructible, which is the primary objective across all modified files.
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 unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/issue-473-azure-search-wiring

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

@cristim cristim added priority/p2 Backlog-worthy severity/medium Moderate harm urgency/this-sprint Within the current sprint impact/all-users Affects every user effort/xs Trivial / one-liner type/bug Defect triaged Item has been triaged labels May 20, 2026
@cristim
Copy link
Copy Markdown
Member Author

cristim commented May 20, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 20, 2026

✅ 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.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
providers/azure/provider_test.go (1)

406-413: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Include common.ServiceNoSQL in the "all service types" test matrix.

Line 412 adds Search, but this table-driven test still skips common.ServiceNoSQL, so GetServiceClient NoSQL routing is not covered in TestAzureProvider_GetServiceClient_AllServiceTypes.

Suggested patch
 	testCases := []struct {
 		service common.ServiceType
 	}{
 		{common.ServiceCompute},
 		{common.ServiceRelationalDB},
+		{common.ServiceNoSQL},
 		{common.ServiceCache},
 		{common.ServiceSearch},
 	}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@providers/azure/provider_test.go` around lines 406 - 413, The table-driven
test TestAzureProvider_GetServiceClient_AllServiceTypes omits
common.ServiceNoSQL from the testCases slice, so GetServiceClient's NoSQL
routing is not exercised; update the testCases declaration (the slice of
common.ServiceType) to include {common.ServiceNoSQL} alongside ServiceCompute,
ServiceRelationalDB, ServiceCache, and ServiceSearch so the NoSQL branch is
covered.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@providers/azure/provider_test.go`:
- Around line 406-413: The table-driven test
TestAzureProvider_GetServiceClient_AllServiceTypes omits common.ServiceNoSQL
from the testCases slice, so GetServiceClient's NoSQL routing is not exercised;
update the testCases declaration (the slice of common.ServiceType) to include
{common.ServiceNoSQL} alongside ServiceCompute, ServiceRelationalDB,
ServiceCache, and ServiceSearch so the NoSQL branch is covered.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a91fd524-c03b-4642-9554-64b61345c2fe

📥 Commits

Reviewing files that changed from the base of the PR and between 2a38e25 and 49224e8.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (7)
  • go.mod
  • providers/azure/provider.go
  • providers/azure/provider_test.go
  • providers/azure/services.go
  • providers/azure/services/search/client.go
  • providers/azure/services/search/client_test.go
  • providers/azure/services_test.go

cristim added a commit that referenced this pull request May 20, 2026
The table-driven test TestAzureProvider_GetServiceClient_AllServiceTypes
was missing common.ServiceNoSQL, leaving the GetServiceClient NoSQL
routing branch uncovered. Add {common.ServiceNoSQL} to testCases so
NewCosmosDBClient construction is verified alongside other service types.

Fixes CodeRabbit finding on PR #560.
@cristim
Copy link
Copy Markdown
Member Author

cristim commented May 20, 2026

CodeRabbit Review - Addressed

Finding Status Notes
Include ServiceNoSQL in test matrix Fixed Added {common.ServiceNoSQL} to testCases in TestAzureProvider_GetServiceClient_AllServiceTypes. This covers the NoSQL (CosmosDB) routing branch alongside Compute, RelationalDB, Cache, and Search. Test now passes.

Commit: 00e445afe (test(azure): include ServiceNoSQL in GetServiceClient test matrix)

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 20, 2026

@cristim: Thanks for the update! The addition of {common.ServiceNoSQL} to the TestAzureProvider_GetServiceClient_AllServiceTypes test matrix is a solid improvement — the CosmosDB/NoSQL routing branch is now properly covered alongside the other service types.

Triggering a fresh review of the latest changes now.

✅ 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
Copy link
Copy Markdown
Member Author

cristim commented May 20, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 20, 2026

✅ 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
Copy link
Copy Markdown
Member Author

cristim commented May 20, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 20, 2026

✅ 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 added a commit that referenced this pull request May 20, 2026
The table-driven test TestAzureProvider_GetServiceClient_AllServiceTypes
was missing common.ServiceNoSQL, leaving the GetServiceClient NoSQL
routing branch uncovered. Add {common.ServiceNoSQL} to testCases so
NewCosmosDBClient construction is verified alongside other service types.

Fixes CodeRabbit finding on PR #560.
@cristim cristim force-pushed the fix/issue-473-azure-search-wiring branch from 00e445a to 56306a5 Compare May 20, 2026 23:25
@cristim
Copy link
Copy Markdown
Member Author

cristim commented May 22, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 22, 2026

✅ 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 added a commit that referenced this pull request May 22, 2026
The table-driven test TestAzureProvider_GetServiceClient_AllServiceTypes
was missing common.ServiceNoSQL, leaving the GetServiceClient NoSQL
routing branch uncovered. Add {common.ServiceNoSQL} to testCases so
NewCosmosDBClient construction is verified alongside other service types.

Fixes CodeRabbit finding on PR #560.
@cristim cristim force-pushed the fix/issue-473-azure-search-wiring branch from 56306a5 to 0f78096 Compare May 22, 2026 10:34
cristim added 3 commits May 22, 2026 15:09
…473 partially)

Add common.ServiceSearch to GetSupportedServices() and a matching
case in GetServiceClient() that returns NewSearchClient(). Also add
the NewSearchClient factory function to services.go and fix the
pre-existing ServiceOther misclassification in the search client's
GetServiceType(), convertSearchReservation(), and
convertAzureSearchRecommendation() to return ServiceSearch.

Update tests in provider_test.go, services_test.go, and
services/search/client_test.go to cover the new wiring and correct
service type. Add armsearch v1.4.0 to the root go.mod so the root
module's build picks up the transitive dependency.

Refs #473
The table-driven test TestAzureProvider_GetServiceClient_AllServiceTypes
was missing common.ServiceNoSQL, leaving the GetServiceClient NoSQL
routing branch uncovered. Add {common.ServiceNoSQL} to testCases so
NewCosmosDBClient construction is verified alongside other service types.

Fixes CodeRabbit finding on PR #560.
…t test

During rebase conflict resolution a second {common.ServiceNoSQL} entry was
introduced in TestAzureProvider_GetServiceClient_AllServiceTypes. Remove the
duplicate so each service type appears exactly once in the test matrix.
@cristim
Copy link
Copy Markdown
Member Author

cristim commented May 22, 2026

Addressed the CodeRabbit finding on providers/azure/provider_test.go.

Finding: TestAzureProvider_GetServiceClient_AllServiceTypes omitted common.ServiceNoSQL from the test matrix.

Fix: Added {common.ServiceNoSQL} to the testCases slice in that test (commit 15759a4f9). Confirmed the production GetServiceClient switch routes ServiceNoSQL to NewCosmosDBClient in provider.go.

Additionally: Rebased onto origin/feat/multicloud-web-frontend (14 commits behind). During the conflict resolution a duplicate {common.ServiceNoSQL} entry was introduced; that was cleaned up in a follow-up commit (ced589e2c). The test matrix now covers: Compute, RelationalDB, NoSQL, Cache, MemoryDB, Search - exactly matching the 6 service types routed in the production switch.

Tests: go test ./... passes (468 tests), go vet and gofmt both clean.

@coderabbitai review

@cristim cristim force-pushed the fix/issue-473-azure-search-wiring branch from 0f78096 to ced589e Compare May 22, 2026 13:11
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 22, 2026

@cristim: Great work! The test matrix now fully mirrors the production GetServiceClient switch — all 6 service types (Compute, RelationalDB, NoSQL, Cache, MemoryDB, Search) are covered. The rebase onto feat/multicloud-web-frontend and the follow-up cleanup of the duplicate {common.ServiceNoSQL} entry (commit ced589e2c) are exactly the right approach. Triggering a fresh review now.

✅ 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
Copy link
Copy Markdown
Member Author

cristim commented May 22, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 22, 2026

✅ 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/xs Trivial / one-liner impact/all-users Affects every user priority/p2 Backlog-worthy severity/medium Moderate harm triaged Item has been triaged type/bug Defect urgency/this-sprint Within the current sprint

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant