Skip to content

feat: setting to auto-expand commit details in History tab#1695

Open
ubuntudroid wants to merge 6 commits intogeneralaction:mainfrom
ubuntudroid:sven/show-full-commit-message-above-selected-commit-6c3
Open

feat: setting to auto-expand commit details in History tab#1695
ubuntudroid wants to merge 6 commits intogeneralaction:mainfrom
ubuntudroid:sven/show-full-commit-message-above-selected-commit-6c3

Conversation

@ubuntudroid
Copy link
Copy Markdown
Contributor

@ubuntudroid ubuntudroid commented Apr 8, 2026

Summary

  • Adds an "Expand commit details by default" toggle in Settings → Interface → Workspace
  • When enabled, selecting a commit in the History tab immediately shows the full message, author, and hash — no click required
  • Fixes commit subject being truncated with an ellipsis even when the detail section is expanded

Fixes

Fixes #1693
Fixes #1694

Snapshot

N/A

Type of change

  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)

Mandatory Tasks

  • I have self-reviewed the code

Checklist

  • I have read the contributing guide
  • I have commented my code, particularly in hard-to-understand areas
  • I have checked if my PR needs changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works

Summary by CodeRabbit

  • New Features

    • Added "Expand commit details by default" toggle in Interface settings (off by default). Toggle is disabled while settings are loading.
    • History view now respects that setting: commit details open by default and subject truncation is lifted when enabled.
  • Tests

    • Added tests for settings normalization and for the new settings control behavior.

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 8, 2026

@ubuntudroid is attempting to deploy a commit to the General Action Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 8, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a6f551e6-c888-4bd2-9cc9-5c117bfe7e47

📥 Commits

Reviewing files that changed from the base of the PR and between 05c7edf and 9d7da44.

📒 Files selected for processing (2)
  • src/renderer/components/CommitDetailSettingsCard.tsx
  • src/test/main/settings.test.ts
✅ Files skipped from review due to trivial changes (2)
  • src/test/main/settings.test.ts
  • src/renderer/components/CommitDetailSettingsCard.tsx

📝 Walkthrough

Walkthrough

Adds an optional expandCommitDetail interface setting, a Settings UI toggle to control it, normalization and tests for the new setting, and uses the setting in HistoryTab to initialize commit-detail expansion and conditionally disable subject truncation.

Changes

Cohort / File(s) Summary
Settings Core
src/main/settings.ts
Added expandCommitDetail?: boolean to InterfaceSettings; added default false in DEFAULT_SETTINGS.interface; normalizeSettings now coerces/returns interface.expandCommitDetail.
Settings UI
src/renderer/components/CommitDetailSettingsCard.tsx, src/renderer/components/SettingsPage.tsx
New CommitDetailSettingsCard component with a labeled Switch bound to settings.interface.expandCommitDetail; imported and rendered in SettingsPage under Interface → Workspace.
History behavior
src/renderer/components/diff-viewer/HistoryTab.tsx
Reads settings?.interface?.expandCommitDetail to compute expandByDefault; on commit select, sets detailExpanded to that value; subject truncation (truncate class) is conditional on detailExpanded.
Tests
src/test/main/settings.test.ts, src/test/renderer/CommitDetailSettingsCard.component.test.tsx
Added unit tests for normalizeSettings handling of expandCommitDetail; added component tests validating toggle initial state and update calls.

Sequence Diagram(s)

sequenceDiagram
  participant User as "User (clicks toggle / selects commit)"
  participant UI as "Settings UI\nCommitDetailSettingsCard"
  participant Settings as "AppSettings Provider\n(normalize & persist)"
  participant History as "HistoryTab"

  User->>UI: Toggle "Expand commit details by default"
  UI->>Settings: updateSettings({ interface:{ expandCommitDetail } })
  Settings-->>UI: confirm saved

  User->>History: Select commit
  History->>Settings: read settings.interface.expandCommitDetail
  Settings-->>History: return boolean
  History->>History: set detailExpanded = expandCommitDetail
  History-->>User: render commit detail expanded/collapsed (subject truncation conditional)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I twitch my whiskers at a new little switch,
Toggle to see commits without a twitch,
Details unfurl and subjects can wrap,
No more ellipses hiding the map,
Hooray — history shows every stitch! 🥕

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title clearly and concisely summarizes the main feature: adding a setting to auto-expand commit details in the History tab.
Linked Issues check ✅ Passed All code requirements from #1693 and #1694 are met: expandCommitDetail setting added to settings, CommitDetailSettingsCard UI component created, HistoryTab updated to auto-expand based on setting, commit subject truncation fixed, and comprehensive tests added.
Out of Scope Changes check ✅ Passed All changes are directly scoped to implementing the auto-expand feature and fixing the truncation bug; no unrelated or extraneous modifications detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@ubuntudroid ubuntudroid force-pushed the sven/show-full-commit-message-above-selected-commit-6c3 branch from d30e01c to 05c7edf Compare April 8, 2026 15:37
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
src/renderer/components/CommitDetailSettingsCard.tsx (1)

21-28: Remove redundant defaultChecked prop on controlled Switch.

The Switch is controlled via the checked prop. Using defaultChecked on a controlled component is unnecessary and can cause React warnings or confusion. Remove it for cleaner code.

♻️ Proposed fix
       <Switch
         checked={expandCommitDetail}
-        defaultChecked={expandCommitDetail}
         disabled={loading}
         onCheckedChange={(checked) =>
           updateSettings({ interface: { expandCommitDetail: checked } })
         }
       />
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/renderer/components/CommitDetailSettingsCard.tsx` around lines 21 - 28,
The Switch is being used as a controlled component
(checked={expandCommitDetail}), so remove the redundant defaultChecked prop to
avoid React warnings; update the JSX for the Switch (the element using props
checked, defaultChecked, disabled, onCheckedChange) by deleting
defaultChecked={expandCommitDetail} and keep checked={expandCommitDetail},
disabled={loading}, and the onCheckedChange handler that calls updateSettings({
interface: { expandCommitDetail: checked } }).
src/test/main/settings.test.ts (1)

287-302: Good test coverage; consider adding an edge case test.

The test suite correctly covers the main scenarios. For consistency with other test suites (e.g., showResourceMonitor at lines 100-103), consider adding a test for when the interface section exists but expandCommitDetail is undefined:

it('coerces missing value inside interface to false', () => {
  const result = normalizeSettings(makeSettings({ interface: {} }));
  expect(result.interface?.expandCommitDetail).toBe(false);
});
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/test/main/settings.test.ts` around lines 287 - 302, Add an edge-case unit
test to the "normalizeSettings – expandCommitDetail" suite: when an interface
object exists but expandCommitDetail is omitted, normalizeSettings should coerce
it to false; add a spec that calls normalizeSettings(makeSettings({ interface:
{} })) and asserts result.interface?.expandCommitDetail === false so the
behavior mirrors other suites like showResourceMonitor and covers the
undefined-inside-interface case for normalizeSettings and makeSettings.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/renderer/components/CommitDetailSettingsCard.tsx`:
- Around line 21-28: The Switch is being used as a controlled component
(checked={expandCommitDetail}), so remove the redundant defaultChecked prop to
avoid React warnings; update the JSX for the Switch (the element using props
checked, defaultChecked, disabled, onCheckedChange) by deleting
defaultChecked={expandCommitDetail} and keep checked={expandCommitDetail},
disabled={loading}, and the onCheckedChange handler that calls updateSettings({
interface: { expandCommitDetail: checked } }).

In `@src/test/main/settings.test.ts`:
- Around line 287-302: Add an edge-case unit test to the "normalizeSettings –
expandCommitDetail" suite: when an interface object exists but
expandCommitDetail is omitted, normalizeSettings should coerce it to false; add
a spec that calls normalizeSettings(makeSettings({ interface: {} })) and asserts
result.interface?.expandCommitDetail === false so the behavior mirrors other
suites like showResourceMonitor and covers the undefined-inside-interface case
for normalizeSettings and makeSettings.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9919a3b5-d7a4-41a9-80f2-ab33cfdb2b58

📥 Commits

Reviewing files that changed from the base of the PR and between c649863 and d30e01c.

📒 Files selected for processing (6)
  • src/main/settings.ts
  • src/renderer/components/CommitDetailSettingsCard.tsx
  • src/renderer/components/SettingsPage.tsx
  • src/renderer/components/diff-viewer/HistoryTab.tsx
  • src/test/main/settings.test.ts
  • src/test/renderer/CommitDetailSettingsCard.component.test.tsx

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.

[bug]: Commit subject truncated when commit detail is expanded in History tab [feat]: Setting to auto-expand commit details in History tab

2 participants