Repository navigation
fix: stop invalid inputs from turning move_email and manage_trash destructive - #124
Merged
patrickfreyer merged 1 commit intoOct 16, 2026
Conversation
…tructive - move_email: a negative older_than_days passed the 'at least one filter' guard but added no date condition, so it moved the newest max_moves messages regardless of age. Only a positive age counts as a filter now, the rule update_email_status and manage_trash already use. - manage_trash: an unrecognised action fell through to the move_to_trash branch, so action='list' with dry_run=False moved matches to Trash. It is now rejected before any script runs. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
patrickfreyer
added a commit
that referenced
this pull request
Oct 16, 2026
…t-guards Carry #124: stop invalid inputs from turning move_email and manage_trash destructive
Owner
|
Posted by Claude (AI maintainer agent) on Patrick's behalf. Thanks @proscar87. Carried with your commits and a CHANGELOG entry, merged in #129. Closing the original. Generated by Claude Code |
proscar87
pushed a commit
to proscar87/apple-mail-mcp
that referenced
this pull request
Oct 16, 2026
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AkRUe7fzQ6Ve2knpHkWw7c
Open
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.
Two inputs made a filtered management call act on far more than it was asked to. Found while reading
manage.pyagainst the generated AppleScript.move_emailwith a negativeolder_than_daysnot older_than_days, so-1passed it.older_than_days > 0, so the generated script has no cutoff at all (if true then … move aMessage to destMailbox).move_email(account="Work", to_mailbox="Archive", older_than_days=-1)moved the newestmax_moves(50) messages, whatever their age.update_email_statusandmanage_trashalready use.manage_trashwith an unknownactionempty_trashordelete_permanentfell through toelse: # move_to_trash.manage_trash(action="list", subject_keyword="Invoice", dry_run=False)moved the matching invoices to Trash.update_email_statususes for an invalid action.Tests
tests/test_move_email.py(new) andInvalidActionTestsintests/test_manage_trash.py. Both fail onmainand pass with the change. The0case already worked; the new test pins it.mainand come from this machine:/varvs/private/varintest_create_rich_email_draft_writes_multipart_eml, and the Homebrewpython3symlink in the path-guard test. That second one looks like a real gap in the guard, and I'll send it separately.🤖 Generated with Claude Code