Skip to content

WebBrokerAPI: Fix: Include webbroker_apis in GetAllConfigs UNION query #1965

Description

@coderabbitai

Summary

The GetAllConfigs function in gateway/gateway-controller/pkg/storage/sql_store.go builds a UNION query across all artifact type tables but is missing the webbroker_apis table. This means WebBrokerApi artifacts are saved and retrievable via direct lookup, but are silently omitted from full-list scans and in-memory cache hydration paths.

Impact

Any code path that calls GetAllConfigs (e.g., cache reload on gateway restart) will not return WebBrokerApi configurations, potentially causing stale or incomplete state.

Fix

Add a UNION branch for webbroker_apis in GetAllConfigs, consistent with the existing branches for rest_apis, websub_apis, llm_providers, llm_proxies, and mcp_proxies. Also increment the parameter count passed to s.query.

 		UNION ALL

+			SELECT a.uuid, a.kind, a.handle, a.display_name, a.version, wb.configuration, a.desired_state,
+				a.deployment_id, a.origin, a.created_at, a.updated_at, a.deployed_at,
+				a.cp_sync_status, a.cp_sync_info, a.cp_artifact_id
+			FROM artifacts a
+			JOIN webbroker_apis wb ON a.uuid = wb.uuid AND a.gateway_id = wb.gateway_id
+			WHERE a.gateway_id = ?
+
+		UNION ALL

 			SELECT a.uuid, a.kind, a.handle, a.display_name, a.version, lp.configuration, a.desired_state,

And update the query call:

-	rows, err := s.query(query, s.gatewayId, s.gatewayId, s.gatewayId, s.gatewayId, s.gatewayId)
+	rows, err := s.query(query, s.gatewayId, s.gatewayId, s.gatewayId, s.gatewayId, s.gatewayId, s.gatewayId)

References

Metadata

Metadata

Assignees

Labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions