feat(admin): Step3 - inline bond slash UI on dispute finalize popup#78
Conversation
Integrate anti-abuse bond selection into the Shift+F finalize flow instead of a separate full-screen step. Admins pick slash on a Bond button (default no slash), open an overlay submenu with Enter, then confirm pay/refund with a full recap including bond.label(). - ReviewingDisputeForFinalization holds bond + slash_submenu_* state - Remove SelectBondSlash mode; Esc exits finalize (no Exit button) - Emoji action buttons (pay buyer, refund seller) and bond labels - Confirm popup shows outcome and bond choice before execute - Docs: FINALIZE_DISPUTES, ADMIN_DISPUTES, README Follows execute-layer BondSlashChoice wiring (PR #77). Co-authored-by: Cursor <cursoragent@cursor.com>
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ 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)
WalkthroughAdds a bond-slash submenu overlay to the admin dispute finalization UI, enabling selection of ChangesAdmin Dispute Finalization Bond-Slash Submenu
Sequence Diagram(s)sequenceDiagram
participant Admin as Admin User
participant Finalize as Finalization Popup
participant Bond as Bond Submenu
participant Confirm as Confirmation Recap
participant Execute as Execute Layer
Admin->>Finalize: Shift+F on dispute
Finalize->>Finalize: show Pay/Refund/Bond buttons
Admin->>Finalize: Right arrow to Bond button
Admin->>Bond: Enter selects Bond button
Bond->>Bond: show None/SlashSeller/SlashBuyer choices
Admin->>Bond: Up/Down arrow cycles choice
Admin->>Bond: Enter to confirm choice
Bond->>Finalize: Esc or confirm returns to buttons
Admin->>Finalize: Enter on Pay/Refund
Finalize->>Confirm: transition with bond stored
Confirm->>Confirm: show recap with Bond label
Admin->>Execute: Enter Yes on confirm
Execute->>Execute: execute_finalize_dispute_action with bond
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 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.
Inline comments:
In `@docs/FINALIZE_DISPUTES.md`:
- Line 139: The shortcut docs use inconsistent button naming: replace the phrase
"Enter on Bond slash" with the consistent label "Enter on Bond" so the shortcut
text matches the main action label "Bond" used elsewhere; update the line that
currently reads "Enter on Bond slash: Open bond submenu overlay" to "Enter on
Bond: Open bond submenu overlay" and scan for other occurrences of "Bond slash"
to align them with the "Bond" button name.
In `@src/ui/key_handler/enter_handlers.rs`:
- Around line 673-683: The BondSlash branch currently always reopens the slash
submenu (setting slash_submenu_open and slash_submenu_index) and never
transitions to ConfirmFinalizeDispute, causing finalized disputes to be a
dead-end; update the match arm for FinalizeDisputePopupButton::BondSlash so that
when a finalize-confirm path is appropriate (e.g., dispute is already finalized
or the UI should proceed to confirmation) you set app.mode to
UiMode::AdminMode(AdminMode::ConfirmFinalizeDispute { dispute_id,
selected_button_index, bond }) or otherwise create/choose a bond-only
confirmation variant instead of always reopening the slash submenu; keep or
adjust slash_submenu_open and slash_submenu_index (bond.choice_index()) only
when you actually need the submenu, and ensure selected_button_index, dispute_id
and bond are passed into the ConfirmFinalizeDispute (or new bond-only confirm)
state so the flow can proceed to confirmation.
In `@src/ui/key_handler/mod.rs`:
- Around line 253-260: The cycle_bond_slash_choice function currently clamps the
selected_choice_index at the ends; change it to wrap around using the length of
BondSlashChoice::ALL so Up from 0 goes to len-1 and Down from len-1 goes to 0.
Locate cycle_bond_slash_choice and replace the saturating_sub/min logic with
wrap logic using the len (from
crate::util::order_utils::BondSlashChoice::ALL.len()) — compute the new index by
adding/subtracting 1 then applying modulo len (or equivalent conditional wrap)
so repeated Up/Down presses cycle through options.
🪄 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: 4a0c9886-1b00-4742-992f-f89491fe3568
📒 Files selected for processing (16)
README.mddocs/ADMIN_DISPUTES.mddocs/CODING_STANDARDS.mddocs/FINALIZE_DISPUTES.mddocs/README.mdsrc/ui/admin_state.rssrc/ui/dispute_bond_slash_popup.rssrc/ui/dispute_finalization_confirm.rssrc/ui/dispute_finalization_popup.rssrc/ui/draw.rssrc/ui/key_handler/chat_helpers.rssrc/ui/key_handler/enter_handlers.rssrc/ui/key_handler/esc_handlers.rssrc/ui/key_handler/mod.rssrc/ui/mod.rssrc/util/order_utils/bond_resolution.rs
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
There was a problem hiding this comment.
I reviewed this carefully and I do not see a blocker.
The UI flow is coherent now:
- bond choice stays inside the existing finalize popup instead of forcing a separate full-screen mode
- the selected bond action is preserved into the confirm step and back again on
Esc/No - the execution path now actually sends the chosen bond resolution instead of always falling back to the legacy default
I also checked the finalized-dispute path and the action layer still rejects invalid finalize attempts, so this does not weaken the existing guardrails.
The follow-up about gating the bond UI on instance bond_enabled still makes sense, but I do not see that as a blocker for this PR itself.
Summary
Integrates anti-abuse bond slash into the admin Shift+F finalize flow (builds on PR #77 execute-layer wiring):
BondSlashChoiceoptions); default 🔓 no slashadmin-settle/admin-cancelSelectBondSlashfull-screen stepMotivation
Admins choose settle/cancel and bond resolution in one place, with a clear recap before the irreversible confirm step.
Changes
ReviewingDisputeForFinalizationstate:bond,slash_submenu_open,slash_submenu_indexdispute_bond_slash_popup.rsoverlay rendererBondSlashChoice::label()FINALIZE_DISPUTES.md,ADMIN_DISPUTES.md, READMEBreaking changes
None for end users. Internal:
AdminMode::SelectBondSlashremoved; finalize popup button indices unchanged (0–2).Test plan
cargo fmt,cargo clippy --all-targets --all-features,cargo test(109 tests)Follow-up
bond_enabled(kind 38385)Summary by CodeRabbit
Release Notes
New Features
Documentation