Repository navigation
fix: require standalone demand for standalone cache warming - #108313
vdekrijger wants to merge 6 commits into
Conversation
🤖 CI report
|
|
[Medium risk] Changes cache warming logic for standalone insights. The selector appears safe to merge once the repository’s module-level import requirement is satisfied. Reviews (1) · Last reviewed commit: "fix: require standalone demand for stand..." |
Walkthrough
Merge Risk:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
posthog/caching/test/test_warming.py (1)
61-61: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winMove
record_insight_view_contextto the module imports.The test already imports the same facade module at module scope. The local import does not avoid a circular, heavy, or optional dependency.
Suggested fix
-from products.product_analytics.backend.facade.api import record_insight_views +from products.product_analytics.backend.facade.api import record_insight_view_context, record_insight_views ... - from products.product_analytics.backend.facade.api import record_insight_view_context
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository: PostHog/posthog/.coderabbit.yaml
Review profile: QUIET
Plan: Enterprise
Run ID: 7bcea4e5-16ad-4423-b4eb-bfe7ee2086a4
📒 Files selected for processing (2)
posthog/caching/test/test_warming.pyposthog/caching/warming.py
Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 9 remain after this review.
|
This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, please remove the |
|
This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, please remove the |
|
This PR was closed due to lack of activity. Feel free to reopen if it's still relevant. |
|
This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, please remove the |
|
This PR was closed due to lack of activity. Feel free to reopen if it's still relevant. |
…g-standalone-demand-policy Adapts the standalone demand filter to the facade read function, which now returns view rows instead of a queryset.
…g-standalone-demand-policy The standalone demand filter now asks the view history only for views inside the warming window.
|
Risk: No findings This change makes standalone cache warming require recently recorded standalone insight views, behind the default-off Sentinel reviewed |
There was a problem hiding this comment.
PostHog Review · Standard · reviewed c2f57d1: 1 Should fix.
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.
Asks the view history for the distinct insights viewed outside a dashboard instead of loading every recent view row into the scheduler. Also moves a test import to module level and annotates the new test signatures.
…g-standalone-demand-policy
There was a problem hiding this comment.
Approved.
Contained, flag-controlled cache-selection change with regression coverage; no public API, persistence, or authorization behavior changes. The actionable import nit is fixed, and no concrete unresolved substantive concerns or blocking reactions are present.
- Author wrote 0% of the modified lines and has 10 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 | ✓ | 49L, 3F substantive, 126L/4F incl. docs/generated/snapshots — within ceiling |
| tier | ✓ | T1-agent / T1c-medium (126L, 4F, two-areas, fix) |
| stamphog 2.8.0 | .stamphog/policy.yml @ f2e097c · reviewed head f2e097c |
Problem
Viewing a dashboard can keep an unused standalone insight query eligible for cache warming, even when nobody requests that standalone variant.
Changes
cache-warming-standalone-demand.Depends on #106556. Deploy recording first and collect a full seven days of history. Check web, shared and agent/API caller coverage before enabling the flag. MCP
insight-queryrecording remains a separate follow-up.Turning the flag off restores the previous selector. This PR does not change Redis registration, the 500-candidate batch, warming frequency or failure backoff.
How did you test this code?
Tests cover dashboard-only demand, a subsequent standalone view, flag-off fallback, unattributed history, source handling and the seven-day cutoff. The policy and tests are moved from #106556 without intentional behavior changes. Current-head CI and human review remain required. No flag enablement or production savings are claimed.
After the merge with #106556 and master, the warming test file passes locally and mypy is clean on
warming.py. A new test covers the shared-only selector with the flag on: it needs an enabled sharing configuration and a standalone view inside the three-day shared window.The focused run completed all test assertions, then Python segfaulted during shutdown. A clean process exit is not claimed.
Release status
Automatic notifications
Docs update
Internal rollout instructions are above. No visible UI change.
🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Agent: Codex, GPT-6
Skills: posthog-pr-finish, brainstorming, writing-pr-descriptions. Tools: Git, gh, Flox, pytest. Extracted the existing policy into a separate deployable PR. No customer data or operational metrics are included. No new third-party review or manual UI validation is claimed.