Repository navigation
feat(desktop,host-service): show full commit message on hover in v2 changes tab - #6126
RobithYusuf wants to merge 1 commit into
Conversation
…hanges tab listCommits reads commits with --format=%s, so a commit's body never reaches the renderer. Hovering a row just repeated the truncated subject, because there was nothing else in the payload to show. Adds a git/getCommitMessage worker task (git log -1 --format=%B) behind a query of the same name, and a hover card on CommitRow with the subject and the body — where trailers like Co-Authored-By live. The body is fetched on demand instead of widening listCommits: that query is polled and can carry every commit ahead of the base branch, so sending every body on each refresh would cost far more than a field the UI reads one commit at a time. The card only queries while open, and caches forever since commit messages don't change. Both the filter dropdown and the range modal render CommitRow, so this covers both surfaces. Closes ParadevAI#6043
📝 WalkthroughWalkthroughThe Changes tab now retrieves full commit messages through a workspace-aware Git query. Commit rows display the subject, body, and metadata in a tooltip. Hash validation, message parsing, worker execution, request coalescing, and tests were added. ChangesCommit message retrieval and display
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant CommitRow
participant gitRouter
participant gitCommitMessageTask
participant GitRepository
CommitRow->>gitRouter: getCommitMessage(workspaceId, commitHash)
gitRouter->>gitCommitMessageTask: execute validated request
gitCommitMessageTask->>GitRepository: read commit message
GitRepository-->>gitCommitMessageTask: raw commit message
gitCommitMessageTask-->>gitRouter: subject and body
gitRouter-->>CommitRow: CommitMessage
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
packages/host-service/src/workers/tasks/git.ts (1)
17-21: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider a neutral home for
commit-message.ts.
commit-message.tslives undertrpc/router/git/utils/, but it is now imported by the worker layer too. Workers importing from a router-specific folder inverts the usual dependency direction (router → workers), even though no circular import exists today. Moving it to a shared location (for example alongside other cross-layer git utilities) would make the dependency direction clearer for future maintainers.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/host-service/src/workers/tasks/git.ts` around lines 17 - 21, Move commit-message.ts from the trpc/router/git/utils area to a neutral shared Git utility location, then update the worker import and every other reference to use the new path. Preserve the existing exports and behavior of CommitMessage, isValidCommitHash, and splitCommitMessage.packages/host-service/src/trpc/router/git/utils/resolve-worktree.ts (1)
6-13: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueOptional: extract the context type for readability.
The inline
Pick<Parameters<Parameters<typeof protectedProcedure.query>[0]>[0]["ctx"], "db">expression is correct, and it is a known technique the tRPC community uses to extract a procedure's context type. As a locally-scoped (non-exported) type alias, it would be easier to read at the call site without changing behavior.Based on my research, exporting the same expression as a standalone generic type alias at module scope has caused TypeScript "circularly references itself" errors for some tRPC users, so keep this as an unexported, non-generic alias if you extract it.
♻️ Optional extraction
+type WorktreeLookupContext = Pick< + Parameters<Parameters<typeof protectedProcedure.query>[0]>[0]["ctx"], + "db" +>; + /** Only `db` is read, so this also accepts the plain context an offLoop() * `prepare` stage receives (where request-only fields are optional). */ export function resolveWorktreePath( - ctx: Pick< - Parameters<Parameters<typeof protectedProcedure.query>[0]>[0]["ctx"], - "db" - >, + ctx: WorktreeLookupContext, workspaceId: string, ): string {🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/host-service/src/trpc/router/git/utils/resolve-worktree.ts` around lines 6 - 13, Optionally introduce a locally scoped, non-exported, non-generic type alias for the existing context type expression used by resolveWorktreePath, then use that alias in the function signature. Preserve the current Pick-based "db"-only contract and avoid exporting the alias.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/`$workspaceId/components/WorkspaceSidebar/hooks/useChangesTab/components/CommitFilterDropdown/components/CommitRow/CommitRow.tsx:
- Line 83: Remove the cursor-text and select-text classes from the div inside
TooltipContent in CommitRow, while preserving the remaining layout and
text-wrapping classes. Do not add alternative text-selection behavior to the
hover-dismissable tooltip.
---
Nitpick comments:
In `@packages/host-service/src/trpc/router/git/utils/resolve-worktree.ts`:
- Around line 6-13: Optionally introduce a locally scoped, non-exported,
non-generic type alias for the existing context type expression used by
resolveWorktreePath, then use that alias in the function signature. Preserve the
current Pick-based "db"-only contract and avoid exporting the alias.
In `@packages/host-service/src/workers/tasks/git.ts`:
- Around line 17-21: Move commit-message.ts from the trpc/router/git/utils area
to a neutral shared Git utility location, then update the worker import and
every other reference to use the new path. Preserve the existing exports and
behavior of CommitMessage, isValidCommitHash, and splitCommitMessage.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 4b2ba64f-9711-4e03-9a79-ca5c11d8e47b
📒 Files selected for processing (11)
apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceSidebar/hooks/useChangesTab/components/ChangesTabContent/ChangesTabContent.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceSidebar/hooks/useChangesTab/components/ChangesToolbar/ChangesToolbar.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceSidebar/hooks/useChangesTab/components/CommitFilterDropdown/CommitFilterDropdown.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceSidebar/hooks/useChangesTab/components/CommitFilterDropdown/components/CommitRow/CommitRow.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceSidebar/hooks/useChangesTab/components/CommitFilterDropdown/components/RangeModal/RangeModal.tsxpackages/host-service/src/trpc/router/git/git.tspackages/host-service/src/trpc/router/git/utils/commit-message.test.tspackages/host-service/src/trpc/router/git/utils/commit-message.tspackages/host-service/src/trpc/router/git/utils/resolve-worktree.tspackages/host-service/src/workers/tasks/git.test.tspackages/host-service/src/workers/tasks/git.ts
| {subject} | ||
| </div> | ||
| {body && ( | ||
| <div className="mt-1.5 cursor-text select-text whitespace-pre-wrap font-normal leading-relaxed wrap-break-word"> |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Remove text-selection styling from the hover tooltip.
TooltipContent dismisses when the pointer leaves its trigger. The cursor-text select-text classes invite selection, but moving the pointer to select the body dismisses the tooltip. Remove these classes. Use a persistent surface if users must copy commit bodies.
Based on learnings, do not use select-text or cursor-text in hover-dismissable tooltip content.
Proposed fix
- <div className="mt-1.5 cursor-text select-text whitespace-pre-wrap font-normal leading-relaxed wrap-break-word">
+ <div className="mt-1.5 whitespace-pre-wrap font-normal leading-relaxed wrap-break-word">📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| <div className="mt-1.5 cursor-text select-text whitespace-pre-wrap font-normal leading-relaxed wrap-break-word"> | |
| <div className="mt-1.5 whitespace-pre-wrap font-normal leading-relaxed wrap-break-word"> |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/`$workspaceId/components/WorkspaceSidebar/hooks/useChangesTab/components/CommitFilterDropdown/components/CommitRow/CommitRow.tsx
at line 83, Remove the cursor-text and select-text classes from the div inside
TooltipContent in CommitRow, while preserving the remaining layout and
text-wrapping classes. Do not add alternative text-selection behavior to the
hover-dismissable tooltip.
Source: Learnings
There was a problem hiding this comment.
1 issue found across 11 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceSidebar/hooks/useChangesTab/components/CommitFilterDropdown/components/CommitRow/CommitRow.tsx">
<violation number="1" location="apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceSidebar/hooks/useChangesTab/components/CommitFilterDropdown/components/CommitRow/CommitRow.tsx:44">
P2: When the on-demand getCommitMessage fetch fails, the tooltip silently falls back to the commit subject and an empty body (`subject = message.data?.subject ?? commit.message`, `body = message.data?.body ?? ""`), so a failed read is indistinguishable from a commit that genuinely has no body. Since surfacing the full message is the entire point of this hover interaction, a user who sees the tooltip after a load failure will reasonably conclude the commit has no body. Consider surfacing the failure — e.g. an error note and/or a retry — when `message.isError` is set, while still keeping the subject as the graceful fallback for the brief loading window.</violation>
</file>
Architecture diagram
sequenceDiagram
participant UI as CommitRow (Renderer)
participant Tooltip as Tooltip (Radix)
participant TRPC as tRPC Router
participant OffLoop as offLoop() Queue
participant Worker as Worker Pool
participant Git as Git (simple-git)
participant DB as Database
Note over UI,DB: NEW: Hover Commit -> Full Message Flow
UI->>UI: useState(open=false)
UI->>Tooltip: wrap existing markup as TooltipTrigger
Note over UI,Tooltip: delayDuration=400ms
Tooltip->>UI: onOpenChange(true)
UI->>UI: setOpen(true)
UI->>TRPC: getCommitMessage.useQuery({ workspaceId, commitHash })
Note over UI,TRPC: enabled: open (only when tooltip visible)
Note over UI,TRPC: staleTime: Infinity (never refetch same commit)
TRPC->>TRPC: z.string().refine(isValidCommitHash)
Note over TRPC: Validate hash is hex 7-64 chars
alt Valid hash
TRPC->>OffLoop: offLoop({ task: gitCommitMessageTask })
Note over TRPC,OffLoop: coalesce + dedupe by workspaceId:commitHash
OffLoop->>OffLoop: prepare(ctx, input)
Note over OffLoop: resolveWorktreePath(ctx, workspaceId)
Note over OffLoop: CHANGED: only requires Pick<ctx, "db">
DB->>OffLoop: look up worktree path
OffLoop-->>OffLoop: { worktreePath, commitHash, gitEnv }
OffLoop->>Worker: schedule task (type: git/getCommitMessage)
Worker->>Worker: isValidCommitHash(commitHash)
Note over Worker: Re-validate (defense in depth)
Worker->>Git: createUserSimpleGit(worktreePath).env(gitEnv)
Git->>Git: git log -1 --format=%B <hash> --
Git-->>Worker: raw commit message
Worker->>Worker: splitCommitMessage(raw)
Note over Worker: Fold subject to one line
Note over Worker: Preserve body verbatim (trailers, indentation)
Worker-->>OffLoop: { subject, body }
OffLoop-->>TRPC: result
TRPC-->>UI: { subject, body }
UI->>UI: subject = message.data?.subject ?? commit.message
UI->>UI: body = message.data?.body ?? ""
UI->>Tooltip: TooltipContent with subject + scrollable body
Note over UI,Tooltip: side="left", align="start"
Note over UI,Tooltip: max-h-64 with overflow-y-auto
Note over UI,Tooltip: Arrow + hash line stay fixed
else Invalid hash
TRPC-->>UI: Zod validation error
UI->>UI: fallback to commit.message (subject only)
end
Note over UI,Tooltip: On close (onOpenChange(false))
UI->>UI: setOpen(false)
Note over UI,TRPC: Query stays cached (staleTime=Infinity)
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| { workspaceId, commitHash: commit.hash }, | ||
| { enabled: open, staleTime: Number.POSITIVE_INFINITY }, | ||
| ); | ||
| const subject = message.data?.subject ?? commit.message; |
There was a problem hiding this comment.
P2: When the on-demand getCommitMessage fetch fails, the tooltip silently falls back to the commit subject and an empty body (subject = message.data?.subject ?? commit.message, body = message.data?.body ?? ""), so a failed read is indistinguishable from a commit that genuinely has no body. Since surfacing the full message is the entire point of this hover interaction, a user who sees the tooltip after a load failure will reasonably conclude the commit has no body. Consider surfacing the failure — e.g. an error note and/or a retry — when message.isError is set, while still keeping the subject as the graceful fallback for the brief loading window.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceSidebar/hooks/useChangesTab/components/CommitFilterDropdown/components/CommitRow/CommitRow.tsx, line 44:
<comment>When the on-demand getCommitMessage fetch fails, the tooltip silently falls back to the commit subject and an empty body (`subject = message.data?.subject ?? commit.message`, `body = message.data?.body ?? ""`), so a failed read is indistinguishable from a commit that genuinely has no body. Since surfacing the full message is the entire point of this hover interaction, a user who sees the tooltip after a load failure will reasonably conclude the commit has no body. Consider surfacing the failure — e.g. an error note and/or a retry — when `message.isError` is set, while still keeping the subject as the graceful fallback for the brief loading window.</comment>
<file context>
@@ -18,26 +21,74 @@ function timeAgo(date: string): string {
+ { workspaceId, commitHash: commit.hash },
+ { enabled: open, staleTime: Number.POSITIVE_INFINITY },
+ );
+ const subject = message.data?.subject ?? commit.message;
+ const body = message.data?.body ?? "";
+
</file context>
|
This PR has had no activity for 53 days and will close in 7 days unless there is new activity. If this contribution is still important or relevant, please leave a comment to keep it open. If it closes, you are welcome to reopen it or ask a maintainer to reopen it. Thank you for contributing! |
|
This PR was automatically closed due to inactivity to help keep the review queue manageable. This does not mean the contribution was rejected. If this contribution is still important or relevant, please reopen it or leave a comment asking a maintainer to reopen it. Thank you for contributing! |
Closes #6043.
Hovering a commit in the v2 Changes tab now shows its full message — subject plus body — without leaving the app.
Why hovering couldn't already do this
git.listCommitsbuilds its rows withgit log <base>..HEAD --format=%H\t%h\t%s\t%an\t%ae\t%aI.%sis the subject only, soCommit.messagecan never hold more than the first line. The truncated row is the visible half of the problem; the other half is that a tooltip over it would only repeat that same subject, because nothing else is in the payload. Trailers likeCo-Authored-By:were invisible for the same reason.The first test in
workers/tasks/git.test.tspins that down against a real temp repo, so the gap can't quietly reopen.What changed
Backend. A
git/getCommitMessageworker task runsgit log -1 --format=%B <hash> --, andsplitCommitMessage()splits the result into{ subject, body }. It folds a wrapped subject onto one line the way git's own%sdoes, so the card header matches the row that opened it.isValidCommitHash()restricts the ref to a hex object name so it can't reachgit logas a flag or a revision expression — enforced inside the task, not just at the call site.The
getCommitMessagequery goes throughoffLoop(), so noctx.git()and nocreateUserSimpleGiton the event loop. Theno-main-loop-blockingcounts fortrpc/router/git/git.tsare unchanged at 12 and 2.I fetch the body on demand rather than widening
listCommits: that query is polled and can carry every commit ahead of the base branch, so sending every body on each refresh would cost far more than a field the UI reads one commit at a time.%balso contains newlines, which would break the tab-separated line parsinglistCommitsdepends on.Renderer.
CommitRowwraps its existing markup in aTooltip. The query is enabled only while the card is open and uses an infinitestaleTime— commit messages don't change, so reopening the same card never refetches. Only the message area scrolls; the arrow and the hash line stay put, since bodies are unbounded and a long one would otherwise grow the card past the window.workspaceIdis threaded down fromChangesTabContentso the row can query.Both the filter dropdown and the range modal render
CommitRow, so this covers both.Scope
Kept narrow on purpose, following the note on #6044:
ChangesViewis untouched.DropdownMenuItem, where a popover means nested portals and focus-trap conflicts; a tooltip takes no focus and needed no structural change to the menu.listCommitshas no cap. Full history or a commit graph is a different ask and belongs to the [Tracker] Diff viewer & Changes tab issues (stale-issue sweep, July 2026) #5594 tracker.One drive-by:
resolveWorktreePathis narrowed toPick<ctx, "db">. It only ever readsdb, and the old signature demanded a request-scoped context that anoffLoop()preparestage doesn't have. Every existing caller still satisfies it.Credit
The investigation and the
splitCommitMessage/isValidCommitHashshape come from #6044, which was closed for targeting the v1 surface and for predating theno-main-process-blockingratchet added in #6093. This is the same feature rebuilt on v2 with the git read going through the worker pool, as suggested there.Tests
utils/commit-message.test.ts— 11 tests: subject-only, blank lines and indentation preserved in the body, trailers kept, wrapped-subject folding, CRLF, empty input; hash validation accepts short/full/uppercase hex and rejects--output=…,HEAD~1, branch names, and too-short input.workers/tasks/git.test.ts— 4 tests over a real temp repo: the%sreproduction, subject + body from a full hash, the same from an abbreviated hash, and rejection of non-hex refs.Mutation-checked; each deliberate break failed exactly the tests that should catch it —
%B→%s(2 fail), hash guard removed (1 fail), subject folding disabled (2 fail).The screenshot above is this branch driven over CDP against a local stack, hovering a commit in this repo's own history. I opened the dropdown and hovered rows with dispatched pointer events and read the rendered card back to confirm it matches the hovered row, so the card content is verified, not just its presence.
bun run testin full shows 35 pre-existing failures in@superset/host-serviceon my machine (ENOENT reading node_modules/better-sqlite3). The count is identical on a cleanmain, so it's unrelated; this branch takes that package from 711 to 726 passing.Summary by cubic
Show the full commit message (subject + body) on hover in the v2 Changes tab. Adds a lightweight backend query and a tooltip UI so you can read details, including trailers, without leaving the app.
@superset/host-service):git/getCommitMessageworker task viaoffLooprunsgit log -1 --format=%B, splits to{ subject, body }, and validates refs withisValidCommitHash.@superset/ui/tooltip,@superset/workspace-client): Tooltip inCommitRowfetches on hover only, caches forever, and scrolls the message area while keeping header/meta fixed.listCommitsstays slim; query is coalesced/deduped; no main-loop blocking.resolveWorktreePathnarrowed toPick<ctx, "db">.Written for commit a911b8b. Summary will update on new commits.
Summary by CodeRabbit
New Features
Bug Fixes
Tests