Skip to content

Show only ready PRs in the inbox Pull requests tab#2758

Merged
Twixes merged 2 commits into
mainfrom
posthog-code/inbox-pulls-ready-only
Jun 19, 2026
Merged

Show only ready PRs in the inbox Pull requests tab#2758
Twixes merged 2 commits into
mainfrom
posthog-code/inbox-pulls-ready-only

Conversation

@Twixes

@Twixes Twixes commented Jun 18, 2026

Copy link
Copy Markdown
Member

Problem

The inbox Pull requests tab listed and counted PRs of every status, so merged/closed (resolved) PRs piled up alongside active ones. A user saw 4 PR reports when only 1 was actually actionable — the other 3 were already-merged PRs. The count should reflect only what's worth acting on.

(Supersedes #2757, which aligned Code with Cloud by showing resolved PRs — wrong direction. Cloud is being changed to match this instead.)

Changes

Restrict the Pull requests tab's list and its count to ready PRs (a Responder draft awaiting review):

  • isPullRequestReport now requires status === "ready".
  • The list query (pullRequestsOnly) and the count query use a new INBOX_PULL_REQUEST_STATUS_FILTER = "ready".
  • isReportTabReport excludes any report carrying a PR (including resolved/merged), so done PRs drop out of the inbox rather than reappearing as a Report.

Resolved/merged and still-running PRs no longer inflate the tab or its badge. The Reports and Runs tabs are unchanged.

How did you test this?

  • Updated/added unit tests in reportMembership.test.ts (ready PR shown; resolved and in-progress PRs excluded; resolved PRs kept out of Reports).
  • Ran vitest run src/inbox/reportMembership.test.ts src/inbox/reportFiltering.test.ts src/inbox/engagement.test.ts — 64 tests pass.
  • Biome check clean on the changed files.

Automatic notifications

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

Created with PostHog Code from a Slack thread

@github-actions

github-actions Bot commented Jun 18, 2026

Copy link
Copy Markdown

React Doctor found no issues in the changed files. 🎉

Reviewed by React Doctor for commit 5bb732d.

@greptile-apps

greptile-apps Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Comments Outside Diff (1)

  1. packages/ui/src/features/inbox/hooks/useInboxAllReports.ts, line 116-139 (link)

    P2 Reports count can drift when non-ready PRs exceed the first loaded page

    pullRequestCountQuery now uses INBOX_PULL_REQUEST_STATUS_FILTER = "ready", so the server-side total no longer covers in_progress/pending_input reports that already have has_implementation_pr=true. Those items still appear in query.totalCount (the broad pipeline filter includes them), but they are only subtracted from the Reports count via loadedOtherNonReport — a client-side term that only covers pages that have been fetched. Any such report sitting past the first page will silently inflate the Reports badge until it is scrolled into view.

    Before this PR, those in-progress PRs were subtracted via the broader pullRequestTotal (which used INBOX_PIPELINE_STATUS_FILTER), so the formula was correct regardless of pagination. If has_implementation_pr=true + in_progress is a valid backend state, a dedicated server-count query (analogous to pullRequestCountQuery) for those reports would restore parity.

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: packages/ui/src/features/inbox/hooks/useInboxAllReports.ts
    Line: 116-139
    
    Comment:
    **Reports count can drift when non-ready PRs exceed the first loaded page**
    
    `pullRequestCountQuery` now uses `INBOX_PULL_REQUEST_STATUS_FILTER = "ready"`, so the server-side total no longer covers `in_progress`/`pending_input` reports that already have `has_implementation_pr=true`. Those items still appear in `query.totalCount` (the broad pipeline filter includes them), but they are only subtracted from the Reports count via `loadedOtherNonReport` — a client-side term that only covers pages that have been fetched. Any such report sitting past the first page will silently inflate the Reports badge until it is scrolled into view.
    
    Before this PR, those in-progress PRs were subtracted via the broader `pullRequestTotal` (which used `INBOX_PIPELINE_STATUS_FILTER`), so the formula was correct regardless of pagination. If `has_implementation_pr=true` + `in_progress` is a valid backend state, a dedicated server-count query (analogous to `pullRequestCountQuery`) for those reports would restore parity.
    
    How can I resolve this? If you propose a fix, please make it concise.
Prompt To Fix All With AI
Fix the following 2 code review issues. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 2
packages/core/src/inbox/reportMembership.test.ts:87-127
**Non-parameterised `isPullRequestReport` tests**

The four new cases (`ready+url`, `ready+null`, `resolved+url`, `in_progress+url`) vary only in the `status`/`implementation_pr_url` inputs and the expected boolean. The team style guide prefers `it.each` for exactly this shape: a table of inputs and expected outputs, all exercising the same predicate. Using separate `it` blocks also makes it easy for a future status (e.g. `pending_approval`) to be missed when someone adds a case.

### Issue 2 of 2
packages/ui/src/features/inbox/hooks/useInboxAllReports.ts:116-139
**Reports count can drift when non-ready PRs exceed the first loaded page**

`pullRequestCountQuery` now uses `INBOX_PULL_REQUEST_STATUS_FILTER = "ready"`, so the server-side total no longer covers `in_progress`/`pending_input` reports that already have `has_implementation_pr=true`. Those items still appear in `query.totalCount` (the broad pipeline filter includes them), but they are only subtracted from the Reports count via `loadedOtherNonReport` — a client-side term that only covers pages that have been fetched. Any such report sitting past the first page will silently inflate the Reports badge until it is scrolled into view.

Before this PR, those in-progress PRs were subtracted via the broader `pullRequestTotal` (which used `INBOX_PIPELINE_STATUS_FILTER`), so the formula was correct regardless of pagination. If `has_implementation_pr=true` + `in_progress` is a valid backend state, a dedicated server-count query (analogous to `pullRequestCountQuery`) for those reports would restore parity.

Reviews (1): Last reviewed commit: "Show only ready PRs in the inbox Pull re..." | Re-trigger Greptile

Comment thread packages/core/src/inbox/reportMembership.test.ts
@Twixes Twixes marked this pull request as ready for review June 18, 2026 14:50
@Twixes Twixes added the Stamphog This will request an autostamp by stamphog on small changes label Jun 18, 2026
@Twixes Twixes enabled auto-merge (squash) June 18, 2026 14:50
github-actions[bot]
github-actions Bot previously approved these changes Jun 18, 2026

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

Clean, focused filter change with matching tests. The logic refactor in isPullRequestReport and isReportTabReport is coherent and well-commented. The only review comment is a bot style suggestion (use it.each) marked resolved on an older commit — that's a style preference, not a correctness concern.

@greptile-apps

greptile-apps Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Reviews (2): Last reviewed commit: "Update reportFiltering.ts" | Re-trigger Greptile

The Pull requests tab listed (and counted) PRs of every status, so merged/closed
(`resolved`) PRs inflated the count with work the user has already finished —
e.g. 4 PR reports shown when only 1 was actually actionable.

Restrict the tab's list and count to `ready` PRs (a Responder draft awaiting
review). `isPullRequestReport` now requires `status === "ready"`, the list and
count queries use the new `INBOX_PULL_REQUEST_STATUS_FILTER`, and any report
carrying a PR (including resolved ones) stays out of the Reports tab. This keeps
the count honest about what the list shows, and is the same direction the
PostHog Cloud inbox is moving.

Generated-By: PostHog Code
Task-Id: a6430aac-4a87-4443-841e-fb96961a6832
@Twixes Twixes force-pushed the posthog-code/inbox-pulls-ready-only branch from 6a95b03 to d6ba320 Compare June 19, 2026 10:27
@github-actions github-actions Bot dismissed their stale review June 19, 2026 10:27

New commits pushed (delta classified non_linear_history) — stamphog approval dismissed; re-review running automatically.

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

Clean, focused filter fix with coherent logic across server query params, client-side predicates, and count badge. No showstoppers found.

The two pull-request membership tests used status "resolved", which is a Cloud-only concept absent from Code's SignalReportStatus union. Vitest strips types so the tests passed locally, but tsc (and CI typecheck) rejected the literal. Switch them to the valid non-ready "candidate" status, which exercises the same "only ready PRs count" behavior.

Generated-By: PostHog Code
Task-Id: a6430aac-4a87-4443-841e-fb96961a6832
@stamphog

stamphog Bot commented Jun 19, 2026

Copy link
Copy Markdown

Retaining stamphog approval — delta since last review classified as trivial_paths.

@Twixes Twixes merged commit d878ca7 into main Jun 19, 2026
23 checks passed
@Twixes Twixes deleted the posthog-code/inbox-pulls-ready-only branch June 19, 2026 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Stamphog This will request an autostamp by stamphog on small changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant