fix: polish review git changes UI#90
Conversation
|
Warning Rate limit exceeded
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 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 configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughRemoved 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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
🧹 Nitpick comments (2)
packages/ui/src/i18n/session-review-title.test.ts (1)
6-9: Optionally assert the newbranchtitle key in the same suite.Since
ui.sessionReview.title.branchwas introduced alongsidegit, 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 globalReactmock.The
React.createElementmock attached toglobalThisinbeforeEachis not cleaned up inafterEach. WhilebeforeEachresets it each time, consider adding cleanup inafterAllto 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
📒 Files selected for processing (8)
packages/app/src/pages/session.tsxpackages/app/src/pages/session/review-tab.test.tsxpackages/app/src/pages/session/review-tab.tsxpackages/app/src/pages/session/session-side-panel.test.tsxpackages/app/src/pages/session/session-side-panel.tsxpackages/ui/src/i18n/session-review-title.test.tspackages/ui/src/i18n/zh.tspackages/ui/src/i18n/zht.ts
There was a problem hiding this comment.
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
📒 Files selected for processing (3)
packages/app/src/pages/session/review-tab.test.tsxpackages/app/src/pages/session/session-side-panel.tsxpackages/ui/src/i18n/session-review-title.test.ts
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 changesheading.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 changeslabel made the screen harder to understand in Chinese.Related Issue
Closes #85
How To Verify
Also ran a fresh-eyes code review pass with no blocking findings.
bun test ./srcinpackages/uistill has two existing diff text assertion failures inapply-patch-file.test.tsandsession-diff.test.ts; the new i18n test passes andbun turbo test:cipasses.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
devbranchSummary by CodeRabbit
Changes
Localization
Tests