feat(discord): Wire App Directory installs through the API pipeline modal#116429
Conversation
…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.
📊 Type Coverage Diff✅ No new type safety issues introduced. Coverage: 93.59% |
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 70292ad. Configure here.
| guildId: stepData.guildId, | ||
| state: stepData.state, | ||
| }); | ||
| }, [stepData, advance]); |
There was a problem hiding this comment.
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.
Reviewed by Cursor Bugbot for commit 70292ad. Configure here.


When a user installs the Sentry Discord app from Discord's App Directory, Discord redirects to
/extensions/discord/configure/withcodeandguild_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):discordAppDirectoryParamsmemo that returns{code, guild_id, use_configure: '1'}whencodeandguild_idare present in the URL query, else null.handleInstallClickto dispatch viagitHubAppListingParams ?? discordAppDirectoryParams— whichever is non-null routes throughstartFlow, otherwise we fall back to the legacy install path.onInstallWithInstallationId→onInstallsince both flows use it now.In the Discord pipeline step (
integrationDiscord):stepDataa discriminated union of the existing OAuth shape ({oauthUrl}) and the new App Directory shape ({appDirectoryInstall: true, code, guildId, state}).appDirectoryInstall, auto-advance via auseEffect(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.