[CSM Portal] gate case reassign while work is in-progress + ongoing - #1039
Conversation
The backend rejects an assignee change on a case that is Work in progress with an ongoing work-state: it silently reverts the change and still returns success, so the portal would show "Case reassigned" while the assignee stays put. Disable the "Assign / reassign engineer" overflow action under those conditions and add a tooltip explaining that the work must be paused first (by the current assignee) or the reassignment handled by a lead. This mirrors the existing state-based enablement of the pause/resume action; it is a case-state gate, not a data-source gate. A backend change to surface the rejection as a real error is tracked separately.
📝 WalkthroughWalkthroughThis PR adds a gating condition to the "Assign / Reassign engineer" overflow menu item in CaseActionBar, disabling it when a case is work_in_progress with ongoing workState, and introduces a tooltip mechanism to explain the disabled state. Corresponding tests verify the enabled/disabled behavior across state combinations. ChangesReassign Engineer Gating
Estimated code review effort: 2 (Simple) | ~12 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
|
@coderabbitai resume |
✅ Action performedReviews resumed. |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
apps/csm-portal/webapp/src/features/csm-cases/components/CaseActionBar.test.tsx (1)
230-247: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winConsider asserting the tooltip message itself is shown, not just the disabled state.
The three new tests validate
aria-disabledand click-blocking, but none confirm the tooltip text actually renders for the blocked case — the explanatory tooltip is the feature this PR is adding on top of the gate.✅ Example addition to the first test
const item = openReassignItem(); expect(item).toHaveAttribute("aria-disabled", "true"); + fireEvent.mouseOver(item); + expect( + await screen.findByText(/pause the work first/i), + ).toBeInTheDocument(); fireEvent.click(item); expect(onAction).not.toHaveBeenCalled();🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/csm-portal/webapp/src/features/csm-cases/components/CaseActionBar.test.tsx` around lines 230 - 247, The new reassign gate test only checks aria-disabled and click blocking, but it does not verify the tooltip that explains the restriction. Update the CaseActionBar test around openReassignItem to also assert the tooltip text is rendered/shown for the Work in progress + Ongoing case, so the new explanatory UI is covered in addition to the disabled state.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In
`@apps/csm-portal/webapp/src/features/csm-cases/components/CaseActionBar.test.tsx`:
- Around line 230-247: The new reassign gate test only checks aria-disabled and
click blocking, but it does not verify the tooltip that explains the
restriction. Update the CaseActionBar test around openReassignItem to also
assert the tooltip text is rendered/shown for the Work in progress + Ongoing
case, so the new explanatory UI is covered in addition to the disabled state.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 16528b38-6197-40d7-8e84-aff888e68d7a
📒 Files selected for processing (2)
apps/csm-portal/webapp/src/features/csm-cases/components/CaseActionBar.test.tsxapps/csm-portal/webapp/src/features/csm-cases/components/CaseActionBar.tsx
What
Disable the Assign / reassign engineer overflow action on the case detail page when the case is Work in progress with an ongoing work-state, and add a tooltip explaining why.
Why
The backend rejects an assignee change on a WIP + ongoing case: it silently reverts the change and still returns
200success. The portal therefore showed a "Case reassigned" success toast while the assignee never actually changed — a confusing false success.Rather than fire a request we know will no-op, we gate the action in the UI. The tooltip tells the user to pause the work first (via the existing Pause action, available to the current assignee) or have a lead handle the reassignment.
Notes
Testing
pnpm test— added 3 cases toCaseActionBar.test.tsx(disabled when WIP+ongoing and no dispatch on click; enabled when paused; enabled for non-WIP states). Full file passes (11/11).pnpm build— passes.pnpm lint— the changed file is clean (the 2 remaining repo lint errors are pre-existing onv2in unrelated files).Summary by CodeRabbit