Skip to content

chore(scm-first-messaging-integration): Fetching providers list and exposing connection status - #121631

Open
Abdkhan14 wants to merge 4 commits into
abdk/slack-channel-name-vs-id-fixfrom
abdk/useScmMessagingProviders-hook
Open

chore(scm-first-messaging-integration): Fetching providers list and exposing connection status#121631
Abdkhan14 wants to merge 4 commits into
abdk/slack-channel-name-vs-id-fixfrom
abdk/useScmMessagingProviders-hook

Conversation

@Abdkhan14

@Abdkhan14 Abdkhan14 commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

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. SetupMessagingIntegrationButton runs nearly the same two queries but reduces them to a flat, unkeyed providers[] and a single all-or-nothing boolean ("is nothing active?"), with the logic buried inside a component alongside modal and feature-gate rendering. useScmProviders follows the same pattern but for a different domain — source-code providers filtered by isScmProvider, returning raw Integration[] 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 a useQueries fan-out over /config/integrations/?provider_key=… (provider metadata for each curated key) — and transforms them into one ScmMessagingProviderViewModel per provider. It preserves the index→key association so row order always matches SCM_MESSAGING_PROVIDER_KEYS, ignores inactive integrations (treating them as uninstalled via the shared isIntegrationActive), and computes a status per row: installable (no active integration), connected (active and eligible), or permission-limited (tenant-type MS Teams, which can't receive issue alerts). It also exposes refetchIntegrations() so row components can refresh state after a successful install. Covered by 7 tests spanning every status transition, inactive-ignored, error state, and ordering.

@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Aug 10, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📊 Type Coverage Diff

Metric Before After Delta
Coverage 94.29% 94.29% ±0%
Typed 133,855 133,874 🟢 +19
Untyped 8,113 8,114 🔴 +1
🔍 1 new type safety issue introduced

Type assertions (as) (1 new)

File Line Detail
static/app/components/onboarding/scm/useScmMessagingProviders.ts 92 as Partial<Record<ScmMessagingProviderKey, IntegrationProvider>>Object.fromEntries( results.map((r, i) => [SCM_MESSAGING_PROVIDER_KEYS[i], r.da…

This is informational only and does not block the PR.

@Abdkhan14
Abdkhan14 marked this pull request as ready for review August 13, 2026 16:00

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

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

Comment thread static/app/components/onboarding/scm/useScmMessagingProviders.ts
Comment thread static/app/components/onboarding/scm/useScmMessagingProviders.ts
Comment thread static/app/components/onboarding/scm/useScmMessagingProviders.ts
mockIntegrations([
OrganizationIntegrationsFixture({
id: '10',
provider: {key: 'slack'} as any,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

could these as anys be {...OrganizationIntegrationsFixture().provider, key: 'msteams'} instead? the slack one is already the fixture default so it can just go away

@Abdkhan14 Abdkhan14 Aug 14, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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?

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

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants