Skip to content

fix: polish review git changes UI#90

Merged
Astro-Han merged 3 commits into
devfrom
codex/fix-review-git-changes
Apr 21, 2026
Merged

fix: polish review git changes UI#90
Astro-Han merged 3 commits into
devfrom
codex/fix-review-git-changes

Conversation

@Astro-Han

@Astro-Han Astro-Han commented Apr 21, 2026

Copy link
Copy Markdown
Owner

Summary

Update the Review Git changes surface so it matches issue #85: the main Review view no longer shows the standalone file-open plus button, PawWork always renders review diffs in unified mode, and Chinese locales no longer fall back to the English Git changes heading.

Why

The Review tab is aimed at non-technical users. The old plus button looked like an unrelated action, the unified/split switch exposed an unsupported choice, and the English Git changes label made the screen harder to understand in Chinese.

Related Issue

Closes #85

How To Verify

bun test --preload ./happydom.ts ./src/pages/session/session-side-panel.test.tsx
bun test --preload ./happydom.ts ./src/pages/session/review-tab.test.tsx
bun test ./src/i18n/session-review-title.test.ts
bun run typecheck
bun turbo typecheck
bun run test:unit
bun turbo test:ci

Also ran a fresh-eyes code review pass with no blocking findings. bun test ./src in packages/ui still has two existing diff text assertion failures in apply-patch-file.test.ts and session-diff.test.ts; the new i18n test passes and bun turbo test:ci passes.

Screenshots or Recordings

Not captured in this headless pass. The visible changes are covered by focused unit tests, and the reviewer noted only residual visual-spacing risk after removing the fallback plus-button row.

Checklist

  • I ran the relevant verification steps
  • I tested visible changes manually when needed
  • I am targeting the dev branch

Summary by CodeRabbit

  • Changes

    • Diff view is now fixed to unified across the session review UI.
    • File-open button in the review panel is now shown conditionally based on active view.
  • Localization

    • Added Simplified and Traditional Chinese translations for session review titles.
  • Tests

    • Added tests for the review tab, review file button visibility, and session review title translations.

@Astro-Han Astro-Han added bug Something isn't working P2 Medium priority ui Design system and user interface labels Apr 21, 2026
@coderabbitai

coderabbitai Bot commented Apr 21, 2026

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@Astro-Han has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 15 minutes and 12 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 15 minutes and 12 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: dd99c8dd-9d50-4995-a2d3-c43a56427bcb

📥 Commits

Reviewing files that changed from the base of the PR and between 6175eb4 and f796e1d.

📒 Files selected for processing (3)
  • packages/app/src/pages/session/review-tab.test.tsx
  • packages/app/src/pages/session/review-tab.tsx
  • packages/app/src/pages/session/session-side-panel.tsx
📝 Walkthrough

Walkthrough

Removed diff-style switching from the Review tab (hardcoded unified), adjusted file-open button visibility logic, added Chinese and Traditional Chinese i18n keys for the review title, and added tests for the review tab and side-panel helper.

Changes

Cohort / File(s) Summary
Diff-style removal
packages/app/src/pages/session/review-tab.tsx, packages/app/src/pages/session.tsx
Removed DiffStyle export and the diffStyle / onDiffStyleChange props; parent page no longer forwards diff-style controls; SessionReview now receives diffStyle="unified" unconditionally.
Review tab testing
packages/app/src/pages/session/review-tab.test.tsx
Added Bun test to assert SessionReviewTab renders with diffStyle: "unified" and no onDiffStyleChange prop.
File-open button visibility
packages/app/src/pages/session/session-side-panel.tsx, packages/app/src/pages/session/session-side-panel.test.tsx
Added exported helper shouldShowReviewFileOpenButton(activeTab, hasSecondaryTabs) and conditionally render the file-open + button in the review tabs fallback; added tests for the helper.
Chinese localization
packages/ui/src/i18n/zh.ts, packages/ui/src/i18n/zht.ts, packages/ui/src/i18n/session-review-title.test.ts
Added ui.sessionReview.title.git and ui.sessionReview.title.branch translations for Simplified and Traditional Chinese; added a test validating those strings.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

Suggested labels

app

Poem

🐰 A little hop through code and view,

Unified diffs, no split to rue,
Chinese titles now in place,
The plus hides when it’s out of space,
A nibble, a tweak — a cleaner pace.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.67% 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
Title check ✅ Passed The title 'fix: polish review git changes UI' accurately describes the main change—refining the Review tab's Git changes UI to improve clarity for non-technical users.
Description check ✅ Passed The PR description includes all required template sections: Summary, Why, Related Issue (#85), How To Verify (with specific test commands), and Checklist, with thorough context for the changes.
Linked Issues check ✅ Passed The code changes fully address all three coding requirements from issue #85: removing the file-open plus button from the main Review view [session-side-panel.tsx/test.tsx], hardcoding unified diff mode [review-tab.tsx/test.tsx], and localizing Git changes heading into Chinese [zh.ts, zht.ts, session-review-title.test.ts].
Out of Scope Changes check ✅ Passed All changes directly support issue #85 objectives: conditional button visibility, removing diff-style props, hardcoding unified mode, and adding Chinese translations. No unrelated or out-of-scope 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
  • Commit unit tests in branch codex/fix-review-git-changes

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

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request simplifies the session review interface by removing the diff style selection and hardcoding the view to 'unified'. It also adds logic to conditionally hide the file-open button in the side panel and includes new Chinese translations for session review titles. Review feedback identifies unnecessary React mocks and redundant DOM setup in the newly added test files.

Comment thread packages/app/src/pages/session/review-tab.test.tsx
Comment thread packages/app/src/pages/session/review-tab.test.tsx Outdated

@coderabbitai coderabbitai Bot left a comment

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.

🧹 Nitpick comments (2)
packages/ui/src/i18n/session-review-title.test.ts (1)

6-9: Optionally assert the new branch title key in the same suite.

Since ui.sessionReview.title.branch was introduced alongside git, adding assertions here would keep this regression test complete.

Suggested test expansion
 describe("session review title translations", () => {
   test("localizes Git changes for Chinese users", () => {
     expect(zh["ui.sessionReview.title.git"]).toBe("文件变更")
     expect(zht["ui.sessionReview.title.git"]).toBe("檔案變更")
+    expect(zh["ui.sessionReview.title.branch"]).toBe("分支变更")
+    expect(zht["ui.sessionReview.title.branch"]).toBe("分支變更")
   })
 })
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/ui/src/i18n/session-review-title.test.ts` around lines 6 - 9, The
test "localizes Git changes for Chinese users" is missing assertions for the new
key ui.sessionReview.title.branch; update that test to also assert
zh["ui.sessionReview.title.branch"] and zht["ui.sessionReview.title.branch"]
equal the expected Chinese strings (use the same locale fixtures zh and zht used
for the git key) so both branch and git keys are checked in the same suite.
packages/app/src/pages/session/review-tab.test.tsx (1)

37-42: Consider cleanup of global React mock.

The React.createElement mock attached to globalThis in beforeEach is not cleaned up in afterEach. While beforeEach resets it each time, consider adding cleanup in afterAll to avoid polluting the global scope for subsequent test files:

 afterAll(() => {
   mock.restore()
+  delete (globalThis as any).React
 })
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/app/src/pages/session/review-tab.test.tsx` around lines 37 - 42, The
test attaches a mock to globalThis.React.createElement in the beforeEach block
and never restores it; capture the original globalThis.React (e.g., const
_originalReact = globalThis.React) before mocking, then add an afterAll that
restores globalThis.React to _originalReact (or deletes globalThis.React if it
was undefined) to clean up the global mock; update the same test file’s
beforeEach/afterAll so React.createElement is mocked for each test but the
original global is restored afterwards.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@packages/app/src/pages/session/review-tab.test.tsx`:
- Around line 37-42: The test attaches a mock to globalThis.React.createElement
in the beforeEach block and never restores it; capture the original
globalThis.React (e.g., const _originalReact = globalThis.React) before mocking,
then add an afterAll that restores globalThis.React to _originalReact (or
deletes globalThis.React if it was undefined) to clean up the global mock;
update the same test file’s beforeEach/afterAll so React.createElement is mocked
for each test but the original global is restored afterwards.

In `@packages/ui/src/i18n/session-review-title.test.ts`:
- Around line 6-9: The test "localizes Git changes for Chinese users" is missing
assertions for the new key ui.sessionReview.title.branch; update that test to
also assert zh["ui.sessionReview.title.branch"] and
zht["ui.sessionReview.title.branch"] equal the expected Chinese strings (use the
same locale fixtures zh and zht used for the git key) so both branch and git
keys are checked in the same suite.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: ced9f17c-1535-44cc-bf7f-b12254287ba3

📥 Commits

Reviewing files that changed from the base of the PR and between 6947d7b and 5382c54.

📒 Files selected for processing (8)
  • packages/app/src/pages/session.tsx
  • packages/app/src/pages/session/review-tab.test.tsx
  • packages/app/src/pages/session/review-tab.tsx
  • packages/app/src/pages/session/session-side-panel.test.tsx
  • packages/app/src/pages/session/session-side-panel.tsx
  • packages/ui/src/i18n/session-review-title.test.ts
  • packages/ui/src/i18n/zh.ts
  • packages/ui/src/i18n/zht.ts

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/app/src/pages/session/review-tab.test.tsx`:
- Around line 55-84: The test creates a Solid root with createRoot and assigns
the disposer to dispose but calls dispose() only at the end, which can leak
reactive state if an assertion fails; modify the test so the
createRoot/SessionReviewTab setup and assertions are wrapped in try/finally (or
ensure cleanup in a finally) and call the disposer returned by createRoot
(dispose) in the finally block to guarantee the Solid root is disposed even when
assertions (expect(...) calls) throw.
🪄 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: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: b3c984a4-9827-4220-89ed-e1d1f0e40f06

📥 Commits

Reviewing files that changed from the base of the PR and between 5382c54 and 6175eb4.

📒 Files selected for processing (3)
  • packages/app/src/pages/session/review-tab.test.tsx
  • packages/app/src/pages/session/session-side-panel.tsx
  • packages/ui/src/i18n/session-review-title.test.ts

Comment thread packages/app/src/pages/session/review-tab.test.tsx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working P2 Medium priority ui Design system and user interface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Polish Review Git changes controls and localization

1 participant