chore(scm-first-messaging-integration): Fetching providers list and exposing connection status - #121631
Conversation
📊 Type Coverage Diff
🔍 1 new type safety issue introducedType assertions (
This is informational only and does not block the PR. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit d756fbb. Configure here.
| mockIntegrations([ | ||
| OrganizationIntegrationsFixture({ | ||
| id: '10', | ||
| provider: {key: 'slack'} as any, |
There was a problem hiding this comment.
could these as anys be {...OrganizationIntegrationsFixture().provider, key: 'msteams'} instead? the slack one is already the fixture default so it can just go away
There was a problem hiding this comment.
Yup valid, I pushed the change for this, remove the anys
|
|
||
| // Find the first active integration for this provider. Inactive | ||
| // integrations are treated the same as no integration. | ||
| const integration = integrations.find( |
There was a problem hiding this comment.
medium: the experiment supports one selected destination, but this currently takes only the first active integration for each provider. an org with multiple Slack workspaces will have no way to select another workspace in the downstream single-select. could the view model preserve all active integrations for this provider while still allowing only one selected destination?

Blocked by: #121964
Problem
The new inline messaging step needs to render one row per curated provider (Slack, Discord, MS Teams), each showing whether that provider is installable, already connected, or connected-but-ineligible. Nothing in the codebase produces that shape.
SetupMessagingIntegrationButtonruns nearly the same two queries but reduces them to a flat, unkeyedproviders[]and a single all-or-nothing boolean ("is nothing active?"), with the logic buried inside a component alongside modal and feature-gate rendering.useScmProvidersfollows the same pattern but for a different domain — source-code providers filtered byisScmProvider, returning rawIntegration[]with no messaging keys or issue-alert eligibility. Neither gives the rows a per-provider, status-carrying view model to bind to.Fix
Add
useScmMessagingProviders, a purpose-built data hook that joins the two endpoints —/integrations/?integrationType=messaging(installed integrations) and auseQueriesfan-out over/config/integrations/?provider_key=…(provider metadata for each curated key) — and transforms them into oneScmMessagingProviderViewModelper provider. It preserves the index→key association so row order always matchesSCM_MESSAGING_PROVIDER_KEYS, ignores inactive integrations (treating them as uninstalled via the sharedisIntegrationActive), and computes astatusper row:installable(no active integration),connected(active and eligible), orpermission-limited(tenant-type MS Teams, which can't receive issue alerts). It also exposesrefetchIntegrations()so row components can refresh state after a successful install. Covered by 7 tests spanning every status transition, inactive-ignored, error state, and ordering.