: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(error-tracking): show wizard while waiting for first exception (#107612)
Aleksander Błaszkiewicz4cb1b698bcf8
diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex fd07cc411e0d..fc8627971d7f 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -1965,13 +1965,17 @@ snapshots:components-product-empty-state--error-tracking-needs-setup--light:hash: v1.k794b7964.be69fb2d7626d2f631ee941b123d04e42a5d237dc6bbb80dd790b41b0242bdc0.FX15-USN-cvQDOl2KiW7Do-QQdO4k3F5oqYk8Pk89fEcomponents-product-empty-state--error-tracking-needs-setup-new-wizard--dark:- hash: v1.k794b7964.0d34f53819734a958ae3a1f0ba0f3fa5c9047f207fbf2918baff781ad85b8633.ul7zqUagfeWXeADQMOCCm1MAZFah0BMDpXl0N59N4F8+ hash: v1.k794b7964.b01662684cc1beca4f47470388b52aa881b4a2839da90a49425b6131cca1f256.5Kj1jy3sYwy-jKsVcdH4tnBPNgMv3l_ceQT-kHSej8Mcomponents-product-empty-state--error-tracking-needs-setup-new-wizard--light:- hash: v1.k794b7964.df01ad4718becd1251b8a036d13d3bda3bb9ab9b5cbd1b2799024adcc7bc01d1.xUk5JSNd0b8og8Gvtbkf-QoNtBzSqXIgd3a_wuNGhV4+ hash: v1.k794b7964.5ef07ad85b5c6d8eaab8c01ed0bb37d0b5b48a8d1c171e53ae7e286441eeba1f.13zxx_SQqtq4ddUqG4VFHRTUDcCy5QfZos9rbISXHTMcomponents-product-empty-state--error-tracking-waiting-for-data--dark:hash: v1.k794b7964.f2a1ee553c96a22e20a1b9be7e92e19e0ada146b5aebc004aceb50b8645b4d64.pktEH1C9D3Ds9ErUnVBH9yvhEbFUxlMoUXAaRdsCsWIcomponents-product-empty-state--error-tracking-waiting-for-data--light:hash: v1.k794b7964.153341c2cb3be4ca5f36d85b9acb051d61359bf976fc95a065ba15f9884225f7.Y1A6T5VkZ5TIAHbi4fTUePu7Wtyn-P45mtaOPF5XSVw+ components-product-empty-state--error-tracking-waiting-for-data-new-wizard--dark:+ hash: v1.k794b7964.105510be5ccb616f7d6f8fa1c6aacc7d5981859dca698daa66f265754e24c888.33DC63BUHL__QE_8nh6PZVP8MaRbM4bNKJHTj71JdJU+ components-product-empty-state--error-tracking-waiting-for-data-new-wizard--light:+ hash: v1.k794b7964.1c2478e9c9e74eb47d896585f4f78e377c27a838e4f60cb35f7e685709d4fff9.xW8y7FqybbzrWn2szBUXyfUTJMNMrCVmSVBDVa6Fpbgcomponents-product-empty-state--evaluations-needs-setup--dark:hash: v1.k794b7964.d66a917dd9bbb71fe2c50f81b2c5a873af729170292973601909c77c6ed54304.X1ueW3Kooz45WUhf9edIjjWCpiT9MwXfZAuclmpxL_Mcomponents-product-empty-state--evaluations-needs-setup--light:diff --git a/frontend/src/lib/components/ProductEmptyState/ProductEmptyState.stories.tsx b/frontend/src/lib/components/ProductEmptyState/ProductEmptyState.stories.tsxindex 9b477f5ace31..0491c1ea3a1b 100644--- a/frontend/src/lib/components/ProductEmptyState/ProductEmptyState.stories.tsx+++ b/frontend/src/lib/components/ProductEmptyState/ProductEmptyState.stories.tsx@@ -353,6 +353,14 @@ export const ErrorTrackingNeedsSetupNewWizard: ProductEmptyStateStory = {},}+export const ErrorTrackingWaitingForDataNewWizard: ProductEmptyStateStory = {+ ...ErrorTrackingWaitingForData,+ parameters: {+ ...ErrorTrackingWaitingForData.parameters,+ featureFlags: [FEATURE_FLAGS.ERROR_TRACKING_NEW_WIZARD],+ },+}+// Logs detection asks the has-logs API on mount - answer "none yet".export const LogsNeedsSetup: ProductEmptyStateStory = productEmptyStateStory(logsEmptyState, 'needs-setup', {// nosemgrep: no-environments-api-urls-frontend -- api.logs is env-scoped, so the msw mock must match /api/environments to intercept itdiff --git a/frontend/src/lib/components/ProductEmptyState/ProductEmptyState.test.tsx b/frontend/src/lib/components/ProductEmptyState/ProductEmptyState.test.tsxindex 382b4b190522..e28f0cedf51b 100644--- a/frontend/src/lib/components/ProductEmptyState/ProductEmptyState.test.tsx+++ b/frontend/src/lib/components/ProductEmptyState/ProductEmptyState.test.tsx@@ -11,6 +11,8 @@ import { ProductKey } from '~/queries/schema/schema-general'import { initKeaTests } from '~/test/init'import { AccessControlLevel, AccessControlResourceType, AppContext } from '~/types'+import { errorTrackingEmptyState } from 'products/error_tracking/frontend/emptyState/errorTrackingEmptyState'+import { ProductEmptyState } from './ProductEmptyState'import type { ProductEmptyStateConfig } from './types'@@ -165,6 +167,56 @@ describe('ProductEmptyState', () => {expect(screen.getByText('Headline')).toBeTruthy()})+ it.each([+ [false, true, false],+ [true, true, true],+ [true, false, false],+ ])(+ 'in error tracking waiting mode with new wizard flag on=%s and cloud=%s renders the command: %s',+ async (flagOn, cloud, expected) => {+ useMocks({ get: { '/_preflight/': { cloud } } })+ preflightLogic.actions.loadPreflight()+ await expectLogic(preflightLogic).toDispatchActions(['loadPreflightSuccess'])+ featureFlagLogic.mount()+ featureFlagLogic.actions.setFeatureFlags(+ [],+ flagOn ? { [FEATURE_FLAGS.ERROR_TRACKING_NEW_WIZARD]: true } : {}+ )++ render(<ProductEmptyState config={errorTrackingEmptyState.config} mode="waiting-for-data" />)++ if (expected) {+ expect(await screen.findByLabelText(/Copy command/)).toBeTruthy()+ expect(screen.getByText('Waiting for the first exception')).toBeTruthy()+ expect(screen.getByText(/Check your SDK integration/)).toBeTruthy()+ } else {+ expect(screen.queryByLabelText(/Copy command/)).toBeNull()+ if (flagOn) {+ expect(screen.getByText('Waiting for the first exception')).toBeTruthy()+ expect(screen.getByText(/Check that your app is configured to capture exceptions/)).toBeTruthy()+ expect(screen.queryByText(/Run Wizard/)).toBeNull()+ } else {+ expect(screen.getByText("You're set up. Waiting for the first exception")).toBeTruthy()+ }+ }+ }+ )++ it('offers manual setup without Wizard guidance on self-hosted instances', async () => {+ useMocks({ get: { '/_preflight/': { cloud: false } } })+ preflightLogic.actions.loadPreflight()+ await expectLogic(preflightLogic).toDispatchActions(['loadPreflightSuccess'])+ featureFlagLogic.mount()+ featureFlagLogic.actions.setFeatureFlags([], { [FEATURE_FLAGS.ERROR_TRACKING_NEW_WIZARD]: true })++ render(<ProductEmptyState config={errorTrackingEmptyState.config} mode="needs-setup" />)++ expect(screen.queryByLabelText(/Copy command/)).toBeNull()+ expect(screen.queryByText(/Run Wizard/)).toBeNull()+ expect(screen.getByText(/Check your SDK integration/)).toBeTruthy()+ expect(screen.getByText('Set up Error tracking')).toBeTruthy()+ })+// `beside` renders a pair and a container query hides one of them at any width. A lazy// image with no layout box has nothing to intersect, so the browser can leave it unfetched// until a resize reveals it. The Storybook image gate skips hidden images.diff --git a/products/error_tracking/frontend/emptyState/errorTrackingEmptyState.tsx b/products/error_tracking/frontend/emptyState/errorTrackingEmptyState.tsxindex 52376a1dcd94..9c3004c0ed79 100644--- a/products/error_tracking/frontend/emptyState/errorTrackingEmptyState.tsx+++ b/products/error_tracking/frontend/emptyState/errorTrackingEmptyState.tsx@@ -56,17 +56,18 @@ export const errorTrackingEmptyState: SceneProductEmptyState = {manualSetupUrl: 'https://posthog.com/docs/error-tracking/installation',previewLabel: 'Issues, once exceptions arrive',Preview: ErrorTrackingPreview,- // The `error-tracking` wizard subcommand is still rolling out. While its flag is on the terminal- // card is the only call to action, so the one-click opt-in and its lead-in leave the setup screen.- // The wizard is keyed to setup: once autocapture is on the screen only waits for an exception.featureFlagOverrides: {[FEATURE_FLAGS.ERROR_TRACKING_NEW_WIZARD]: {text: {'needs-setup': {- hint: 'Run Wizard in your project. The setup agent installs the SDK if needed, then adds exception capture and source map upload:',+ hint: 'Check your SDK integration and set up exception capture and source map upload if needed:',+ },+ 'waiting-for-data': {+ headline: 'Waiting for the first exception',+ lead: "Exception autocapture is enabled for this project, but that alone doesn't confirm your app sends exceptions. Check that your app is configured to capture exceptions.",},},- wizard: { 'needs-setup': { slug: 'error-tracking', pinProjectId: true } },+ wizard: { slug: 'error-tracking', pinProjectId: true },primaryAction: undefined,},},