feat(inbox): summarize many repos by owner in the GitHub tooltip#2244
Merged
Conversation
Once a project's GitHub integration covers more than 10 repositories, the connected-repos tooltip becomes an unreadable wall of `owner/name` rows. Collapse that case to per-owner counts so the user can see at a glance which orgs / users they've connected and how many repos sit under each, while keeping the existing full-list behavior for small sets. Generated-By: PostHog Code Task-Id: b3534ac5-e998-46a1-b0bb-be29b51c67d1
oliverb123
approved these changes
May 20, 2026
Contributor
Prompt To Fix All With AIFix the following 1 code review issue. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 1
apps/code/src/renderer/features/settings/components/sections/GitHubIntegrationSection.tsx:22-33
**Missing tests for `summarizeReposByOwner`**
The helper has non-trivial logic — grouping, deduplication, a two-key sort (count desc, then owner name asc), and a fallback for repo strings without a `/` — all of which are easy to break silently. The project preference is for parameterised tests; without them, edge cases like ties in count, repos whose name has no owner prefix, or repos with the same owner but different capitalisation go unverified.
Reviews (1): Last reviewed commit: "feat(inbox): summarize many repos by own..." | Re-trigger Greptile |
Comment on lines
+22
to
+33
| function summarizeReposByOwner( | ||
| repositories: readonly string[], | ||
| ): { owner: string; count: number }[] { | ||
| const counts = new Map<string, number>(); | ||
| for (const repo of repositories) { | ||
| const owner = repo.includes("/") ? (repo.split("/", 1)[0] ?? repo) : repo; | ||
| counts.set(owner, (counts.get(owner) ?? 0) + 1); | ||
| } | ||
| return [...counts.entries()] | ||
| .map(([owner, count]) => ({ owner, count })) | ||
| .sort((a, b) => b.count - a.count || a.owner.localeCompare(b.owner)); | ||
| } |
Contributor
There was a problem hiding this comment.
Missing tests for
summarizeReposByOwner
The helper has non-trivial logic — grouping, deduplication, a two-key sort (count desc, then owner name asc), and a fallback for repo strings without a / — all of which are easy to break silently. The project preference is for parameterised tests; without them, edge cases like ties in count, repos whose name has no owner prefix, or repos with the same owner but different capitalisation go unverified.
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/code/src/renderer/features/settings/components/sections/GitHubIntegrationSection.tsx
Line: 22-33
Comment:
**Missing tests for `summarizeReposByOwner`**
The helper has non-trivial logic — grouping, deduplication, a two-key sort (count desc, then owner name asc), and a fallback for repo strings without a `/` — all of which are easy to break silently. The project preference is for parameterised tests; without them, edge cases like ties in count, repos whose name has no owner prefix, or repos with the same owner but different capitalisation go unverified.
How can I resolve this? If you propose a fix, please make it concise.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When a PostHog project's GitHub integration covers many repositories, the connected-repos tooltip on the inbox configuration dialog renders every
owner/nameas its own row. Past a handful of repos, the tooltip becomes a long wall of text that's harder to scan than the trigger label itself.Changes
GitHubIntegrationSection: when there are more than 10 repos, group them by owner and renderowner (count)rows with a leadingN repos across M ownerssummary line. Small sets (≤10) keep the existing flat list.summarizeReposByOwnerhelper sorted by count, then owner name, so the most-used owner sits at the top.How did you test this?
pnpm --filter code typecheckpnpm exec biome check apps/code/src/renderer/features/settings/components/sections/GitHubIntegrationSection.tsxPublish to changelog?
no
Created with PostHog Code