Skip to content

chore(test): merge experiment MAX/MIN/AVG property metric tests#66374

Draft
gantoine wants to merge 1 commit into
masterfrom
claude/test-cleanup-experiments-mean-metric-merge
Draft

chore(test): merge experiment MAX/MIN/AVG property metric tests#66374
gantoine wants to merge 1 commit into
masterfrom
claude/test-cleanup-experiments-mean-metric-merge

Conversation

@gantoine

Copy link
Copy Markdown
Member

Problem

test_property_max_metric, test_property_min_metric, and test_property_avg_metric in test_mean_metric.py were copy-paste identical — same fixtures, same journeys, same query plumbing — differing only in the math aggregation type and the two expected sums. Each was already parameterized over use_precomputation and ran @snapshot_clickhouse_queries, so three near-duplicate ClickHouse-backed methods were paying for the same setup three times.

Changes

  • Merge the three into one test_property_aggregation_metric parameterized over (name, use_precomputation, math_type, expected_control_sum, expected_test_sum) — 6 cases total (MAX/MIN/AVG × direct/precomputed).
  • Regenerate the .ambr snapshots.

The use_precomputation axis is kept (it exercises a genuinely different query path). The regenerated snapshots show only the # name: headers changing — the per-aggregation SQL bodies are byte-identical to before, so no SQL coverage is lost.

How did you test this code?

I'm an agent. Ran locally:

hogli test products/experiments/backend/hogql_queries/test/experiment_query_runner/test_mean_metric.py

First run (before regenerating): 22 passed, the 6 "failures" were purely the renamed snapshots, and every value assertion (control_variant.sum == expected, etc.) passed — confirming the merge preserves the computed results. After --snapshot-update: 28 passed, 6 snapshots generated, 6 unused deleted. The other 20 snapshots in the file passed byte-identical, confirming the environment matches CI and no unrelated snapshot churn occurred.

🤖 Agent context

Autonomy: Fully autonomous

Part of a monorepo test-suite cleanup targeting high CI-wall-time tests. Adversarial check: MAX/MIN/AVG share one query-builder code path differing only by the emitted aggregation function, which the snapshot still pins per case — so collapsing them loses no regression coverage. Tool: Claude Code (Opus 4.8).

Requesting review from: Experiments

`test_property_max_metric`, `test_property_min_metric`, and
`test_property_avg_metric` were byte-identical except for the aggregation type
and the expected sums. Fold them into one `test_property_aggregation_metric`
parameterized over both the math type and the existing `use_precomputation`
axis (6 cases). Regenerated snapshots: the SQL bodies are unchanged, only the
snapshot names move. Each case still runs `@snapshot_clickhouse_queries`, so
the per-aggregation SQL coverage is preserved.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "chore(test): merge experiment MAX/MIN/AV..." | Re-trigger Greptile

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant