[spec] Port MailSweep to Synchronous Rust #44
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Lavisys/mailsweep#44
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Specification: MailSweep Synchronous Rust Port
Problem Statement
The existing Python implementation of MailSweep is a robust zero-dependency toolkit, but executing full scans, multi-language regex matching, and streaming backups across mailboxes with tens of thousands of messages encounters memory overhead and execution limits inherent to interpreted runtimes. Deploying across different operating systems also requires Python runtime management and environment configuration. Users require a single, fast, self-contained native executable with zero startup latency, high-throughput regex classification across 13 European languages, and inviolable safety guarantees.
Solution
Rewrite the MailSweep engine and CLI in synchronous Rust as a single unified native binary. The Rust implementation will maintain 100% domain and heuristic parity with the existing architecture, respecting all domain boundaries in CONTEXT.md and architectural decisions in ADR 0008. It will provide sub-second regex evaluation, reliable streaming backups with SHA-256 validation, incremental JSON scan caching, atomic safety aborts on UIDVALIDITY changes, and non-destructive cleanup semantics.
User Stories
--yesflag to bypass interactive prompts in automated CI or scheduled cron jobs, so that workflows can run unattended.Implementation Decisions
imap+rustls), managing authentication, folder discovery, batch UID fetching, and atomic message relocation.email-encoding,encoding_rs), RFC 3501 Modified UTF-7 folder codec, IMAPBODYSTRUCTUREattachment detection,X-GM-EXT-1label decoding, andList-Unsubscribeparsing.std::sync::LazyLockandregex. Safety Tiers (0 to 5) take absolute precedence over Clutter Tiers..ziparchives with on-the-flySHA-256checksum verification (zip,sha2).clap(derive mode), progress indicators withindicatif, and standardstd::io::stdinconfirmation prompts.thiserrorto enforce strict domain invariants and safety aborts (UIDVALIDITYchanges, backup verification errors, connection drops)..mailsweep_cache/scan_cache.jsonusingserdeandserde_json..envparsing handled viadotenvywith strong validation into aConfigdomain struct.Cargo.toml) with domain modules undersrc/.Testing Decisions
MailboxPipelineand its pure domain sub-seams (Classifier,RFC Codecs,Archive,ScanCache). Tests will exercise high-level domain behaviors rather than internal implementation details..eml), RFC test vectors, and classification test matrices to guarantee 100% behavioral parity with the Python test oracle.cargo fmt --checkcargo clippy --all-targets --all-features -- -D warningsOut of Scope
tokionetwork runtime (the engine is deliberately synchronous to prioritize simplicity, predictable memory, and linear error traces).Further Notes
Synchronous Rust port is complete with 100% test pass rate across all domain modules and CLI commands.