fix(inbox): forward reviewer search query to the server#2800
Conversation
The Add-reviewer popover fetched the available-reviewers list once with no query and filtered it client-side. The backend caps that list at 100 entries sorted by first name, so reviewers later in the alphabet were never in the fetched set and could not be found by typing their name. Pass the popover's search query into useInboxAvailableSuggestedReviewers so it forwards to the available_reviewers endpoint, which filters before applying its cap. The hook already plumbs the query through the query key and the API call. Generated-By: PostHog Code Task-Id: d1b4a6ce-de4c-43a6-98a0-4cb45275dde0
|
React Doctor found no issues in the changed files. 🎉 Reviewed by React Doctor for commit |
|
|
Note 🤖 Automated comment by QA Swarm — not written by a human Multi-perspective review: qa-team (correctness/tests), paul-reviewer (pragmatism), xp-reviewer (UX/DX), security-audit Verdict: ✅ APPROVEOne-line change that forwards Key findingsNo findings. ConvergenceNone. Reviewer summaries
Automated by QA Swarm — not a human review |
…65029) ## Problem Assigning a reviewer in the Self-driving Inbox only surfaced org members whose first name fell in roughly the first half of the alphabet (up to ~"M"), and searching for anyone after that returned nothing — even for people who are definitely in the org. Reported from a Slack thread about a large org. The cause is here: `available_reviewers` sorts members by first name and slices to the first 100 **before** returning. So any org with >100 GitHub-linked members silently loses the tail of the alphabet, and because the slice runs server-side the frontend can't page past it. ## Changes - **Drop the `[:100]` cap** — return the full candidate set (sort retained for stable ordering). The whole member set is already loaded in memory, so the slice only ever truncated; it never saved work. Org membership is tiny in practice, so even the biggest org serialises to well under 100 KB. - **Add a named OTel span** `signals.available_reviewers` with `candidate_count` / `result_count` attributes, so this endpoint's latency and payload size are actually measurable next time (today there's no route-level span for it). - **Capture a non-blocking exception when an org exceeds 1200 candidates** — a tripwire telling us to add real pagination before the unpaginated payload could get large. Gated on the unfiltered request so search-as-you-type doesn't spam it. A paired frontend change ([PostHog/code#2800](PostHog/code#2800)) forwards the picker's search box to this endpoint's `query` param so search hits the server. ## How did you test this code? I'm an agent (PostHog Code). I added automated tests in `test_signal_report_api.py` (`TestAvailableReviewersAPI`) covering: all members returned past the old 100 cap, server-side search filtering, the threshold capture firing above 1200 / staying silent below it and on search requests, and the empty-org / unknown-team paths. I could **not** run the suite in my environment (no configured Postgres/ClickHouse dev env); `python -m py_compile` and `ruff check` both pass, and CI will execute the tests. ## Automatic notifications - [ ] Publish to changelog? - [ ] Alert Sales and Marketing teams? ## 🤖 Agent context **Autonomy:** Human-driven (agent-assisted) Investigation started from a Slack thread about the reviewer picker stopping at "M". Traced the data flow front-to-back, then confirmed via the warehouse that org membership is small enough that the full list fits comfortably in one response (well under 100 KB even for the largest orgs) — which ruled out pagination in favour of simply removing the cap, with a 1200 tripwire for the future. Tooling: PostHog Code agent with the PostHog MCP (HogQL `execute-sql`, APM span queries). No repo skills were invoked. --- *Created with [PostHog Code](https://posthog.com/code?ref=pr) from a [Slack thread](https://posthog.slack.com/archives/C09G8Q32R6F/p1781901413265679?thread_ts=1781901413.265679&cid=C09G8Q32R6F)*
Problem
Assigning a reviewer in the Inbox only surfaced people whose first name fell in roughly the first half of the alphabet (up to ~"M"), and typing a name that came later returned "No users found" — even for someone who is definitely in the org. This blocked assigning a large set of teammates as reviewers.
Changes
The Add-reviewer popover called
useInboxAvailableSuggestedReviewerswith noqueryand then filtered the result client-side. The backendavailable_reviewersendpoint returns only the first 100 users sorted by first name, so anyone after the cutoff was never in the fetched set and couldn't be found by searching.This forwards the popover's
deferredQueryinto the hook so the search hits the server, which filters before applying its 100-row cap — making any teammate findable by typing their name. The hook already plumbs the query through its query key and into the API call; this just passes it in.Note: this is the frontend half. The backend
[:100]cap (inPostHog/posthogproducts/signals/backend/views.py) still truncates the default unsearched list and should be revisited separately.How did you test this?
Not run —
node_modulesisn't installed in this environment, so the workspace typecheck can't resolve. The change only passes astringinto an options field already typed asquery?: string, and the hook already handles query forwarding and cache-keying.Automatic notifications
Created with PostHog Code from a Slack thread