: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(experiments): stop reporting self-handled concurrency 409s to error tracking (#108464)
Juraj Majerike259b4d8e5c3
diff --git a/frontend/src/lib/api-error.test.ts b/frontend/src/lib/api-error.test.tsindex ceadfac23dcd..a9e64a24c318 100644--- a/frontend/src/lib/api-error.test.ts+++ b/frontend/src/lib/api-error.test.ts@@ -98,12 +98,13 @@ describe('api-error', () => {['a 2FA verification gate', { status: 403, code: 'two_factor_verification_required' }, false],['a re-auth gate', { status: 403, code: 'sensitive_action_required_reauth' }, false],['an approvals 409', { status: 409, data: { change_request_id: 'abc' } }, false],+ ['an optimistic-concurrency 409', { status: 409, data: { current_version: 5 } }, false],['a 502', { status: 502 }, false],['a 503', { status: 503 }, false],['a 504', { status: 504 }, false],// Only the listed codes are excused: a 403 the app does not recover from is still a signal.['a 403 with no code', { status: 403 }, true],- ['a 409 that is not an approvals gate', { status: 409, data: {} }, true],+ ['a 409 that is neither an approvals gate nor a concurrency conflict', { status: 409, data: {} }, true],['a 500 backend exception', { status: 500 }, true],['a 400 validation error', { status: 400 }, true],// A route the backend does not serve stays reportable here. Only a caller that alreadydiff --git a/frontend/src/lib/api-error.ts b/frontend/src/lib/api-error.tsindex f15b637a11b7..03e351df1b8d 100644--- a/frontend/src/lib/api-error.ts+++ b/frontend/src/lib/api-error.ts@@ -163,6 +163,8 @@ export function isBrowserNetworkFailure(error: unknown): boolean {* - 403 `permission_denied` — the sceneLogic gates render the AccessDenied scene.* - 403 auth gates — `apiStatusLogic` opens 2FA setup, re-verification, or a re-auth prompt.* - 409 carrying a `change_request_id` — the approvals UI shows the change request it created.+ * - 409 carrying a `current_version` — an optimistic-concurrency conflict (experiments). The+ * editing surface toasts, reloads the fresh state, and keeps the user's unsaved edits.* - 404 `Project not found.` / `Organization not found.` — the scope in the URL is gone, so every* request under it fails the same way. The scene routing takes the user off that URL, and until* it does, a poll on the dead scope would otherwise file one exception per tick.@@ -216,6 +218,9 @@ export function shouldReportApiFailure(error: unknown): boolean {if (status === 403 && failure.code != null && HANDLED_AUTH_GATE_CODES.has(failure.code)) {return false}+ if (status === 409 && failure.data?.current_version !== undefined) {+ return false+ }return !isApprovalRequiredError(failure)}