chore(insights): cover hide weekends bucket alignment#9
Open
lordspline wants to merge 1 commit into
Open
Conversation
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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, andaction.days, and the chart uses the filtered current-perioddaysas its x-axis source.Changes
LineGraphcoverage to prove filtered weekday buckets are not expanded back into weekend zeroes.HideWeekendsOffandHideWeekendsOnStorybook stories with deterministic data for visual verification.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'— 13LineGraphtests 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 bytsgo.insights-trendslinechart--hide-weekends-offandinsights-trendslinechart--hide-weekends-on: weekend labels are present only when Hide weekend data is disabled.Automatic notifications
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 newerTrendsLineCharttransform, 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.Need help on this PR? Tag
/codesmithwith what you need. Autofix is disabled.