Skip to content

feat(data-warehouse): render oauth-account-select fields in DynamicSourceSetup#3401

Open
Gilbert09 wants to merge 2 commits into
mainfrom
tom/inbox-github-account-picker
Open

feat(data-warehouse): render oauth-account-select fields in DynamicSourceSetup#3401
Gilbert09 wants to merge 2 commits into
mainfrom
tom/inbox-github-account-picker

Conversation

@Gilbert09

Copy link
Copy Markdown
Member

Problem

The inbox source-setup renderer (DynamicSourceSetup) handles input, select, switch-group, and oauth fields, but not the backend's oauth-account-select field type — a picker whose options are the accounts/resources a connected OAuth integration exposes (e.g. GitHub repositories). Without it, a source whose config uses that field type can't be set up from the inbox.

Changes

  • Add a getOauthAccounts(projectId, sourceType, integrationId, search?) api-client method (hits external_data_sources/oauth_accounts/; the backend uses the integration's stored token, so the client only passes an id).
  • Render oauth-account-select in DynamicSourceSetup: a searchable picker that reads its integration id from the sibling integrationField in the flat form values, fetches options with debounced (300ms) server-side search, and lets the user pick one. Falls back to a free-text input until a valid integration is connected. Handled in buildPayload / missingRequiredFields too.

This is the Code-app consumer for the field type, paired with the posthog-side work (server-side search + GitHub adoption). Routing GitHub's inbox setup through DynamicSourceSetup — so its repository field uses this picker and the bespoke GitHubSetup is removed — is a follow-up: it needs the GitHub App-install connect wired into the generic OAuth field and is best verified with the app running.

How did you test this?

  • pnpm --filter @posthog/ui --filter @posthog/api-client typecheck — clean for the changed files.
  • Biome lint/format clean.
  • Not verified in the running app (no CDP session here): the live picker fetch/search. It follows the existing DynamicSourceSetup field patterns.

Automatic notifications

  • Publish to changelog?
  • Alert Sales and Marketing teams?

…urceSetup

Add support for the backend's `oauth-account-select` field type (a picker
whose options are the accounts/resources a connected OAuth integration
exposes, e.g. GitHub repositories) to the inbox's generic source-setup
renderer, plus a `getOauthAccounts` api-client method.

The picker reads its integration id from the sibling `integrationField`
in the (flat) form values, fetches options from the oauth_accounts
endpoint with debounced server-side search, and falls back to free text
until an integration is connected. The backend uses the integration's
stored token; the client only passes the id.

This is the Code-app consumer for the field type. Routing GitHub's inbox
setup through DynamicSourceSetup (repository field uses this picker,
removing the bespoke GitHubSetup) is a follow-up, gated on the posthog
config swap and best verified with the app running.
@trunk-io

trunk-io Bot commented Jul 13, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@github-actions

github-actions Bot commented Jul 13, 2026

Copy link
Copy Markdown

React Doctor found 1 issue in 1 file · 1 warning.

1 warning

src/features/inbox/components/DynamicSourceSetup.tsx

Reviewed by React Doctor for commit 8ab28f2.

@greptile-apps

greptile-apps Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Security Review

The new picker submits account/resource ids tied to stored OAuth integrations. The UI can keep stale or manually typed account values across OAuth changes, so backend ownership checks remain required to prevent using resources outside the active integration.

Reviews (1): Last reviewed commit: "feat(data-warehouse): render oauth-accou..." | Re-trigger Greptile

Comment thread packages/ui/src/features/inbox/components/DynamicSourceSetup.tsx
Comment thread packages/ui/src/features/inbox/components/DynamicSourceSetup.tsx
@Gilbert09 Gilbert09 requested a review from a team July 13, 2026 16:30
Reset the oauth-account-select selection when the backing integration
changes, so an account (or fallback text) chosen for one integration
can't survive into another and be submitted as an account that was
never selected for the active integration.

Also stop treating typed text as a committed value: typing only filters
the list, and picking an option shows the account's human-readable name
while submitting its opaque value. Editing the text after a selection
clears the committed value rather than silently mutating the underlying
account id.

Generated-By: PostHog Code
Task-Id: d1804989-7d93-42d8-ba74-a5d496495c31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant