Skip to content

feat(admin): expose BondResolution payload on adm-settle / adm-cancel#167

Merged
grunch merged 2 commits into
mainfrom
feat/admin-bond-resolution
May 13, 2026
Merged

feat(admin): expose BondResolution payload on adm-settle / adm-cancel#167
grunch merged 2 commits into
mainfrom
feat/admin-bond-resolution

Conversation

@grunch
Copy link
Copy Markdown
Member

@grunch grunch commented May 13, 2026

Summary

Adds --slash-seller and --slash-buyer flags to the adm-settle and adm-cancel admin subcommands so solvers (and QA) can exercise the anti-abuse-bond Phase 2 flow shipped in the daemon. When either flag is set, the outgoing dispute message now carries Payload::BondResolution { slash_seller, slash_buyer }; with no flags, the payload stays None, preserving Phase 1 behaviour. The selected slash decisions are surfaced as extra rows in the action table so the operator can see what they're about to send.

Spec / context: MostroP2P/mostro#737 (feat/bond-phase-2-slash, daemon §7.2 wire format).

Test plan

  • cargo fmt --all
  • cargo clippy --all-targets --all-features -- -D warnings
  • cargo build
  • cargo test (no regressions; no admin-command tests existed and none added)
  • Smoke-test against a Phase 2 daemon (>= 0.17.3):
    • mostro-cli admsettle --orderid <uuid> → payload null
    • mostro-cli admsettle --orderid <uuid> --slashbuyer{ slash_seller: false, slash_buyer: true }
    • mostro-cli admsettle --orderid <uuid> --slashseller --slashbuyer → both true
    • mostro-cli admcancel --orderid <uuid> --slashseller{ slash_seller: true, slash_buyer: false }
    • Verify rows appear in the daemon bonds table / mostrod logs.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added --slash-seller and --slash-buyer boolean flags to admin settle and cancel dispute commands. These flags enable fine-grained control over bond resolution during dispute closure operations.

Review Change Stack

Add --slash-seller and --slash-buyer flags to the AdmSettle and
AdmCancel subcommands so QA / solvers can exercise the anti-abuse-bond
Phase 2 flow shipped in MostroP2P/mostro#737. When either flag is set,
the dispute message now carries a Payload::BondResolution; with no
flags the payload stays None to preserve Phase 1 behaviour. The slash
decisions are also surfaced in the printed action table.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 13, 2026

Warning

Rate limit exceeded

@grunch has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 52 minutes and 16 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: 453f8dc5-a0fa-4df5-9615-bf02fd5681bb

📥 Commits

Reviewing files that changed from the base of the PR and between 75a0311 and fe69fa8.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (1)
  • Cargo.toml

Walkthrough

This PR extends the admin dispute cancel and settle commands with optional bond slashing flags. Two new boolean CLI arguments (--slash-seller and --slash-buyer) are added to the enum variants, wired through the command dispatcher, and conditionally included in the dispute message payload when set. The output tables are also updated to display slash information.

Changes

Admin Dispute Bond Resolution

Layer / File(s) Summary
CLI flags definition
src/cli.rs
The AdmCancel and AdmSettle enum variants gain slash_seller and slash_buyer boolean fields exposed as CLI flags, both defaulting to false.
Command dispatch wiring
src/cli.rs
The Commands::run dispatcher extracts and passes the new slash flags from the CLI arguments into execute_admin_settle_dispute and execute_admin_cancel_dispute calls.
Cancel dispute execution
src/cli/take_dispute.rs
execute_admin_cancel_dispute accepts the new boolean parameters, conditionally augments the display table with "Slash" bond rows, and includes Payload::BondResolution in the message when either flag is true.
Settle dispute execution
src/cli/take_dispute.rs
execute_admin_settle_dispute accepts the new boolean parameters, conditionally augments the display table with "Slash" bond rows, and includes Payload::BondResolution in the message when either flag is true.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • MostroP2P/mostro-cli#123: Introduces the original admin dispute commands that this PR extends with bond resolution flags.

Poem

🐰 With flags unfurled, the disputes now bend,
Slash-seller, slash-buyer—the quarrels shall end!
From CLI to payload, the logic flows free,
Bond resolution magic for all left to see! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat(admin): expose BondResolution payload on adm-settle / adm-cancel' directly and accurately describes the main change—adding BondResolution payload exposure to the adm-settle and adm-cancel commands.
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-resolution

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.

@grunch grunch merged commit c9331af into main May 13, 2026
5 checks passed
@grunch grunch deleted the feat/admin-bond-resolution branch May 13, 2026 19:07
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