fix(experiments): improve error handling for the experiment actors query.#53817
fix(experiments): improve error handling for the experiment actors query.#53817
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
This comment was marked as outdated.
This comment was marked as outdated.
|
🎭 Playwright report · View test results →
These issues are not necessarily caused by your changes. |
|
| // Only show "Click to inspect actors" hint when clicking will actually work: | ||
| // - Step 0 (exposure) with new feature enabled: can't use actors query (returns early), so don't show hint | ||
| // - Step 0 with legacy: can use sampled sessions, show hint if sessionData exists | ||
| // - Step > 0 with new feature: can use actors query, show hint | ||
| // - Step > 0 with legacy: can use sampled sessions, show hint if sessionData exists | ||
| // - Step 1 (first metric) drop-offs with new feature: can't query (no exposure in backend funnel), conversions work | ||
| // - Step 2+ with new feature: both conversions and drop-offs work | ||
| // - Legacy mode: show hint if sessionData exists | ||
| const hasClickableData = hasActorsQueryFeature ? stepIndex > 0 : !!sessionData | ||
| showTooltip([rect.x, rect.y, rect.width], stepIndex, step, hasClickableData) |
There was a problem hiding this comment.
Tooltip hint shown for non-clickable drop-off area at step 1
hasClickableData is true for stepIndex === 1 (since stepIndex > 0), so the "Click to inspect actors" tooltip hint appears when hovering anywhere over the step 1 bar — including the drop-off backdrop which has a default cursor and silently returns early on click. The cursor already signals non-clickability, but the tooltip text is still misleading for that segment.
The comment above correctly notes "Step 1 drop-offs: conversions work", so the tooltip is intentionally showing for conversions at step 1. Worth clarifying the comment or, if the tooltip implementation supports it, passing a more granular signal to distinguish conversion vs. drop-off clickability.
Prompt To Fix With AI
This is a comment left during a code review.
Path: frontend/src/scenes/experiments/charts/funnel/StepBar.tsx
Line: 189-195
Comment:
**Tooltip hint shown for non-clickable drop-off area at step 1**
`hasClickableData` is `true` for `stepIndex === 1` (since `stepIndex > 0`), so the "Click to inspect actors" tooltip hint appears when hovering anywhere over the step 1 bar — including the drop-off backdrop which has a `default` cursor and silently returns early on click. The cursor already signals non-clickability, but the tooltip text is still misleading for that segment.
The comment above correctly notes "Step 1 drop-offs: conversions work", so the tooltip is intentionally showing for conversions at step 1. Worth clarifying the comment or, if the tooltip implementation supports it, passing a more granular signal to distinguish conversion vs. drop-off clickability.
How can I resolve this? If you propose a fix, please make it concise.| // For drop-offs, the mapping is straightforward | ||
| // Frontend step 2 drop-off = "completed backend step 0 ($pageview) but not step 1 (uploaded_file)" = backend -2 = -stepIndex | ||
| // Frontend step 3 drop-off = "completed backend step 1 (uploaded_file) but not step 2 (next event)" = backend -3 = -stepIndex | ||
| const funnelStep = converted ? backendStepNo : -backendStepNo |
There was a problem hiding this comment.
The comment contains incorrect backend step numbering that contradicts the earlier comment and actual implementation. Lines 69-70 correctly state that backend uses step 1 for the first metric event ($pageview), but lines 87-88 incorrectly claim backend step 0 is $pageview. This creates confusion about the step mapping.
According to the test data:
- Step -2 means "completed step 1 (signup) but not step 2 (purchase)"
- Not "completed backend step 0 but not step 1" as the comment suggests
The comment should be:
// For drop-offs, the mapping is straightforward
// Frontend step 2 drop-off = "completed step 1 ($pageview) but not step 2 (click)" = backend -2 = -stepIndex
// Frontend step 3 drop-off = "completed step 2 (click) but not step 3 (next event)" = backend -3 = -stepIndex| // For drop-offs, the mapping is straightforward | |
| // Frontend step 2 drop-off = "completed backend step 0 ($pageview) but not step 1 (uploaded_file)" = backend -2 = -stepIndex | |
| // Frontend step 3 drop-off = "completed backend step 1 (uploaded_file) but not step 2 (next event)" = backend -3 = -stepIndex | |
| const funnelStep = converted ? backendStepNo : -backendStepNo | |
| // For drop-offs, the mapping is straightforward | |
| // Frontend step 2 drop-off = "completed step 1 ($pageview) but not step 2 (click)" = backend -2 = -stepIndex | |
| // Frontend step 3 drop-off = "completed step 2 (click) but not step 3 (next event)" = backend -3 = -stepIndex | |
| const funnelStep = converted ? backendStepNo : -backendStepNo | |
Spotted by Graphite
Is this helpful? React 👍 or 👎 to let us know.

Problem
The experiment actor's query is failing for some edge cases, returning unusable errors.
Changes
We are covering the edge cases, adding tests, and improving the error messages returned by the query.
How did you test this code?
hogli test posthog/hogql_queries/experiments/test/test_experiment_actors_query.py -v👉 Stay up-to-date with PostHog coding conventions for a smoother review.
Publish to changelog?
do not publish to changelog
Docs update