mailsec: add verdict-revision and report-reopen CLI/SDK surfaces - #350
Merged
Conversation
Wire the P3 verdict-revision and report-reopen gateway routes into the
mailsec CLI and SDK:
- message revise: POST messages/{uuid}/verdict — set an analyst verdict
with a required, audited rationale (1..10 lines, <=280 chars each) and
an optional score. mode is fixed to analyst since the CLI operator is a
person; an agent revises with its own key and mode ai via the API.
applied:false is rendered as an honest no-op, not an error.
- message revisions: GET messages/{uuid}/revisions — oldest-first history.
- report reopen: POST reports/{report_id}/reopen — the inverse of resolve.
Rationale bounds are enforced client-side with clear ValueErrors that the
CLI surfaces as clean non-zero exits. Matches the existing group grammar
(positional id argument, gateway stamps the actor, generic --output
rendering). Unit tests cover URL/method/body construction, the analyst
mode default, rationale bounds, and applied:false as a non-error.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
lcbill
approved these changes
Sep 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Wires the P3 verdict-revision and report-reopen mailsec gateway routes (now live on exp) into the
limacharlie mailsecCLI and its SDK, building on the existing coverage/message/campaign/report/action/analyze/connection/onboarding group.New verbs (matching the group's existing noun-verb grammar)
mailsec message revise MSG_UUID --verdict <malicious|suspicious|graymail|benign|unknown> --rationale <text> [--rationale ...] [--score N]→
POST /mailsec/{oid}/messages/{msg_uuid}/verdict(permmailsec.act). Records an analyst verdict.--rationaleis repeatable and required (1..10 lines, each ≤280 chars).modeis fixed toanalystbecause the CLI operator is a human — an autonomous agent revises with its own key andmode: aithrough the API, not this command.applied:falseis rendered as an honest no-op (already the current verdict), not an error.mailsec message revisions MSG_UUID→
GET /mailsec/{oid}/messages/{msg_uuid}/revisions(permmailsec.get). Oldest-first revision history (seq/mode/actor/verdict/decided_at/rationale), rendered via the standard--outputjson/table path.mailsec report reopen REPORT_ID→
POST /mailsec/{oid}/reports/{report_id}/reopen(permmailsec.set). The inverse of the existingreport resolve; added beside it without duplicating resolve.Conventions followed
message get/eml/similar/action,report get/resolve),Client.requestwrapper via theMailsecSDK, gateway stamps the actor (nothing stamped client-side), genericformat_outputrendering,register_explainAI-help entries, and the same explain/help text style.ValueError→ clean non-zero CLI exit) so a caller learns the limit locally rather than from a 400.Tests
Extends the established mock-the-transport pattern (no live API calls): asserts URL/method/body for each verb, the
analystmode default, rationale bounds (empty/blank/too-many/too-long, plus at-limit accepted), and thatapplied:falseexits 0. The SDK route-coverage test is updated 22→25. Full unit + microbenchmark suite green (4003 passed, 5 pre-existing skips).🤖 Generated with Claude Code