fix: add error messages to provider status for misconfig#407
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughAdds an Error string to ProviderMetadata, surfaces provider workspace-resolution errors in the ListNotificationProviders response, updates the Slack provider to cache and expose resolver errors, extends tests, and updates OpenAPI/docs to include the new ChangesProvider Error Exposure
sequenceDiagram
participant Client as API Client
participant Handler as NotificationsHandler
participant Provider as SlackProvider
participant Resolver as WorkspaceResolver
participant Docs as OpenAPI
Client->>Handler: GET /notifications/providers
Handler->>Provider: ProviderMetadata()
Provider->>Provider: workspaceConfigurationDetails()
Provider->>Resolver: ResolveWorkspaceConfiguration()
alt Resolver fails
Resolver-->>Provider: error
Provider->>Provider: cache workspaceConfigurationErr
Provider-->>Handler: ProviderMetadata{Error: "..."}
else Resolver succeeds
Resolver-->>Provider: configuration
Provider->>Provider: cache configuration
Provider-->>Handler: ProviderMetadata{Metadata: {...}, Error: ""}
end
Handler-->>Client: JSON list including `error` field
Handler->>Docs: schema includes `error` (docs updated)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
There was a problem hiding this comment.
Pull request overview
Adds provider-level error details to notification provider metadata so the admin “list providers” endpoint can surface misconfiguration/connection issues (e.g., Slack auth failures) alongside enabled status and other metadata.
Changes:
- Extend
notification.ProviderMetadatato include anErrorstring. - Populate Slack provider metadata with resolver errors when workspace configuration lookup fails.
- Expose provider errors via
/admin/notifications/providersresponse and add tests for both Slack provider metadata and the handler response.
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 |
|---|---|
internal/service/notification/transport.go |
Adds Error field to the shared ProviderMetadata struct. |
internal/service/notification/providers/slack/provider.go |
Returns workspace configuration lookup errors and surfaces them in Slack provider metadata. |
internal/service/notification/providers/slack/provider_test.go |
Verifies Slack provider metadata includes/clears error across retry and recovery. |
internal/api/handler/notifications.go |
Adds error field to admin provider list response payload. |
internal/api/handler/notifications_test.go |
Tests that the admin provider list endpoint returns provider errors in JSON. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| workspaceConfigurationMu sync.Mutex | ||
| workspaceConfigurationLoaded bool | ||
| workspaceConfiguration slacksvc.WorkspaceConfiguration | ||
| workspaceConfigurationErr error |
gusfcarvalho
left a comment
There was a problem hiding this comment.
pending swagger gen ;)
Summary by CodeRabbit