Skip to content

feat(desktop): view full commit message from the Diffs tab commit list - #6044

Closed
github-actions[bot] wants to merge 1 commit into
mainfrom
triage/issue-6043-30433879124
Closed

github-actions[bot] wants to merge 1 commit into
mainfrom
triage/issue-6043-30433879124

Conversation

@github-actions

@github-actions github-actions Bot commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor

What

Adds a way to read a commit's full message (subject + body) from the Diffs tab commit list, without leaving the app.

Why it wasn't possible before

This is a data-layer gap, not just a UI one. The commit list is built by getBranchComparison in apps/desktop/src/lib/trpc/routers/changes/workers/git-task-handlers.ts:193, which runs:

git log origin/<base>..HEAD --max-count=500 --format=%H|%h|%s|%an|%aI

%s is the subject only — the body is never fetched, so CommitInfo.message can only ever hold the first line. That's why the existing tooltip on CommitItem "reveals the same truncated subject line": there is nothing more in the payload to reveal.

I added a test that pins this down against a real temp repo (commit-message.test.ts, first case): a commit whose message has a body comes back from executeGitTask("getStatus", …) with message === subject and no trace of the body.

The change

Backend — fetch the message on demand

  • utils/commit-message.ts: readCommitMessage(git, hash) runs git log -1 --format=%B <hash> -- and splitCommitMessage() splits it into { subject, body }, folding a wrapped subject onto one line the way git's own %s does so the popover header matches the list row.
  • isValidCommitHash() restricts the ref to a hex object name, so the input can't reach git log as a flag or revision expression. Enforced inside readCommitMessage, not just at the call site.
  • commits.ts: new changes.getCommitMessage procedure, guarded by assertRegisteredWorktree.

On-demand rather than widening the status payload on purpose: getStatus is polled frequently and carries up to MAX_COMMIT_LIST_COUNT (500) commits, so shipping every body with each refresh would be a real cost for a rarely-read field.

Renderer — popover on the commit row

  • New CommitMessagePopover: a hover-revealed icon button on each commit row that opens a popover with the subject and the full body. The query is enabled only while open and uses an infinite staleTime (commit messages are immutable). Body text is whitespace-pre-wrap and select-text, so it can be read and copied — the renderer sets user-select: none globally.
  • CollapsibleRow gains an optional trailing slot. The row header lives inside Radix's CollapsibleTrigger (a <button>), so the popover trigger had to be a sibling rather than nested — that also keeps click-to-expand-files on the row working unchanged. CommitItem is the only consumer of CollapsibleRow.

Tests

apps/desktop/src/lib/trpc/routers/changes/utils/commit-message.test.ts — 11 tests:

  • reproduction: the commit list payload carries only the subject
  • readCommitMessage recovers subject + body for that same commit, from both the full and short hash
  • rejects non-hex refs (--output=…, HEAD; rm -rf /)
  • splitCommitMessage: subject-only, blank lines and indentation preserved in the body, wrapped subject folding, CRLF, empty input
  • isValidCommitHash: accepts short/full/uppercase hex, rejects flags, HEAD~1, branch names, too-short input
bun test apps/desktop/src/lib/trpc/routers/changes/   → 77 pass, 0 fail

bun run lint clean; bun run typecheck clean in apps/desktop.

Not verified / out of scope

  • No CDP run. This environment has no running desktop instance, so the popover has not been exercised end-to-end in the real app. The backend behavior is covered by the tests above; the rendering is not. Worth a manual pass before merge.
  • The RightSidebar renderer test suite has one pre-existing failure (useOrderedSections.test.tsx, missing electronTRPC global) that reproduces on a clean tree — unrelated to this change, and the reason no component-level test was added here.
  • The v2 workspace sidebar has a separate commit list (CommitFilterDropdown → CommitRow) with the same subject-only truncation, fed by host-service's git.listCommits. Left alone: the issue describes the v1 Diffs tab specifically (the tooltip behavior only exists there). The same getCommitMessage shape would port over.

Closes #6043


Open in Stage

Summary by cubic

View the full commit message (subject + body) from the Diffs tab via a popover on each commit row, without leaving the app. Addresses #6043 and avoids enlarging the polled status payload by fetching bodies on demand.

  • New Features
    • Backend: added changes.getCommitMessage to read git log -1 --format=%B and return { subject, body }, with strict commit-hash validation.
    • UI: new popover button on each commit row shows the full message; loads only while open and caches forever; body is selectable and preserves formatting.
    • Collapsible rows now support a trailing slot so the popover trigger sits beside (not inside) the row’s button.
    • Tests cover message splitting, hash validation, short/full hashes, and the subject-only behavior in the existing commit list.

Written for commit 6b69595. Summary will update on new commits.

Review in cubic

@ghost

ghost commented Jul 29, 2026

Copy link
Copy Markdown

Ready to review this PR? Stage has broken it down into 4 individual chapters for you:

Title
1 Implement commit message parsing utilities
2 Expose commit message query via TRPC
3 Add trailing slot to CollapsibleRow
4 Integrate commit message popover into UI
Open in Stage

Chapters generated by Stage for commit 6b69595 on Jul 29, 2026 8:14am UTC.

@Kitenite

Kitenite commented Aug 1, 2026

Copy link
Copy Markdown
Member

Closing: wrong surface, and it would now fail CI.

The change targets the v1 ChangesView, the sunset UI, and explicitly leaves the live v2 commit list alone — inverting the v2-first policy by adding a new feature to the surface being retired.

It also predates #6093, which added the no-main-process-blocking ratchet. The new lib/trpc/routers/changes/commits.ts constructs a git client on the main process and is not in allowedCounts, so the ratchet would fail it. The rule's own guidance applies: add a task type to changes/workers/git-task-types.ts and run it via runGitTask.

#6043 stays open (tracked as SUPER-1688, Low), re-scoped to the v2 changes tab with the git read going through the worker.

@Kitenite Kitenite closed this Aug 1, 2026
@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

🧹 Preview Cleanup Complete

The following preview resources have been cleaned up:

  • ⚠️ Neon database branch

Thank you for your contribution! 🎉

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.

Feat: View full commit message from Diffs tab commit list

1 participant