Skip to content

chore(insights): cover hide weekends bucket alignment#9

Open
lordspline wants to merge 1 commit into
masterfrom
capy/61782-hide-weekends-regression-tests
Open

chore(insights): cover hide weekends bucket alignment#9
lordspline wants to merge 1 commit into
masterfrom
capy/61782-hide-weekends-regression-tests

Conversation

@lordspline

@lordspline lordspline commented Jun 17, 2026

Copy link
Copy Markdown

Problem

PostHog issue PostHog#61782 reported daily Trends charts zeroing recent weekday buckets when Hide weekend data was enabled for a range ending mid-week after the most recent weekend.

Current master does not reproduce that behavior: the backend filters Saturday and Sunday buckets in lockstep across days, labels, data, and action.days, and the chart uses the filtered current-period days as its x-axis source.

Changes

  • Adds deterministic Trends fixtures for the issue shape, including non-zero Monday-through-Thursday values after the most recent weekend.
  • Adds backend regression coverage for weekday range endings, multiple weekends, timezone offsets including DST, configured week starts, comparison data, breakdowns, incomplete current periods, and truly missing weekday buckets.
  • Adds frontend transform and LineGraph coverage to prove filtered weekday buckets are not expanded back into weekend zeroes.
  • Adds HideWeekendsOff and HideWeekendsOn Storybook stories with deterministic data for visual verification.
  • Leaves production code unchanged because the current query-to-chart path already preserves weekday buckets and values.

How did you test this code?

Agent-authored verification:

  • FLOX_DISABLE_METRICS=true flox activate -- bash -c 'export PATH="$PWD/.flox/cache/venv/bin:$PATH"; POSTHOG_TELEMETRY_OPT_OUT=1 hogli test posthog/hogql_queries/insights/trends/test/test_trends_query_runner.py -k hide_weekends' — 21 passed, 184 deselected.
  • FLOX_DISABLE_METRICS=true flox activate -- bash -c 'export PATH="$PWD/.flox/cache/venv/bin:$PATH"; POSTHOG_TELEMETRY_OPT_OUT=1 hogli test frontend/src/scenes/insights/views/LineGraph/LineGraph.test.tsx && hogli test products/product_analytics/frontend/insights/trends/TrendsLineChart/trendsChartTransforms.test.ts' — 13 LineGraph tests and 57 chart transform tests passed.
  • FLOX_DISABLE_METRICS=true flox activate -- bash -c 'ruff format posthog/hogql_queries/insights/trends/test/test_trends_query_runner.py && ruff check posthog/hogql_queries/insights/trends/test/test_trends_query_runner.py' — file unchanged; all checks passed.
  • FLOX_DISABLE_METRICS=true flox activate -- bash -c 'pnpm --filter=@posthog/frontend format' — completed with 0 errors.
  • FLOX_DISABLE_METRICS=true flox activate -- bash -c 'pnpm --filter=@posthog/frontend typescript:check' — no errors reported by tsgo.
  • Storybook visual proof captured from insights-trendslinechart--hide-weekends-off and insights-trendslinechart--hide-weekends-on: weekend labels are present only when Hide weekend data is disabled.

Automatic notifications

  • Publish to changelog?
  • Alert Sales and Marketing teams?

Docs update

No docs update; this is test-only regression coverage for an existing Trends behavior.

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Captain Capy investigated the reported Hide weekend data behavior from query response through backend bucket filtering, legacy LineGraph, the newer TrendsLineChart transform, and Storybook rendering. The current branch could not reproduce the zeroing bug, so the chosen change is regression and visual coverage rather than a production patch or rendered-output compensation.


View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@lordspline lordspline added the capy Generated by capy.ai label Jun 17, 2026 — with Capy AI
@capy-ai capy-ai Bot changed the title test(trends): add hide weekends regression tests chore(insights): cover hide weekends bucket alignment Jun 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

capy Generated by capy.ai

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant