Conversation
|
🦸 Review Hero Summary Below consensus threshold (5 unique issues not confirmed by majority)
Nitpicks
Local fix prompt (copy to your coding agent)Fix these issues identified on the pull request. One commit per issue fixed.
|
002c6d9 to
8d3a79c
Compare
8d3a79c to
01ef971
Compare
| } catch (err) { | ||
| setError(err instanceof Error ? err.message : 'Failed to trigger review') | ||
| } finally { | ||
| setReviewHeroTriggering(false) |
There was a problem hiding this comment.
[Bugs & Correctness] suggestion
After a successful trigger, invalidateBranchStatus() fires a background refetch (line 293), then finally immediately sets setReviewHeroTriggering(false) (line 297). Between those two events there's a render where reviewHeroTriggering is false but status?.reviewHeroChecked hasn't updated yet, so reviewHeroChecked computes to false and the button briefly re-enables. A fast double-click could send a second POST. Fix: add a separate reviewHeroLocallyTriggered boolean that's set to true on success and never reset, so the button stays disabled until status.reviewHeroChecked confirms it: const reviewHeroChecked = reviewHeroLocallyTriggered || reviewHeroTriggering || (status?.reviewHeroChecked ?? false).
| <Shield size={11} /> | ||
| {disabled ? 'Review Hero' : 'Run Review Hero'} | ||
| </button> | ||
| </div> |
There was a problem hiding this comment.
[Frontend Snappiness] suggestion
No loading indicator while the trigger is in-flight. When triggering=true the button shows the same static disabled appearance as when checked=true — there is zero visual feedback that the click registered. Loader2 is already imported in this file but unused in ReviewHeroRow. Add a conditional: triggering ? <Loader2 size={11} className='animate-spin' /> : <Shield size={11} /> and change the label to e.g. 'Triggering…' so users know something is happening rather than wondering if their click failed.
| // ─── Review Hero checkbox patterns ───────────────────────────────────── | ||
|
|
||
| export const REVIEW_HERO_MARKER = '<!-- #ai-review -->' | ||
| export const REVIEW_HERO_CHECKED = /- \[x\] .+<!-- #ai-review -->/ |
There was a problem hiding this comment.
[Security] suggestion
REVIEW_HERO_CHECKED and REVIEW_HERO_UNCHECKED lack line anchors and the multiline flag. They match anywhere in the PR body, so anyone with write access to the PR description could add a spoofed '- [x] fake ' line anywhere (e.g., in a code block or comment) to make reviewHeroChecked return true and hide the Run Review Hero button. Fix: use /^- [x] [^\n]+/m (and same for UNCHECKED) so the pattern only matches at an actual line boundary.
|
🦸 Review Hero Summary Below consensus threshold (1 unique issue not confirmed by majority)
Local fix prompt (copy to your coding agent)Fix these issues identified on the pull request. One commit per issue fixed.
|
edmofro
left a comment
There was a problem hiding this comment.
src/lib/hooks/usePrSection.ts:297: After a successful trigger, invalidateBranchStatus() fires a background refetch (line 293), then finally immediately sets setReviewHeroTriggering(false) (line 297). Between those two events there's a render where reviewHeroTriggering is false but status?.reviewHeroChecked hasn't updated yet, so reviewHeroChecked computes to false and the button briefly re-enables. A fast double-click could send a second POST. Fix: add a separate reviewHeroLocallyTriggered boolean that's set to true on success and never reset, so the button stays disabled until status.reviewHeroChecked confirms it: const reviewHeroChecked = reviewHeroLocallyTriggered || reviewHeroTriggering || (status?.reviewHeroChecked ?? false).
src/components/card/PrSection.tsx:356: No loading indicator while the trigger is in-flight. When triggering=true the button shows the same static disabled appearance as when checked=true — there is zero visual feedback that the click registered. Loader2 is already imported in this file but unused in ReviewHeroRow. Add a conditional: triggering ? <Loader2 size={11} className='animate-spin' /> : <Shield size={11} /> and change the label to e.g. 'Triggering…' so users know something is happening rather than wondering if their click failed.
| // ─── Review Hero checkbox patterns ───────────────────────────────────── | ||
|
|
||
| export const REVIEW_HERO_MARKER = '<!-- #ai-review -->' | ||
| export const REVIEW_HERO_CHECKED = /- \[x\] .+<!-- #ai-review -->/ |
There was a problem hiding this comment.
REVIEW_HERO_CHECKED and REVIEW_HERO_UNCHECKED lack line anchors and the multiline flag. They match anywhere in the PR body, so anyone with write access to the PR description could add a spoofed '- [x] fake ' line anywhere (e.g., in a code block or comment) to make reviewHeroChecked return true and hide the Run Review Hero button. Fix: use /^- [x] [^\n]+/m (and same for UNCHECKED) so the pattern only matches at an actual line boundary.
Summary
Review hero is a system that reviews PRs and posts comments.
The way review hero is triggered is by checking a tickbox on the PR. We need a way to set that off. That part would be called "run review hero", and be a button on the workhorse side that mapped to the checkbox on the PR side. When it was checked on the PR side, the button should be disabled. When it is unchecked, including not present, (and we can poll for that) it should be enabled. Clicking it should edit the PR description to check the button.
Review Hero