fix(web-ui): address CodeRabbit review feedback on Glitch Capture (#568)#577
fix(web-ui): address CodeRabbit review feedback on Glitch Capture (#568)#577
Conversation
Three bugs identified post-merge, all confirmed and fixed: 1. Gates silently discarded (Medium) — selectedGates was validated but never sent to the backend. CaptureRequirementRequest has no gates field; obligations are derived by LLM from description. Fix: append selected gates as "Required gates: ..." section to the description so the backend LLM uses them when deriving obligations. 2. Expiry field was dead code (Low) — expires state was collected and rendered but CaptureRequirementRequest has no expires field (that belongs to WaiveRequirementRequest). Fix: removed expiry field from form and state entirely. 3. Axios error detail never surfaced (Low) — err.detail is always undefined on axios errors; detail lives at err.response.data.detail. Fix: correct extraction path with string-type guard and fallback. Also refactored from centered Dialog (max-w-lg) to right-anchored slide-over using Radix DialogPrimitive directly, as the issue spec required "full-screen modal or slide-over". Tests: 718/718 pass (added tests for correct error surfacing and absence of expiry field; updated submission assertion to verify gates are appended to description).
|
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 1 minutes and 1 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: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughThe CaptureGlitchModal component has been refactored from a centered dialog modal to a right-anchored slide-over using Radix UI primitives. The expiry date field has been removed entirely, selected gate checkboxes are now appended to the form description for backend processing, and error handling now extracts specific error details from Axios responses. All corresponding test expectations have been updated accordingly. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Review — PR #577 (Glitch Capture follow-up fixes)The three bug fixes are correct and well-reasoned. The slide-over refactor using Two small issues worth addressing before merge: 1. Unused
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
web-ui/src/__tests__/components/proof/CaptureGlitchModal.test.tsx (1)
129-134: Make gate payload assertion order-agnostic to reduce brittleness.The exact
unit, secstring can fail on benign ordering changes while behavior is still correct.Proposed test tweak
- description: 'Something broke in production\n\nRequired gates: unit, sec', + description: expect.stringMatching( + /^Something broke in production\n\nRequired gates: (unit, sec|sec, unit)$/ + ),🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@web-ui/src/__tests__/components/proof/CaptureGlitchModal.test.tsx` around lines 129 - 134, The assertion for mockCapture using WORKSPACE and expect.objectContaining is brittle because it asserts the gates string order; update the test (around mockCapture, WORKSPACE, expect.objectContaining, and the description/title/severity checks) to be order-agnostic by either extracting the description from the actual call and asserting it contains both gate names (e.g., contains 'unit' and 'sec') regardless of order, or by asserting against a parsed/explicit requiredGates array instead of the exact "unit, sec" substring; keep the same objectContaining checks for title and severity but replace the exact description string check with a check that validates presence of both gate tokens in any order.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@web-ui/src/components/proof/CaptureGlitchModal.tsx`:
- Around line 147-155: Replace the inline SVG close glyph in
CaptureGlitchModal.tsx with the repository-standard Hugeicons React icon: remove
the <svg> inside the DialogPrimitive.Close button and render the appropriate
Hugeicons component (e.g., XMark icon) instead; add the corresponding import
from '@hugeicons/react' at the top of the file and ensure the rendered icon
inherits the same className/aria-hidden attributes used on the original <svg> so
styling and accessibility on the DialogPrimitive.Close button remain unchanged.
---
Nitpick comments:
In `@web-ui/src/__tests__/components/proof/CaptureGlitchModal.test.tsx`:
- Around line 129-134: The assertion for mockCapture using WORKSPACE and
expect.objectContaining is brittle because it asserts the gates string order;
update the test (around mockCapture, WORKSPACE, expect.objectContaining, and the
description/title/severity checks) to be order-agnostic by either extracting the
description from the actual call and asserting it contains both gate names
(e.g., contains 'unit' and 'sec') regardless of order, or by asserting against a
parsed/explicit requiredGates array instead of the exact "unit, sec" substring;
keep the same objectContaining checks for title and severity but replace the
exact description string check with a check that validates presence of both gate
tokens in any order.
🪄 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: CHILL
Plan: Pro
Run ID: 55ae9b84-8917-490a-9adb-0f43009e04af
📒 Files selected for processing (2)
web-ui/src/__tests__/components/proof/CaptureGlitchModal.test.tsxweb-ui/src/components/proof/CaptureGlitchModal.tsx
- Replace inline SVG close glyph with Cancel01Icon from @hugeicons/react for consistency with repo icon standards - Make gate payload assertion order-agnostic using stringMatching regex to prevent brittle test failures on Set iteration order changes
Follow-up — PR #577Good to see the CodeRabbit items addressed in the second commit: the close button correctly uses From my previous review, three items remain open: 1. Unused
2. Gate order is still click-order, not GATE_LIST order The test was made order-agnostic (good), but the underlying implementation still emits gates in const gateHint = `\n\nRequired gates: ${Array.from(selectedGates).join(', ')}`;Two users selecting the same gates in different sequences produce different prompts. The fix: const orderedGates = GATE_LIST.filter((g) => selectedGates.has(g));
const gateHint = `\n\nRequired gates: ${orderedGates.join(', ')}`;With this, the test could use an exact string rather than a regex alternation, since order would be deterministic. 3. Fallback error test still missing
Items 1 and 2 are the priority. Item 3 is optional. |
Fixes three bugs identified by CodeRabbit on #576 after merge.
Bugs fixed
Medium — Gates silently discarded
selectedGateswas validated (≥1 required) but never included in the API payload.CaptureRequirementRequesthas nogatesfield — obligations are auto-derived by LLM from the description. Fix: append\n\nRequired gates: unit, sec, ...to the description before POSTing, so the LLM uses the selections when deriving obligations.Low — Expiry field was dead code
expiresstate was rendered and collected butCaptureRequirementRequesthas noexpiresfield (that belongs toWaiveRequirementRequest). Fix: removed the field from the form and state entirely. Expiry is set at waiver time.Low — Axios error detail never surfaced
(err as { detail?: string })?.detailalways resolves toundefinedon Axios errors — the detail is aterr.response.data.detail. Fix: correct extraction with fallback to generic message.Also
Refactored from centered
Dialog(max-w-lg) to a right-anchored slide-over using RadixDialogPrimitivedirectly. The issue spec required "full-screen modal or slide-over" and the form height warrants it.Test plan
surfaces backend error detail from axios response on failure— verifies Workspace not found message is shownshows fallback error message when axios error has no detaildoes not render an expiry date fieldSummary by CodeRabbit
Refactor
New Features
Tests