Skip to content

feat(error): add CantDoReason::InvalidPayload#145

Merged
grunch merged 1 commit into
mainfrom
feat/error-invalid-payload
May 13, 2026
Merged

feat(error): add CantDoReason::InvalidPayload#145
grunch merged 1 commit into
mainfrom
feat/error-invalid-payload

Conversation

@grunch
Copy link
Copy Markdown
Member

@grunch grunch commented May 13, 2026

Consumed by mostro's Phase 2 anti-abuse-bond admin handlers, per docs/ANTI_ABUSE_BOND.md §7.3 / §7.5.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added improved error handling for invalid or unprocessable request payloads, providing clearer feedback when payload structures are mismatched or cannot be processed as expected.

Review Change Stack

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

coderabbitai Bot commented May 13, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: cd01279f-9f9c-4455-8396-335ce1380686

📥 Commits

Reviewing files that changed from the base of the PR and between 75b4523 and 14096f7.

📒 Files selected for processing (1)
  • src/error.rs

Walkthrough

This PR adds a new InvalidPayload variant to the CantDoReason error enum in src/error.rs. The variant describes mismatched or unprocessable request payloads. A unit test verifies that the variant correctly serializes to "invalid_payload" in JSON and deserializes back to the same enum value.

Changes

CantDoReason Error Enum Extension

Layer / File(s) Summary
InvalidPayload variant and serialization test
src/error.rs
CantDoReason::InvalidPayload is added with documentation for invalid or unprocessable request payloads, and a unit test confirms JSON serialization round-trips using snake_case naming.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

  • MostroP2P/mostro-core#118: Both PRs extend the CantDoReason enum with new variants and affect the error taxonomy at the API level.
  • MostroP2P/mostro-core#76: Both PRs add variants to CantDoReason and update serialization tests for the error enum.

Suggested reviewers

  • Catrya

Poem

A payload arrives, twisted and strange,
InvalidPayload's here to rearrange,
With snake_case precision and tests that ring true,
The error enum grows—another path through! 🐰✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.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 accurately describes the main change: adding a new enum variant InvalidPayload to the CantDoReason error type. It is concise, specific, and clearly communicates the primary change to the changeset.
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/error-invalid-payload

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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 af01755 into main May 13, 2026
11 checks passed
@grunch grunch deleted the feat/error-invalid-payload branch May 13, 2026 12:43
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