Skip to content

fix(experiments): Classify NOT_AN_AGGREGATE as a metric config error - #90715

Merged
trunk-io[bot] merged 1 commit into
masterfrom
experiments/notanaggregate-user-error
Aug 28, 2026
Merged

trunk-io[bot] merged 1 commit into
masterfrom
experiments/notanaggregate-user-error

Conversation

@jurajmajerik

Copy link
Copy Markdown
Contributor

Problem

CHQueryErrorNotAnAggregate from experiment queries (~53/week, error tracking) is user-authored HogQL referencing a row-level column (person_id, timestamp) outside an aggregate — every tracked occurrence carries contains_user_hogql, and affected metrics get edited by their owners shortly after. It's treated as a platform error: captured to error tracking, shown as a generic failure, and retried 3–17× per metric by the recalculation and timeseries workers.

Changes

  • classify_experiment_query_error maps NOT_AN_AGGREGATE to validation_error, which is already in NON_RETRYABLE_ERROR_TYPES — workers fail it permanently instead of retrying.
  • The error boundary converts it to an actionable ValidationError ("references an event column outside an aggregate function — wrap the value in an aggregation") for user-facing callers, re-raises raw for internal ones, and skips capture_exception.
  • The recalculation worker's own capture also skips validation_error-class failures.

How did you test this code?

Tests: classifier cases for raw code 215 and the wrapped error; decorator converts with actionable message and no capture (user-facing), re-raises raw with no capture (internal). Ran error handling (27) and recalculation activity (38) tests. mypy on changed files.

@trunk-io

trunk-io Bot commented Aug 28, 2026 •

Copy link
Copy Markdown

😎 Merged successfully - details.

@github-actions

Copy link
Copy Markdown
Contributor

🤖 CI report

⚠️ Trunk lane — backend Python lane

This PR is assigned to the backend Python lane. It runs backend Python tests and may merge in parallel with PRs in other lanes.

@greptile-apps

greptile-apps Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "fix(experiments): Classify NOT_AN_AGGREG..." | Re-trigger Greptile

@jurajmajerik jurajmajerik added the stamphog Request AI approval (no full review) label Aug 28, 2026

@stamphog stamphog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Contained fix within the owning team's own domain (experiment query error classification/retry logic), with unit tests covering the new classification and decorator branches; no risky-territory concerns (no schema, API, auth, billing, or CI changes).

  • Author wrote 11% of the modified lines and has 25 merged PRs in these paths (familiarity MODERATE).
  • 👍 on the PR from greptile-apps[bot].
Gate mechanics and policy version
Gate Result
prerequisites ✓ all clear
deny-list ✓ no deny categories matched
size ✓ 52L, 2F substantive, 105L/3F incl. docs/generated/snapshots — within ceiling
tier ✓ T1-agent / T1c-medium (105L, 3F, single-area, fix)
stamphog 2.0.0b4 .stamphog/policy.yml @ 26cc538 · reviewed head 26cc538

@trunk-io

trunk-io Bot commented Aug 28, 2026 •

Copy link
Copy Markdown

Static Badge   Static Badge   Static Badge

View Full Report ↗︎ ⋅ Docs

@trunk-io
trunk-io Bot merged commit f3aa37f into master Aug 28, 2026
275 checks passed
@trunk-io
trunk-io Bot deleted the experiments/notanaggregate-user-error branch August 28, 2026 08:52
@deployment-status-posthog

deployment-status-posthog Bot commented Aug 28, 2026 •

Copy link
Copy Markdown

Deploy status

Environment Status Deployed At Workflow
dev ✅ Deployed 2026-08-28 09:23 UTC Run
prod-us ✅ Deployed 2026-08-28 09:45 UTC Run
prod-eu ✅ Deployed 2026-08-28 09:39 UTC Run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stamphog Request AI approval (no full review)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant