Skip to content

fix(code-review): show PR comment counts on files - #3433

Merged
trunk-io[bot] merged 6 commits into
mainfrom
posthog-code/show-pr-file-comment-counts
Jul 14, 2026
Merged

fix(code-review): show PR comment counts on files#3433
trunk-io[bot] merged 6 commits into
mainfrom
posthog-code/show-pr-file-comment-counts

Conversation

@MattPua

@MattPua MattPua commented Jul 14, 2026

Copy link
Copy Markdown
Member

Problem

PR file headers do not show which files have review comments or how many comments they contain, making it hard to look for comments when looking at PR files

Changes

CleanShot 2026-07-14 at 14 09 45@2x
  • Show comment counts in PR file headers when collapsed or expanded
  • Place comment counts before line change stats
  • Count all comments and replies for each file

How did you test this?

  • pnpm --filter @posthog/ui exec vitest run src/features/code-review/components/ReviewRows.test.tsx src/features/code-review/reviewShellParts.test.tsx src/features/code-review/prCommentThreads.test.ts
  • pnpm --filter @posthog/ui typecheck
  • Commit hook repository-wide pnpm typecheck

Automatic notifications

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

Created with PostHog Code

Generated-By: PostHog Code
Task-Id: 2e4a7ce2-5055-4c59-99c9-6daed60688c4
@trunk-io

trunk-io Bot commented Jul 14, 2026

Copy link
Copy Markdown

😎 Merged successfully - details.

@github-actions

github-actions Bot commented Jul 14, 2026

Copy link
Copy Markdown

React Doctor found no issues in the changed files. 🎉

Reviewed by React Doctor for commit a6cce55.

@MattPua
MattPua marked this pull request as ready for review July 14, 2026 17:40
@MattPua MattPua added the Stamphog This will request an autostamp by stamphog on small changes label Jul 14, 2026
github-actions[bot]
github-actions Bot previously approved these changes Jul 14, 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.

Focused, additive UI fix that threads a new headerMetadata ReactNode prop through file-diff headers to display per-file PR comment counts. The logic extracted from usePrDetails.ts into the new prCommentThreads.ts is a pure refactor (same behavior), and the new badge component and count helper are both covered by new unit tests.

@greptile-apps

greptile-apps Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "fix(code-review): show PR comment counts..." | Re-trigger Greptile

Comment thread packages/ui/src/features/code-review/prCommentThreads.ts Outdated
Comment thread packages/ui/src/features/code-review/components/PatchedFileDiff.tsx Outdated
Generated-By: PostHog Code
Task-Id: 2e4a7ce2-5055-4c59-99c9-6daed60688c4
@stamphog

stamphog Bot commented Jul 14, 2026

Copy link
Copy Markdown

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

@MattPua

MattPua commented Jul 14, 2026

Copy link
Copy Markdown
Member Author

Note

🤖 Automated follow-up by PostHog Code, not written by a human

Ran the xp-reviewer perspective against this PR.

Result

✅ Approved with no blocking correctness, scope, duplication, or maintainability findings.

Follow-up applied

  • Addressed the non-blocking test-coverage nit in f0dc20381
  • Added PatchedFileDiff coverage proving comment metadata reaches regular, binary, and unavailable file headers
  • Verified metadata remains before line-change stats in every path

Validation

  • 15 focused tests pass
  • @posthog/ui typecheck passes
  • Repository-wide commit-hook typecheck passes

Generated-By: PostHog Code
Task-Id: 2e4a7ce2-5055-4c59-99c9-6daed60688c4
@github-actions
github-actions Bot dismissed their stale review July 14, 2026 18:00

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

github-actions[bot]
github-actions Bot previously approved these changes Jul 14, 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.

Purely additive UI fix: extracts a utility, threads an optional prop, adds a badge component, and covers everything with new unit tests. Both bot comments are outdated — the renamed-file concern is already handled in the code, and the incomplete-callers concern is a graceful degradation, not a bug.

Generated-By: PostHog Code
Task-Id: 2e4a7ce2-5055-4c59-99c9-6daed60688c4
@github-actions
github-actions Bot dismissed their stale review July 14, 2026 18:03

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

github-actions[bot]
github-actions Bot previously approved these changes Jul 14, 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.

No showstoppers. Additive UI fix that threads an optional comment-count prop through file diff headers, with correct renamed-file handling and good test coverage.

Generated-By: PostHog Code
Task-Id: 2e4a7ce2-5055-4c59-99c9-6daed60688c4
@github-actions
github-actions Bot dismissed their stale review July 14, 2026 18:07

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

github-actions[bot]
github-actions Bot previously approved these changes Jul 14, 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.

Additive UI fix that threads an optional comment-count badge through file diff headers, with correct renamed-file handling and solid test coverage. All inline review concerns were addressed. No showstoppers.

Generated-By: PostHog Code
Task-Id: 2e4a7ce2-5055-4c59-99c9-6daed60688c4
@github-actions
github-actions Bot dismissed their stale review July 14, 2026 18:09

New commits pushed (delta classified non_trivial_delta) — 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.

Purely additive UI fix that threads an optional comment-count badge through file diff headers. Logic is correct, uses quill primitives as required, both greptile concerns (renamed files, direct callers) are addressed in the current diff, and new tests cover all three header variants.

@trunk-io
trunk-io Bot merged commit ac76f5f into main Jul 14, 2026
28 checks passed
@trunk-io
trunk-io Bot deleted the posthog-code/show-pr-file-comment-counts branch July 14, 2026 18:31
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