Skip to content

feat(web-analytics): add the page directory query runner - #123075

Merged
trunk-io[bot] merged 3 commits into
jordanm-posthog/page-reports-1a-schema-typesfrom
jordanm-posthog/page-reports-1-runner
Oct 24, 2026
Merged

trunk-io[bot] merged 3 commits into
jordanm-posthog/page-reports-1a-schema-typesfrom
jordanm-posthog/page-reports-1-runner

Conversation

@jordanm-posthog

@jordanm-posthog jordanm-posthog commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Problem

The page directory query types from #123073 have no runner, so nothing can answer them.

Part 2 of 12 in the page reports stack, behind the web-analytics-page-reports-directory flag. Stacked on #123073.

Changes

  • No visible change. The query API accepts this kind only once feat(web-analytics): register the page directory query #123074 registers it.
  • A driver query picks one page of pages by the sort metric. The other metrics then run for only those pages, in parallel.
  • Google search and AI referrals count visitors whose session started on that channel. AI crawls count bot requests in the AI crawler categories, with up to four crawler names.
  • Site totals return the same metrics for the whole site, plus whether any server logs arrived.
  • Static files can be left out, and search matches any part of the page.
  • Mechanical: the runner registration and the query tag.

How did you test this code?

New tests. They catch Google or ChatGPT visits counted against the wrong page, a crawler-only page missing from a crawl sort, static files that stay in, broken pagination, and requested pages that drop out of the rows or the site totals.

Release status

  • This change is behind a feature flag and is not available to users

Docs update

None.

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Agent: Claude Code, Opus 5.5 (claude-opus-5-5)

Skills invoked: /simplify, /stacking-prs, /writing-pr-descriptions.

@github-actions

github-actions Bot commented Oct 24, 2026 •

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.

✅ Duplication (Python) — clean

New Python code duplication introduced by this branch. Fails at 70+ tokens in app code, or 150+ tokens when both copies live in test files. Advisory while the gate proves itself: extract a shared helper instead of copying.

✅ Duplication (TypeScript) — clean

New TypeScript code duplication introduced by this branch. Fails at 70+ tokens in app code, or 150+ tokens when both copies live in test files. Advisory while the gate proves itself: extract a shared helper instead of copying.

⚠️ Playwright — 1 flaky

🎭 Playwright report · View test results →

⚠️ 1 flaky test:

  • Redirect to appropriate place after login (chromium)

These issues are not necessarily caused by your changes.
Annoyed by this section? Help fix flakies and failures and it will go green!

⚠️ Backend coverage — 95.0% of changed backend lines covered — 23 uncovered

🧪 Backend test coverage

Patch coverage — changed backend lines (products + core): ███████████████████░ 95.0% (534 / 557)

File Patch Uncovered changed lines
posthog/hogql_queries/query_runner.py 33.3% 1089, 1091
products/web_analytics/backend/hogql_queries/web_page_directory.py 91.4% 73, 85–87, 101, 173, 273–279, 315, 353, 364–369

🤖 Agents: add a test only if an uncovered line exposes a realistic regression that existing tests miss. Otherwise explain why no new test is needed under "How did you test this code?". Gap list: the patch-coverage artifact on this run (gh run download 418355412281303 -n patch-coverage), or the coverage-data block at the end of this comment.

Per-product line coverage (touched products)
Product Coverage Lines
platform_features ██░░░░░░░░░░░░░░░░░░ 12.1% 7 / 58
demo ███████████░░░░░░░░░ 56.3% 1,540 / 2,736
data_tools ████████████░░░░░░░░ 60.9% 95 / 156
warehouse_sources_queue █████████████░░░░░░░ 65.2% 2,157 / 3,306
authorization ████████████████░░░░ 79.7% 181 / 227
batch_exports ████████████████░░░░ 81.6% 22,911 / 28,069
apm █████████████████░░░ 84.1% 1,306 / 1,553
engineering_analytics █████████████████░░░ 85.0% 11,463 / 13,482
commands █████████████████░░░ 85.5% 1,618 / 1,893
mcp_analytics █████████████████░░░ 86.2% 5,720 / 6,638
ml_inference █████████████████░░░ 86.3% 524 / 607
posthog_ai ██████████████████░░ 87.9% 4,296 / 4,886
notebooks ██████████████████░░ 88.5% 15,330 / 17,321
dashboards ██████████████████░░ 88.6% 7,709 / 8,703
warehouse_suggestions ██████████████████░░ 88.6% 3,047 / 3,438
mcp_registry ██████████████████░░ 89.0% 1,596 / 1,794
webmcp ██████████████████░░ 89.6% 240 / 268
cohorts ██████████████████░░ 89.6% 8,568 / 9,559
product_tours ██████████████████░░ 89.7% 1,355 / 1,510
signals ██████████████████░░ 89.8% 84,754 / 94,384
visual_review ██████████████████░░ 90.6% 9,858 / 10,875
tasks ██████████████████░░ 90.7% 80,870 / 89,128
managed_warehouse ██████████████████░░ 91.0% 12,218 / 13,425
data_warehouse ██████████████████░░ 91.1% 15,273 / 16,768
canvas ██████████████████░░ 91.1% 7,998 / 8,776
aeo ██████████████████░░ 91.2% 1,602 / 1,756
today ██████████████████░░ 91.2% 3,798 / 4,163
data_modeling ██████████████████░░ 91.4% 10,507 / 11,492
autoresearch ██████████████████░░ 91.4% 11,612 / 12,699
cdp ██████████████████░░ 91.5% 10,251 / 11,206
business_knowledge ██████████████████░░ 91.6% 10,017 / 10,934
metrics ██████████████████░░ 91.7% 10,625 / 11,588
slack_app ██████████████████░░ 91.7% 21,398 / 23,330
wizard ██████████████████░░ 91.7% 6,870 / 7,490
streamlit_apps ██████████████████░░ 91.9% 3,139 / 3,415
error_tracking ██████████████████░░ 92.1% 18,833 / 20,454
conversations ██████████████████░░ 92.2% 30,216 / 32,776
review_hog ██████████████████░░ 92.2% 17,749 / 19,244
stamphog ███████████████████░ 92.6% 8,814 / 9,519
early_access_features ███████████████████░ 92.6% 1,339 / 1,446
managed_migrations ███████████████████░ 92.6% 1,630 / 1,760
alerts_platform ███████████████████░ 92.8% 7,523 / 8,108
notifications ███████████████████░ 93.0% 1,199 / 1,289
web_analytics ███████████████████░ 93.3% 25,998 / 27,876
ai_training ███████████████████░ 93.3% 598 / 641
alerts ███████████████████░ 93.3% 9,488 / 10,167
surveys ███████████████████░ 93.4% 6,918 / 7,406
cross_project_dashboards ███████████████████░ 93.4% 880 / 942
approvals ███████████████████░ 93.4% 4,576 / 4,898
exports ███████████████████░ 93.6% 4,161 / 4,447
ai_gateway ███████████████████░ 93.6% 787 / 841
billing_alerts ███████████████████░ 93.7% 2,093 / 2,233
context_layer ███████████████████░ 93.8% 3,981 / 4,244
messaging ███████████████████░ 93.8% 4,705 / 5,015
marketing_analytics ███████████████████░ 93.9% 21,191 / 22,562
mcp_store ███████████████████░ 93.9% 9,144 / 9,735
ai_observability ███████████████████░ 93.9% 29,066 / 30,938
customer_analytics ███████████████████░ 94.1% 27,892 / 29,651
workflows ███████████████████░ 94.2% 22,860 / 24,267
logs ███████████████████░ 94.4% 19,281 / 20,434
legal_documents ███████████████████░ 94.4% 2,313 / 2,451
replay_vision ███████████████████░ 94.5% 31,999 / 33,863
actions ███████████████████░ 94.7% 1,004 / 1,060
reminders ███████████████████░ 94.8% 760 / 802
growth ███████████████████░ 94.9% 11,347 / 11,959
endpoints ███████████████████░ 94.9% 9,374 / 9,878
annotations ███████████████████░ 95.1% 1,095 / 1,151
skills ███████████████████░ 95.3% 7,440 / 7,810
uptime_monitoring ███████████████████░ 95.3% 306 / 321
experiments ███████████████████░ 95.4% 39,202 / 41,090
access_control ███████████████████░ 95.5% 8,105 / 8,491
subscriptions ███████████████████░ 95.6% 13,598 / 14,225
data_catalog ███████████████████░ 95.6% 4,582 / 4,791
product_analytics ███████████████████░ 95.8% 29,872 / 31,185
revenue_analytics ███████████████████░ 95.9% 1,877 / 1,958
feature_flags ███████████████████░ 95.9% 28,362 / 29,585
data_quality ███████████████████░ 96.0% 8,523 / 8,878
tracing ███████████████████░ 96.4% 4,360 / 4,524
warehouse_sources ███████████████████░ 96.5% 475,812 / 493,133
security ███████████████████░ 96.7% 1,549 / 1,602
account_audits ███████████████████░ 96.7% 770 / 796
pulse ███████████████████░ 97.1% 2,023 / 2,083
analytics_platform ████████████████████ 98.0% 2,798 / 2,855
groups ████████████████████ 98.2% 1,838 / 1,871
field_notes ████████████████████ 99.4% 172 / 173

Report-only. Patch coverage = changed backend lines covered vs origin/master. Sorted lowest first.
Known gaps: lines covered only by Temporal tests show as uncovered; core line numbers may drift if master changed the same file.

@posthog posthog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

PostHog Review · Standard · reviewed cfb7e76: 5 Should fix.

This is the only automatic review while this pull request is a draft. Comment @posthog review to review new changes sooner. Otherwise, a review of the new changes runs when you mark it ready for review.

See this review and its findings in PostHog Review. Comment @posthog review --deep for a Deep review. A Deep review takes longer and looks deeper than a Standard review.

@trunk-io

trunk-io Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Static Badge   Static Badge   Static Badge

Failed Test Failure Summary Logs
Auth › Redirect to appropriate place after login The browser navigation to the activity events page was aborted. Logs ↗︎

View Full Report ↗︎ ⋅ Docs

@jordanm-posthog jordanm-posthog added the run-ci-backend Force ci-backend's full test matrices to run even on a draft PR label Oct 24, 2026
@jordanm-posthog
jordanm-posthog force-pushed the jordanm-posthog/page-reports-1-runner branch from cfb7e76 to ffbd600 Compare October 24, 2026 18:09
@jordanm-posthog
jordanm-posthog marked this pull request as ready for review October 24, 2026 18:23
@parameterai

parameterai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Risk: No findings

This delta fixes two correctness details in the new page directory query runner: the search filter no longer applies to whole-site totals, and the bounce-rate session filter deduplicates session IDs. Both changes stay within the caller's own team data and use AST-node placeholders, so no new security surface is introduced.

Sentinel reviewed c0cc17a · Review settings

@pr-assigner-resolver-posthog
pr-assigner-resolver-posthog Bot requested a review from a team October 24, 2026 18:24

@posthog posthog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

PostHog Review · Standard · reviewed ffbd600: 2 Should fix.

stamphog[bot]

This comment was marked as outdated.

@jordanm-posthog
jordanm-posthog force-pushed the jordanm-posthog/page-reports-1-runner branch from c0cc17a to 7d809f9 Compare October 24, 2026 19:44
@stamphog
stamphog Bot dismissed their stale review October 24, 2026 19:44

New commits were pushed — dismissing the stamphog approval from an earlier head. Re-add the trigger label to request a fresh review.

@jordanm-posthog
jordanm-posthog removed this pull request from stack #123076 October 24, 2026 19:45
@jordanm-posthog
jordanm-posthog changed the base branch from jordanm-posthog/page-reports-1b-schema-query to jordanm-posthog/page-reports-1a-schema-types October 24, 2026 19:45

@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.

Approved.

The query API change has owning-team authorship as independent assurance and targeted tests. The older bot reviews provide no specific actionable concerns to verify, and code inspection found no showstopper.

  • Author wrote 0% of the modified lines and has 7 merged PRs in these paths (familiarity MODERATE).
Gate mechanics and policy version
Gate Result
prerequisites ✓ all clear
deny-list ✓ no deny categories matched
size ✓ 502L, 3F substantive, 710L/4F incl. docs/generated/snapshots — within ceiling
tier ✓ T1-agent / T1d-complex (710L, 4F, two-areas, feat)
stamphog 2.6.1 .stamphog/policy.yml @ 7d809f9 · reviewed head 7d809f9

@trunk-io
trunk-io Bot merged commit aec292f into master Oct 24, 2026
343 of 347 checks passed
@trunk-io
trunk-io Bot deleted the jordanm-posthog/page-reports-1-runner branch October 24, 2026 22:00
@trunk-io

trunk-io Bot commented Oct 24, 2026

Copy link
Copy Markdown

This pull request was merged into master as part of stacked PR 123074.

@deployment-status-posthog

deployment-status-posthog Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Deploy status

Environment Status Deployed At Workflow
dev ✅ Deployed 2026-10-24 22:24 UTC Run
prod-us ✅ Deployed 2026-10-24 22:37 UTC Run
prod-eu ✅ Deployed 2026-10-24 22:36 UTC Run

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

Labels

run-ci-backend Force ci-backend's full test matrices to run even on a draft PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants