Skip to content

Require evidence for ban, tempban, and kick moderation actions#188

Merged
0xRy4n merged 3 commits into
mainfrom
refactor/mandate-evidence
Jun 15, 2026
Merged

Require evidence for ban, tempban, and kick moderation actions#188
0xRy4n merged 3 commits into
mainfrom
refactor/mandate-evidence

Conversation

@ToxicBiohazard

@ToxicBiohazard ToxicBiohazard commented Jun 11, 2026

Copy link
Copy Markdown
Member

Types of changes

What types of changes does your code introduce?
Put an x in the boxes that apply.

  • Bugfix (non-breaking change which fixes an issue).
  • New feature (non-breaking change which adds functionality).
  • Breaking change (fix or feature that would cause existing functionality not to work as expected).
  • Documentation Update (if none of the other choices applies).

Proposed changes

Moderation actions now require non-empty evidence across Discord commands and platform ban webhooks.

  • Make evidence a required parameter on /ban, /tempban, and /kick
  • Add shared validate_evidence() validation and reject blank or whitespace-only values
  • Remove the "none provided" fallback when banning through the helper layer
  • Require non-empty notes for platform account_banned webhook events (HTTP 400 when missing)
  • Add unit tests for missing/blank evidence in commands, helpers, and webhook handlers

This ensures every ban or kick is backed by documented evidence for moderation review and audit trails.

Checklist

Put an x in the boxes that apply.

  • I have read and followed the CONTRIBUTING.md
    doc.
  • Lint and unit tests pass locally with my changes.
  • I have added the necessary documentation (if appropriate).

Additional context

Platform integrations sending account_banned events must include a non-empty notes field. Moderators using slash commands must provide evidence when issuing bans or kicks.

… validate evidence input and handle missing evidence cases. Adjusted related tests to ensure proper functionality and error handling.
@codecov

codecov Bot commented Jun 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.36%. Comparing base (52a14f7) to head (669f116).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #188      +/-   ##
==========================================
+ Coverage   65.18%   65.36%   +0.18%     
==========================================
  Files          52       52              
  Lines        3056     3069      +13     
==========================================
+ Hits         1992     2006      +14     
+ Misses       1064     1063       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR enforces that moderation actions (ban/tempban/kick and platform account_banned webhook bans) include non-empty evidence/notes to support auditability and moderation review.

Changes:

  • Makes evidence a required slash-command argument for /ban, /tempban, and /kick, and validates blank/whitespace-only evidence.
  • Adds webhook-side validation requiring non-empty notes for ACCOUNT_BANNED events and uses those notes as ban evidence.
  • Adds/updates unit tests covering missing/blank evidence/notes across commands, helpers, and webhook handlers.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/src/webhooks/handlers/test_base.py Adds unit tests for new non-empty string validation helper.
tests/src/webhooks/handlers/test_account.py Adds coverage that ACCOUNT_BANNED rejects missing notes.
tests/src/helpers/test_ban.py Adds coverage for rejecting blank evidence in ban helper logic.
tests/src/cmds/core/test_user.py Updates kick tests for required evidence and adds blank-evidence rejection test.
src/webhooks/handlers/base.py Introduces validate_non_empty_string() for webhook payload validation.
src/webhooks/handlers/account.py Requires non-empty notes for account bans and passes notes as evidence.
src/helpers/ban.py Adds shared validate_evidence() and removes fallback evidence behavior.
src/cmds/core/user.py Makes kick evidence required and validates evidence before kicking.
src/cmds/core/ban.py Makes ban/tempban evidence required in command signatures.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/helpers/ban.py Outdated
Comment thread src/webhooks/handlers/base.py Outdated
0xRy4n and others added 2 commits June 15, 2026 11:07
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@0xRy4n 0xRy4n self-requested a review June 15, 2026 10:10

@0xRy4n 0xRy4n left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@0xRy4n 0xRy4n merged commit b9b84c3 into main Jun 15, 2026
4 checks passed
@0xRy4n 0xRy4n deleted the refactor/mandate-evidence branch June 15, 2026 10:11
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.

3 participants