Skip to content

feat(inbox): summarize many repos by owner in the GitHub tooltip#2244

Merged
joshsny merged 1 commit into
mainfrom
posthog-code/inbox-repos-tooltip-summary
May 20, 2026
Merged

feat(inbox): summarize many repos by owner in the GitHub tooltip#2244
joshsny merged 1 commit into
mainfrom
posthog-code/inbox-repos-tooltip-summary

Conversation

@joshsny
Copy link
Copy Markdown
Contributor

@joshsny joshsny commented May 20, 2026

Problem

When a PostHog project's GitHub integration covers many repositories, the connected-repos tooltip on the inbox configuration dialog renders every owner/name as 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 render owner (count) rows with a leading N repos across M owners summary line. Small sets (≤10) keep the existing flat list.
  • Pulls the grouping into a small summarizeReposByOwner helper sorted by count, then owner name, so the most-used owner sits at the top.

How did you test this?

  • pnpm --filter code typecheck
  • pnpm exec biome check apps/code/src/renderer/features/settings/components/sections/GitHubIntegrationSection.tsx
  • Manual UI verification deferred — no screenshot yet; reviewer can sanity-check by hovering the "Connected and active (N repos)" label in Inbox configuration with an account that has >10 connected repos.

Publish to changelog?

no


Created with PostHog Code

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
@joshsny joshsny marked this pull request as ready for review May 20, 2026 12:21
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 20, 2026

Prompt To Fix All With AI
Fix 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));
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 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!

@joshsny joshsny merged commit 9799ae0 into main May 20, 2026
15 checks passed
@joshsny joshsny deleted the posthog-code/inbox-repos-tooltip-summary branch May 20, 2026 12:23
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