Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

chore(oauth): cut the duplicate consent screen stories (#103505)

Rafael Audibert19d867f17db1
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index a69ad25f8b59..18ed72a6dcb7 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -9776,14 +9776,6 @@ snapshots:
hash: v1.k794b7964.4f421d7fb891d0a77a0211d80ec9efc6899b84fb14cf331833cd175bdc738b10.doktEISQ1Rqmw7byfMxsgoY3VnXeI5pvbAXUr8yfsT0
scenes-app-oauth-authorize--access-controls-apply--light:
hash: v1.k794b7964.327d8870ee3824291032975bb3e3c4ef9cfcbb852fdbe48bc4171fc22257a97d.hUBMUmi9_GsDBa3mryCkPtd3CC6BJDTyUVY0s62wB5g
- scenes-app-oauth-authorize--all-scopes-optional--dark:
- hash: v1.k794b7964.767c19354279e9bb950cc43ef82110119dbc2116300699a9adb0a049502221da.M09_tyl5B3_tDrOsts_8LKn6JwktVVhIF48ZlPNjW0M
- scenes-app-oauth-authorize--all-scopes-optional--light:
- hash: v1.k794b7964.b3b1d6ec2dd7fbfe1690e4b8f1c49206e084aa54df4eeb9274fe64d5c63ff83d.793MrlDdD7x3i_QDJYqUtJs7_CMQinaAQtFsnAjG40g
- scenes-app-oauth-authorize--all-scopes-required--dark:
- hash: v1.k794b7964.5c178e68dcf7ae3beeeeb18fc72f22f4ac33198230c3d03201e211f6f52c3706.RqPOVoCSmFGY1jWdGDf3esZFkOueSvAJHKmJBp7vpvk
- scenes-app-oauth-authorize--all-scopes-required--light:
- hash: v1.k794b7964.e0efa4768af4e4c1ac0f741d9c62bde840d3a205fa98742ef1b53771a957cfbb.G3POhS2LJF7fk8IJh0zmM17bx9mR4IS2PjieRGrhRmU
scenes-app-oauth-authorize--default-scopes--dark:
hash: v1.k794b7964.21a1602ada47b6704da18634c4c1386ba17b890500a833c52bd029cc98f69114.HOL3_R7J0JLMO_znhYmoxsZLaj0iqkemCyEIsK-HkA4
scenes-app-oauth-authorize--default-scopes--light:
@@ -9792,22 +9784,10 @@ snapshots:
hash: v1.k794b7964.5b544e241fa57ad7971a6872fce18c2d3e9dbbcfd5c6b4e2a861cc60683a7eda.SymJ-itmx0Mon5EALqTxh99r_VbtywIv8gFXju-9wRs
scenes-app-oauth-authorize--every-scope-requested--light:
hash: v1.k794b7964.44941f1c545b5bbfd22ead5b060e347364df80978d620f78ad4ca95676aa5312.Kn7pilekcaNutp0Z0MVnUy0iGMHklqAQGacKc0lJLw8
- scenes-app-oauth-authorize--every-scope-requested-scrolled-to-end--dark:
- hash: v1.k794b7964.5b544e241fa57ad7971a6872fce18c2d3e9dbbcfd5c6b4e2a861cc60683a7eda.gLSvVEeKbmA7YUlD7Jw056daksT3C2VpGN86wBKJkMU
- scenes-app-oauth-authorize--every-scope-requested-scrolled-to-end--light:
- hash: v1.k794b7964.44941f1c545b5bbfd22ead5b060e347364df80978d620f78ad4ca95676aa5312.e3Uvl_ZP1tnSSMFZU-GzcBepe2Nz90xOVFtxOe0Q3SA
scenes-app-oauth-authorize--identity-only-scopes--dark:
hash: v1.k794b7964.6e3f3f52d27e324920f358daaeadb32da366ff50210050c19f8de58d130fc1c1.sDKTyirwbr3u9MmHkz6rng_Hs_eKZHs-SBz0PbCtgTk
scenes-app-oauth-authorize--identity-only-scopes--light:
hash: v1.k794b7964.247a8dd0c0990f5be55cd872c28380228cebbab4aaf3fc7278452d920da1b723.-v0kuh_uR_IXDf7TZJ-zp-BBuwH1MC84DjGhsgkta0w
- scenes-app-oauth-authorize--many-optional-scopes--dark:
- hash: v1.k794b7964.ed7236b791f1885a80c8e308825334ea9c1fb33c67cbae1aa98c6fae12ff8c6d.wjzy_8MW69AdymaJU2hQR00ZPRM87GUk2hGbQuI-sE8
- scenes-app-oauth-authorize--many-optional-scopes--light:
- hash: v1.k794b7964.ec94f3f2f59bbab1800f5dd8394116bbfae20e450e4d10c9adec81c3c99f4c77.Ee_2N8_xvH7aiggs6ETS8SxXc0R0Qf_iX5q56_DeLzY
- scenes-app-oauth-authorize--required-read-floor-with-optional-write--dark:
- hash: v1.k794b7964.ce56f2483e994a71329cb4680e6d27de7d21826ad659cde1e3aacef4d5fa76e9.q2kyWCaocImuyB_NYXx6kCgzekEe2ULgO-PzTVd0J3w
- scenes-app-oauth-authorize--required-read-floor-with-optional-write--light:
- hash: v1.k794b7964.c3926f590bccb84062e2c45aa01a75e6477df138b1418f148bf79c67a34cd475.-dpBMlRXn3Y3lBQM7FYuXsFtIkYO9aw5UsSk0P6wl0I
scenes-app-oauth-authorize--wildcard-scope--dark:
hash: v1.k794b7964.9b96958067dc05edc0e8fcbe6192e5bd4b01a3c4b8a346a4e69e7ec6008397d8.gu62zWdVnryoqleY_jEV76T8ym5U7kyZvMovNElPAms
scenes-app-oauth-authorize--wildcard-scope--light:
diff --git a/frontend/src/scenes/oauth/OAuthAuthorize.stories.tsx b/frontend/src/scenes/oauth/OAuthAuthorize.stories.tsx
index f851cc0f745d..768bbd75ad7f 100644
--- a/frontend/src/scenes/oauth/OAuthAuthorize.stories.tsx
+++ b/frontend/src/scenes/oauth/OAuthAuthorize.stories.tsx
@@ -1,5 +1,4 @@
import { Decorator, Meta, StoryObj } from '@storybook/react'
-import { waitFor } from '@testing-library/dom'
import { router } from 'kea-router'
import { useEffect, useRef } from 'react'
@@ -72,6 +71,9 @@ const pushAuthorize = (scope?: string, resolvedScopes?: string[]): void => {
router.actions.push(`${urls.oauthAuthorize()}?${params.toString()}`)
}
+// One story per rendering of the consent screen, not per scope combination: what a level pick
+// grants, and how a required floor clamps it, is asserted in oauthAuthorizeLogic.test.ts, where a
+// reader sees the result instead of inferring it from a screenshot.
const meta: Meta = {
title: 'Scenes-App/OAuth/Authorize',
parameters: {
@@ -173,32 +175,6 @@ export const WithApplicationLogo: Story = {
},
}
-// Explicit request where every requested scope is required: rows render as a plain locked
-// checkmark list (no access selectors) and the bulk actions are hidden, since there is nothing
-// to choose.
-export const AllScopesRequired: Story = {
- decorators: [
- withOAuthApplication({
- required_scopes: ['experiment:read', 'experiment:write', 'query:read', 'feature_flag:write'],
- }),
- ],
- render: () => {
- useDelayedOnMountEffect(() => pushAuthorize('experiment:read experiment:write query:read feature_flag:write'))
- return <App />
- },
-}
-
-// Broad/deferred request (nothing required): every row gets a No access / Read / Write selector
-// capped at the requested level, plus the Select all / Read-only / Deselect all bulk actions.
-// This is the MCP case.
-export const AllScopesOptional: Story = {
- decorators: [withOAuthApplication({ required_scopes: [] })],
- render: () => {
- useDelayedOnMountEffect(() => pushAuthorize('experiment:read experiment:write query:read feature_flag:write'))
- return <App />
- },
-}
-
// Mixed: feature_flag:write is required but only read was requested (locked at write), and
// experiment:read is required but unrequested (an extra locked row). Both render in the
// checkmark list with a "Required" tag, while the rest keep their access selectors.
@@ -210,16 +186,6 @@ export const WithRequiredScopes: Story = {
},
}
-// A required read floor below a requested write: the row keeps its selector but "No access" is
-// disabled — the user can drop the grant to read, never below the floor.
-export const RequiredReadFloorWithOptionalWrite: Story = {
- decorators: [withOAuthApplication({ required_scopes: ['feature_flag:read'] })],
- render: () => {
- useDelayedOnMountEffect(() => pushAuthorize('feature_flag:write insight:write query:read'))
- return <App />
- },
-}
-
// Wildcard request: a single "All PostHog data" row where Read expands to every grantable
// object's read scope and Write grants `*`.
export const WildcardScope: Story = {
@@ -230,23 +196,6 @@ export const WildcardScope: Story = {
},
}
-// A long optional list (every scope the PostHog MCP server supports) — the case the bulk
-// actions exist for.
-export const ManyOptionalScopes: Story = {
- decorators: [withOAuthApplication({ required_scopes: [] })],
- render: () => {
- useDelayedOnMountEffect(() =>
- pushAuthorize(
- 'openid profile email user:read user:write organization:read project:read project:write ' +
- 'feature_flag:read feature_flag:write experiment:read experiment:write insight:read ' +
- 'insight:write dashboard:read dashboard:write query:read survey:read survey:write ' +
- 'event_definition:read event_definition:write error_tracking:read logs:read tracing:read'
- )
- )
- return <App />
- },
-}
-
// Sets the server flag that says one of the user's organizations has access-control rules.
// The story below shows the notice this flag adds under the permission list.
const withAccessControls: Decorator = function AccessControlsDecorator(Story): JSX.Element {
@@ -280,23 +229,3 @@ export const EveryScopeRequested: Story = {
return <App />
},
}
-
-// The same request, scrolled to the end of the permission list. This is what a person sees after
-// reading the whole list: the action row and the Permissions header both held in place.
-export const EveryScopeRequestedScrolledToEnd: Story = {
- decorators: [withPinnedSceneHeight, withOAuthApplication({ required_scopes: [] })],
- render: () => {
- useDelayedOnMountEffect(() => pushAuthorize(everyScopeRequest))
- return <App />
- },
- play: async () => {
- const scrollArea = await waitFor(() => {
- const element = document.querySelector<HTMLElement>('[data-attr="oauth-permissions-scroll"]')
- if (!element) {
- throw new Error('Permission list did not render')
- }
- return element
- })
- scrollArea.scrollTop = scrollArea.scrollHeight
- },
-}