Skip to content

feat(admin): Step 2 - wire BondSlashChoice through dispute finalize execute path#77

Merged
arkanoider merged 2 commits into
mainfrom
feat/admin-bond-slash-execute-layer
May 19, 2026
Merged

feat(admin): Step 2 - wire BondSlashChoice through dispute finalize execute path#77
arkanoider merged 2 commits into
mainfrom
feat/admin-bond-slash-execute-layer

Conversation

@arkanoider
Copy link
Copy Markdown
Collaborator

@arkanoider arkanoider commented May 19, 2026

Summary

Follow-up to #76 (mostro-core 0.11.3 + BondSlashChoice helper). This PR completes step 3 — execute layer for admin dispute bond slash:

  • execute_admin_settle / execute_admin_cancel accept bond: BondSlashChoice and send bond.to_optional_payload() on the wire (Nonepayload: null)
  • execute_finalize_dispute threads bond through to settle/cancel
  • execute_finalize_dispute_action takes bond; UI still passes BondSlashChoice::default() until the slash picker lands
  • BondSlashChoice::log_context() for consistent log/toast phrasing
  • Wire-shape unit tests in settle/cancel modules
  • Docs updated: execute layer Done; TUI slash picker + bond_enabled gating still Pending
  • enter_handlers.rs: imports consolidated at top of file

Motivation

Aligns Mostrix with admin settle / admin cancel and Mostro daemon bond resolution (MostroP2P/mostro#738). Safe default: no slash until the TUI exposes choices.

Breaking changes

None for users. Internal API: execute_admin_settle, execute_admin_cancel, and execute_finalize_dispute now require a bond argument.

Test plan

  • cargo fmt --all
  • cargo clippy --all-targets --all-features
  • cargo test (108 tests)
  • cargo build
  • Manual: admin finalize dispute → verify DM still sends with payload: null (default)
  • Manual (after TUI step): slash options serialize as BondResolution on wire

Follow-up (not in this PR)

  • TUI SelectBondSlash step + confirm summary
  • Parse bond_enabled from kind 38385; skip slash UI when off
  • Optional: AddBondInvoice / BondPayoutRequest for payout recipients

Summary by CodeRabbit

  • New Features

    • Added support for optional bond slashing during admin dispute finalization, enabling anti-abuse measures with choices for no slash, slash buyer, slash seller, or slash both bonds.
  • Documentation

    • Updated guides to describe the bond slash workflow, execution layer integration, and implementation status.
    • Bond slash picker UI and instance gating remain pending.

Review Change Stack

Thread bond slash choice from the TUI action through execute_finalize_dispute
into admin settle/cancel with to_optional_payload() on the wire. Add log_context,
module tests, and docs marking the execute layer done (TUI picker still pending).

Co-authored-by: Cursor <cursoragent@cursor.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 19, 2026

Warning

Rate limit exceeded

@arkanoider has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 41 minutes and 26 seconds before requesting another review.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4e61b39d-43ed-4d15-a492-ee0bd4c4fb7d

📥 Commits

Reviewing files that changed from the base of the PR and between d9a712f and f4987c4.

📒 Files selected for processing (1)
  • docs/FINALIZE_DISPUTES.md

Walkthrough

This PR threads BondSlashChoice parameter through the admin dispute finalization pipeline, from UI dispatch through core execution layer, enabling bond-resolution wire payloads and contextual logging. Includes updated documentation describing the new behavior and current limitations (slash picker UI and bond_enabled gating pending).

Changes

Bond slash choice in dispute finalization

Layer / File(s) Summary
Core execution layer wiring with bond slash payloads
src/util/order_utils/bond_resolution.rs, src/util/order_utils/execute_finalize_dispute.rs, src/util/order_utils/execute_admin_settle.rs, src/util/order_utils/execute_admin_cancel.rs
execute_finalize_dispute, execute_admin_settle, and execute_admin_cancel now accept BondSlashChoice and construct dispute message payloads via bond.to_optional_payload(). BondSlashChoice::log_context() provides human-readable bond-slash descriptions for logging. Bond is threaded from settle/cancel functions into wire message construction and logged in success messages.
UI handler dispatch for bond slash choice
src/ui/key_handler/admin_handlers.rs, src/ui/key_handler/enter_handlers.rs
execute_finalize_dispute_action signature updated to accept bond: BondSlashChoice and pass it through to execute_finalize_dispute. Success notifications include bond logging context. enter_handlers.rs consolidates imports and calls the handler with BondSlashChoice::default() pending a planned bond-picker UI.
Documentation updates for bond slash finalization
README.md, docs/ADMIN_DISPUTES.md, docs/CODING_STANDARDS.md, docs/FINALIZE_DISPUTES.md, docs/MESSAGE_FLOW_AND_PROTOCOL.md, docs/README.md
All documentation revised to describe the bond slash choice threading, wire payload construction via bond.to_optional_payload(), current UI behavior (defaults to no slash until picker lands), and planned bond_enabled instance gating.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • MostroP2P/mostrix#76: Main PR extends the BondSlashChoice foundation from PR #76 by adding log_context() and threading the bond parameter through finalization execution.

Suggested reviewers

  • grunch
  • mostronatorcoder
  • Catrya

Poem

🐰 A rabbit hops through dispute lanes,
Where bonds are slashed and choices reign,
Threading context, payload clear,
From handler down, the path is shear—
No slash today, but logging smear!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat(admin): Step 2 - wire BondSlashChoice through dispute finalize execute path' is specific, concise, and clearly describes the main objective of threading the BondSlashChoice parameter through the dispute finalization execute layer, which aligns with the primary changes across multiple execute functions and handlers.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/admin-bond-slash-execute-layer

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 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 39: The "Current UI" note in FINALIZE_DISPUTES.md references the wrong
step numbers ("until step 4–5 land") which conflicts with the planned
bond/confirm flow listed as steps 8–9; update that phrase to reference the
correct step numbers (e.g., "until steps 8–9 land") so the note aligns with the
bond/confirm flow described above and avoid rollout-state confusion.
🪄 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: 35166b57-e9e7-4017-b125-687f755bf2ed

📥 Commits

Reviewing files that changed from the base of the PR and between 87bab10 and d9a712f.

📒 Files selected for processing (12)
  • README.md
  • docs/ADMIN_DISPUTES.md
  • docs/CODING_STANDARDS.md
  • docs/FINALIZE_DISPUTES.md
  • docs/MESSAGE_FLOW_AND_PROTOCOL.md
  • docs/README.md
  • src/ui/key_handler/admin_handlers.rs
  • src/ui/key_handler/enter_handlers.rs
  • src/util/order_utils/bond_resolution.rs
  • src/util/order_utils/execute_admin_cancel.rs
  • src/util/order_utils/execute_admin_settle.rs
  • src/util/order_utils/execute_finalize_dispute.rs

Comment thread docs/FINALIZE_DISPUTES.md Outdated
@arkanoider
Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 19, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@arkanoider arkanoider merged commit d256204 into main May 19, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant