Repository navigation
feat(github): add PR comment reactions - #13470
Conversation
📝 WalkthroughWalkthroughGitHub PR comments now include GraphQL reaction subject IDs and viewer reaction state. A guarded client mutation adds or removes reactions with rate-limit tracking. IPC, runtime RPC, preload, and web APIs expose the mutation. Renderer state applies optimistic updates and restores prior state on failure. Comment rows now provide interactive reaction buttons and a picker with localized labels. Unit, integration, and end-to-end tests cover mapping, transport, state updates, rollback, and UI behavior. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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.
🧹 Nitpick comments (1)
src/renderer/src/components/github/CommentReactions.tsx (1)
65-69: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUse hash-based locale keys, not descriptive names. Both files use 10-character SHA-1-hash keys everywhere else (for example
a18f669c7a,7fad8509fe). The new reaction-related keys use descriptive names instead, breaking the convention thatlocalize-renderer-strings.mjsrelies on to generate and match keys.
src/renderer/src/components/github/CommentReactions.tsx#L65-L69: replace the key'auto.components.github.CommentReactions.addReaction'with the 10-character SHA-1 hash of<filePath>:Add reaction.src/renderer/src/components/github/CommentReactions.tsx#L152-L164: replace the keys'auto.components.github.CommentReactions.removeNamedReaction'and'auto.components.github.CommentReactions.addNamedReaction'with their corresponding hash-based keys.src/renderer/src/components/right-sidebar/ChecksPanel.tsx#L2980-L2985: replace the key'auto.components.right.sidebar.ChecksPanel.updateReactionFailed'with the 10-character SHA-1 hash of<filePath>:Failed to update reaction..Based on learnings, "generate locale keys as the first 10 characters of the SHA-1 hash of
<filePath>:<text>, matchinglocalize-renderer-strings.mjs. Reuse the same generated key whenever identical source text appears in the same context." Please confirm withlocalize-renderer-strings.mjswhether it requires this exact hash format to pick up and manage these strings, or whether descriptive keys are tolerated.Source: Learnings
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 20298944-28c1-4868-b3b2-927c9f4a23cc
📒 Files selected for processing (24)
src/main/github/client.test.tssrc/main/github/client.tssrc/main/github/comment-reactions.test.tssrc/main/github/comment-reactions.tssrc/main/ipc/github.test.tssrc/main/ipc/github.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/rpc/methods/github.test.tssrc/main/runtime/rpc/methods/github.tssrc/preload/api-types.tssrc/preload/index.tssrc/renderer/src/components/github/CommentReactions.tsxsrc/renderer/src/components/right-sidebar/ChecksPanel.tsxsrc/renderer/src/components/right-sidebar/checks-panel-content.tsxsrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/lib/pr-comment-reactions.test.tssrc/renderer/src/lib/pr-comment-reactions.tssrc/renderer/src/store/slices/github.test.tssrc/renderer/src/store/slices/github.tssrc/renderer/src/web/web-preload-api.test.tssrc/renderer/src/web/web-preload-api.tssrc/shared/types.tstests/e2e/helpers/pr-comments-sidebar-fixture.tstests/e2e/pr-comments-sidebar-cards.spec.ts
There was a problem hiding this comment.
🧹 Nitpick comments (1)
tests/e2e/helpers/source-control-ai-generation.ts (1)
49-57: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick winAvoid repeated clicks inside
expect.poll.
expect.pollcan invoke the callback more than once. If the tab transition takes longer than 250 ms, this code clickschecksButtonagain before the first state update is observed. If the button has toggle behavior, the second click can close the sidebar. Click once after the sidebar is ready, then poll onlyrightSidebarTab.If repeated clicks are intentional, verify that the Checks control is idempotent during a delayed tab transition.
Proposed polling flow
const checksButton = page.getByRole('button', { name: 'Checks', exact: true }) -await expect - .poll( - async () => { - if ((await page.evaluate(() => window.__store?.getState().rightSidebarTab)) !== 'checks') { - await checksButton.click() - } - await page.waitForTimeout(250) - return page.evaluate(() => window.__store?.getState().rightSidebarTab) - }, - { timeout: 10_000 } - ) - .toBe('checks') +await expect(checksButton).toBeVisible({ timeout: 10_000 }) +await checksButton.click() +await expect + .poll( + () => page.evaluate(() => window.__store?.getState().rightSidebarTab), + { timeout: 10_000 } + ) + .toBe('checks')
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 0d157b12-1ef1-4620-aee3-63358cb3c07a
📒 Files selected for processing (10)
src/main/github/client-pr-local-runtime.test.tssrc/main/github/client.tssrc/main/github/issues.test.tssrc/main/github/issues.tssrc/renderer/src/components/right-sidebar/ChecksPanel.tsxsrc/renderer/src/lib/pr-comment-reactions.test.tssrc/renderer/src/lib/pr-comment-reactions.tssrc/renderer/src/store/slices/github.test.tssrc/renderer/src/store/slices/github.tstests/e2e/helpers/source-control-ai-generation.ts
🚧 Files skipped from review as they are similar to previous changes (5)
- src/renderer/src/lib/pr-comment-reactions.test.ts
- src/renderer/src/components/right-sidebar/ChecksPanel.tsx
- src/renderer/src/store/slices/github.ts
- src/main/github/client.ts
- src/renderer/src/store/slices/github.test.ts
* feat(github): add PR comment reactions * fix(github): harden comment reaction updates --------- Co-authored-by: Jinwoo-H <[email protected]> (cherry picked from commit 158212b)
* feat(github): add PR comment reactions * fix(github): harden comment reaction updates --------- Co-authored-by: Jinwoo-H <[email protected]>
Summary
Related work
This supersedes #13456 functionally: that PR exposes permanent 👍/👎 controls, while this implementation matches GitHub's add-reaction picker, supports all eight reactions, and keeps newly posted comments immediately reactable without a refresh.
Proof
Verification
git diff --checkpassed.Internal review
Three review/fix rounds:
node_idfor newly created conversation/review comments and changed failed optimistic mutations to roll back only the attempted reaction.openCheckshelper; the helper now opens Checks through the rendered control and waits for route reconciliation to stabilize.Security and compatibility
ghargv fields, not shell-interpolated commands.