Skip to content

fix(error-tracking): prevent issue list query timeout - #87693

Merged
trunk-io[bot] merged 2 commits into
masterfrom
posthog/fix-error-tracking-issue-list-timeout
Aug 24, 2026
Merged

trunk-io[bot] merged 2 commits into
masterfrom
posthog/fix-error-tracking-issue-list-timeout

Conversation

@hpouillot

Copy link
Copy Markdown
Contributor

Problem

Teams with many error tracking issues can see a blank issue list when the database query exceeds its statement timeout.

The list query grouped every issue against all fingerprints before applying the page limit. The pagination count repeated the same aggregate.

Changes

  • Issue list pages now calculate first_seen with a per-issue subquery after pagination limits the result.
  • Pagination now uses deterministic, primary-key ordering instead of database-dependent row order.
  • The API response and earliest fingerprint semantics stay unchanged.

How did you test this code?

  • Added an API regression test that rejects full-team fingerprint aggregation and verifies stable pagination and first_seen.
  • Passed Ruff lint, Ruff format, Python compilation, test collection, and hogli ci:preflight --fix.
  • The database-backed test did not complete because the local test database migration exceeded the sandbox time limit.

Automatic notifications

  • Publish to changelog?

Docs update

None. The API contract does not change.

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

PostHog Code used Pi and the PostHog MCP. Skills invoked: /investigating-error-issue, /writing-tests, and /writing-pr-descriptions.

The implementation uses a correlated subquery instead of adding an index migration because it removes the unbounded aggregate while keeping the change small.


Created with PostHog Desktop from this inbox report.

Replace the full-team fingerprint aggregate with a per-issue subquery and add stable pagination ordering.

Generated-By: PostHog Desktop
Task-Id: 0d6cb39e-190f-45b0-9683-83cf8d6bd8af
@hpouillot hpouillot self-assigned this Aug 24, 2026
@trunk-io

trunk-io Bot commented Aug 24, 2026 •

Copy link
Copy Markdown

😎 Merged successfully - details.

@github-actions

Copy link
Copy Markdown
Contributor

Hey @hpouillot! 👋

It looks like your git author email on this PR isn't your @posthog.com address (hpouillot@gmail.com). Since you're on the PostHog team, it's worth pointing your local git author email at your @posthog.com address. Why it matters:

  • Consistent work identity in git history — internal tooling that attributes commits to team members keys off your @posthog.com address.
  • Keeps team contributions easy to tell apart from external community ones when scanning history.

You can fix it for this repo with:

git config user.email "you@posthog.com"

Or set it globally with git config --global user.email "you@posthog.com". No need to redo this PR — just a nudge for next time. 🙂

@github-actions

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.

@hpouillot
hpouillot requested review from a team, ablaszkiewicz and cat-ph August 24, 2026 09:56
@hpouillot
hpouillot marked this pull request as ready for review August 24, 2026 09:56
@greptile-apps

greptile-apps Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "fix(error-tracking): prevent issue list ..." | Re-trigger Greptile

Keep the custom manager method dynamically typed so Django's runtime first_seen annotation remains visible to mypy callers.

Generated-By: PostHog Desktop
Task-Id: 0d6cb39e-190f-45b0-9683-83cf8d6bd8af
@trunk-io

trunk-io Bot commented Aug 24, 2026 •

Copy link
Copy Markdown

Static Badge   Static Badge   Static Badge

View Full Report ↗︎ ⋅ Docs

@trunk-io
trunk-io Bot merged commit d8b07a0 into master Aug 24, 2026
257 checks passed
@trunk-io
trunk-io Bot deleted the posthog/fix-error-tracking-issue-list-timeout branch August 24, 2026 12:19
@deployment-status-posthog

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

Copy link
Copy Markdown

Deploy status

Environment Status Deployed At Workflow
dev ✅ Deployed 2026-08-24 13:19 UTC Run
prod-us ✅ Deployed 2026-08-24 16:10 UTC Run
prod-eu ✅ Deployed 2026-08-24 23:15 UTC Run

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.

2 participants