1 ADR 0009 retire python baseline and complete rust cutover
MailSweep Doc Bot edited this page 2026-08-30 16:44:17 +00:00

9. Retire Python Baseline and Complete Rust Cutover

Date: 2026-08-30

Status

Accepted

Context

Following the implementation of ADR-0008, MailSweep was ported to a high-performance synchronous Rust crate architecture.

During the migration phase, the legacy Python implementation (src/mailsweep/, test_mailsweep.py, scripts/forgejo.py, and pyproject.toml) was retained alongside the Rust codebase as an oracle and golden parity verification suite.

With 100% parity verified across all 66 Rust integration and unit tests (covering 13-language categorization heuristics, RFC MIME codecs, IMAP gateway, transactional attachment inspection, backup archives with SHA-256 verification, safety auditor, and Forgejo issue tracker tooling), the Python baseline has completed its migration lifecycle.

Retaining Python sources introduces unnecessary maintenance overhead, dual-stack dependency noise (uv.lock, pyproject.toml, __pycache__), and documentation ambiguity.

Decision

We have retired all Python code and standardized the repository entirely on native Rust:

  1. Source Code Cleanup:

    • Removed src/mailsweep/ directory and all Python domain modules.
    • Removed legacy test runner test_mailsweep.py.
    • Removed scripts/forgejo.py in favor of the compiled Rust binary src/bin/forgejo.rs.
  2. Packaging and Dependency Cleanup:

    • Removed Python packaging configurations (pyproject.toml, uv.lock).
    • Cleaned up Python caches and virtual environment artifacts.
  3. Documentation & Tooling Standardization:

    • Updated documentation, CLI references, and examples to use cargo run -- or the compiled mailsweep binary.
    • Replaced docs/python-api.md with docs/rust-api.md documenting the native Rust crate interface.
    • Updated Wiki synchronization workflow (.forgejo/workflows/wiki-sync.yaml) and documentation index.

Consequences

  • Delivers a pure, single-language Rust repository with zero external runtime or Python dependencies.
  • Eliminates dual-maintenance overhead and simplifies the build, test, and CI lifecycle to standard cargo workflows.
  • Retains full backward-compatible JSON schema interoperability for scan summaries, cleanup plans, and rulesets.
  • Preserves all 13-language classification heuristics, safety tier hierarchies, and backup guarantees.