Skip to content

feat(discord): Wire App Directory installs through the API pipeline modal#116429

Merged
evanpurkhiser merged 1 commit into
masterfrom
evanpurkhiser/feat-discord-wire-app-directory-installs-through-the-api-pipeline-modal
May 28, 2026
Merged

feat(discord): Wire App Directory installs through the API pipeline modal#116429
evanpurkhiser merged 1 commit into
masterfrom
evanpurkhiser/feat-discord-wire-app-directory-installs-through-the-api-pipeline-modal

Conversation

@evanpurkhiser
Copy link
Copy Markdown
Member

When a user installs the Sentry Discord app from Discord's App Directory, Discord redirects to /extensions/discord/configure/ with code and guild_id. The configure URL forwards to /extensions/discord/link/ (the org-picker), and from there the install needs to drive the existing API pipeline modal — there's a Discord-specific pipeline (added in #116375) that consumes those params and completes the install.

This wires up the frontend side of that flow.

In the org-link view (IntegrationOrganizationLink):

  • Add a discordAppDirectoryParams memo that returns {code, guild_id, use_configure: '1'} when code and guild_id are present in the URL query, else null.
  • Refactor handleInstallClick to dispatch via gitHubAppListingParams ?? discordAppDirectoryParams — whichever is non-null routes through startFlow, otherwise we fall back to the legacy install path.
  • Rename onInstallWithInstallationIdonInstall since both flows use it now.
  • Refresh the top-of-component docstring to enumerate both provider-initiated entry points.

In the Discord pipeline step (integrationDiscord):

  • Make stepData a discriminated union of the existing OAuth shape ({oauthUrl}) and the new App Directory shape ({appDirectoryInstall: true, code, guildId, state}).
  • When the backend signals appDirectoryInstall, auto-advance via a useEffect (guarded by a ref so React strict mode doesn't double-POST) and render <Text>Finishing up Discord integration installation...</Text> instead of the OAuth button.

Backend support landed in #116375.

…odal

When a user installs the Sentry Discord app from Discord's App Directory,
Discord redirects to `/extensions/discord/configure/` with `code` and
`guild_id`. The configure URL forwards to `/extensions/discord/link/`
(the org-picker), and from there the install needs to drive the existing
API pipeline modal — there's a Discord-specific pipeline that consumes
those params and completes the install.

This wires up the frontend side of that flow.

In the org-link view (`IntegrationOrganizationLink`):

  - Add a `discordAppDirectoryParams` memo that returns
    `{code, guild_id, use_configure: '1'}` when `code` and `guild_id`
    are present in the URL query, else null.
  - Refactor `handleInstallClick` to dispatch via
    `gitHubAppListingParams ?? discordAppDirectoryParams` — whichever
    is non-null routes through `startFlow`, otherwise we fall back to
    the legacy install path.
  - Rename `onInstallWithInstallationId` → `onInstall` since both
    flows use it now.
  - Refresh the top-of-component docstring to enumerate both
    provider-initiated entry points.

In the Discord pipeline step (`integrationDiscord`):

  - Make `stepData` a discriminated union of the existing OAuth shape
    (`{oauthUrl}`) and the new App Directory shape
    (`{appDirectoryInstall: true, code, guildId, state}`).
  - When the backend signals `appDirectoryInstall`, auto-advance via
    a `useEffect` (guarded by a ref so React strict mode doesn't
    double-POST) and render
    `<Text>Finishing up Discord integration installation...</Text>`
    instead of the OAuth button.

Backend support landed in #116375.
@evanpurkhiser evanpurkhiser requested a review from a team as a code owner May 28, 2026 20:45
@evanpurkhiser evanpurkhiser requested review from TkDodo and leeandher and removed request for a team May 28, 2026 20:45
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label May 28, 2026
@github-actions
Copy link
Copy Markdown
Contributor

📊 Type Coverage Diff

✅ No new type safety issues introduced. Coverage: 93.59%

Comment thread static/app/components/pipeline/integrationDiscord/index.tsx
@evanpurkhiser evanpurkhiser merged commit 8939d2d into master May 28, 2026
77 checks passed
@evanpurkhiser evanpurkhiser deleted the evanpurkhiser/feat-discord-wire-app-directory-installs-through-the-api-pipeline-modal branch May 28, 2026 20:51
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

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 70292ad. Configure here.

guildId: stepData.guildId,
state: stepData.state,
});
}, [stepData, advance]);
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.

Ref guard prevents auto-advance retry after pipeline restart

Medium Severity

The hasAutoAdvanced ref is never reset, so if the auto-advance fails with a recoverable 4xx error and the user clicks "Start over" in the pipeline modal, the component stays mounted across the restart (since initializing status still renders it), the ref remains true, and the useEffect never re-fires advance. The user sees "Finishing up Discord integration installation..." forever with no retry mechanism. The ref correctly guards against React strict mode double-firing, but it also blocks legitimate re-attempts after a pipeline restart.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 70292ad. Configure here.

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