From 9af7dbe1c87d6d0b64fc651350c12b4a036b7f5a Mon Sep 17 00:00:00 2001 From: Mykhailo Chalyi Date: Wed, 25 Nov 2026 23:48:02 -0600 Subject: [PATCH] fix(email): expose body cleanup without MIME parsing --- .github/workflows/ci.yml | 26 ++++++++++++++++++++++++-- CHANGELOG.md | 6 ++++++ Cargo.lock | 14 +++++++------- Cargo.toml | 2 +- README.md | 3 ++- crates/markkit-cli/Cargo.toml | 2 +- crates/markkit-js/package.json | 2 +- crates/markkit-wasm/package.json | 2 +- crates/markkit/Cargo.toml | 6 ++++-- crates/markkit/fuzz/Cargo.lock | 2 +- crates/markkit/src/email.rs | 2 +- crates/markkit/src/lib.rs | 2 +- knowledge/formats/format-support.md | 4 +++- knowledge/log.md | 4 ++++ knowledge/operations/testing.md | 4 ++++ 15 files changed, 61 insertions(+), 20 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d3c6157..f36b640 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -108,6 +108,27 @@ jobs: - name: Run examples run: bash scripts/run-examples.sh + email-body: + name: Email body compatibility + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + with: + persist-credentials: false + - uses: dtolnay/rust-toolchain@1.96.0 + - uses: Swatinem/rust-cache@v2 + with: + key: email-body-rust-1.96 + - name: Test decoded bodies without a MIME parser + run: | + cargo test --locked -p markkit --no-default-features --features email-body --lib email:: + cargo test --locked -p markkit --no-default-features --features email-body,html --lib email:: + cargo run --locked -p markkit --no-default-features --features email-body --example email_body + if cargo tree --locked -p markkit --no-default-features --features email-body,html -e normal | grep -E 'mail-parser|reqwest|hyper'; then + echo "MIME parser or HTTP client leaked into decoded email body views" + exit 1 + fi + wasm: # Browser package @everruns/markkit-wasm: build the wasm32-unknown-unknown # bundle and run its headless Node tests. See knowledge/runtimes/wasm-package.md. @@ -143,7 +164,7 @@ jobs: check: name: Check - needs: [lint, audit, test, wasm] + needs: [lint, audit, test, wasm, email-body] runs-on: ubuntu-latest if: always() steps: @@ -152,7 +173,8 @@ jobs: if [[ "${{ needs.lint.result }}" != "success" ]] || \ [[ "${{ needs.audit.result }}" != "success" ]] || \ [[ "${{ needs.test.result }}" != "success" ]] || \ - [[ "${{ needs.wasm.result }}" != "success" ]]; then + [[ "${{ needs.wasm.result }}" != "success" ]] || \ + [[ "${{ needs['email-body'].result }}" != "success" ]]; then echo "One or more jobs failed" exit 1 fi diff --git a/CHANGELOG.md b/CHANGELOG.md index a631708..5460197 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/). ## [Unreleased] +## [0.3.3] - 2026-11-25 + +### Fixed + +- Expose decoded email cleanup through `email-body` without requiring the MIME parser or Rust 1.98. The existing `email` feature still includes both APIs. + ## [0.3.2] - 2026-11-25 ### Security diff --git a/Cargo.lock b/Cargo.lock index 90884ff..779bcd7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1499,7 +1499,7 @@ dependencies = [ [[package]] name = "markkit" -version = "0.3.2" +version = "0.3.3" dependencies = [ "anyhow", "base64", @@ -1534,7 +1534,7 @@ dependencies = [ [[package]] name = "markkit-bench" -version = "0.3.2" +version = "0.3.3" dependencies = [ "anyhow", "clap", @@ -1547,7 +1547,7 @@ dependencies = [ [[package]] name = "markkit-cli" -version = "0.3.2" +version = "0.3.3" dependencies = [ "anyhow", "clap", @@ -1559,7 +1559,7 @@ dependencies = [ [[package]] name = "markkit-eval" -version = "0.3.2" +version = "0.3.3" dependencies = [ "markkit", "mira-eval", @@ -1571,7 +1571,7 @@ dependencies = [ [[package]] name = "markkit-js" -version = "0.3.2" +version = "0.3.3" dependencies = [ "markkit", "napi", @@ -1581,7 +1581,7 @@ dependencies = [ [[package]] name = "markkit-python" -version = "0.3.2" +version = "0.3.3" dependencies = [ "markkit", "pyo3", @@ -1591,7 +1591,7 @@ dependencies = [ [[package]] name = "markkit-wasm" -version = "0.3.2" +version = "0.3.3" dependencies = [ "js-sys", "markkit", diff --git a/Cargo.toml b/Cargo.toml index bc28f28..0ed0efe 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,7 @@ members = [ ] [workspace.package] -version = "0.3.2" +version = "0.3.3" edition = "2024" license = "MIT" authors = ["Everruns "] diff --git a/README.md b/README.md index 4a0efdf..589bad6 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,7 @@ text, without URL fetching or OCR. Rust callers with already-decoded email alternatives can use [`email::extract_body`](https://docs.rs/markkit/latest/markkit/email/fn.extract_body.html) -with the `email` feature. It returns clean/full views and byte spans for omitted +with the `email-body` feature (also included by `email`). It returns clean/full views and byte spans for omitted trailing quotes or mobile signatures, preserving forwarded and interleaved replies. Text stays plain text; HTML fallback requires `html` and becomes Markdown. Treat both views as untrusted content. See the runnable [email example](examples/email_body.rs). @@ -249,6 +249,7 @@ in the message). | Feature | Default | Description | |---------|---------|-------------| | `html` | Yes | HTML parsing and conversion | +| `email-body` | No | Clean/full views of decoded email bodies, without a MIME parser; add `html` for HTML alternatives | | `pdf`, `docx`, `pptx`, `spreadsheet`, `odt`, `epub`, `email`, `markdown` | No | Format support, see [Supported formats](#supported-formats) | | `all_formats` | No | All of the above | | `pdf-ocr` | No | OCR for textless PDF pages: Hayro rendering + installed Tesseract | diff --git a/crates/markkit-cli/Cargo.toml b/crates/markkit-cli/Cargo.toml index 4df1333..72d4866 100644 --- a/crates/markkit-cli/Cargo.toml +++ b/crates/markkit-cli/Cargo.toml @@ -40,7 +40,7 @@ odt = ["markkit/odt"] epub = ["markkit/epub"] [dependencies] -markkit = { path = "../markkit", version = "0.3.2", features = ["tool"] } +markkit = { path = "../markkit", version = "0.3.3", features = ["tool"] } tokio = { workspace = true, features = ["macros", "rt", "rt-multi-thread", "io-std", "io-util"] } clap.workspace = true anyhow.workspace = true diff --git a/crates/markkit-js/package.json b/crates/markkit-js/package.json index b780bdc..a7517f9 100644 --- a/crates/markkit-js/package.json +++ b/crates/markkit-js/package.json @@ -1,6 +1,6 @@ { "name": "@everruns/markkit", - "version": "0.3.2", + "version": "0.3.3", "description": "Extract clean markdown from any format – Node.js bindings", "main": "index.js", "types": "index.d.ts", diff --git a/crates/markkit-wasm/package.json b/crates/markkit-wasm/package.json index de6db6d..3fa6556 100644 --- a/crates/markkit-wasm/package.json +++ b/crates/markkit-wasm/package.json @@ -1,6 +1,6 @@ { "name": "@everruns/markkit-wasm", - "version": "0.3.2", + "version": "0.3.3", "description": "Extract clean Markdown from HTML, DOCX and spreadsheets in the browser and edge runtimes (WebAssembly). Includes an LLM agent tool.", "type": "module", "main": "index.js", diff --git a/crates/markkit/Cargo.toml b/crates/markkit/Cargo.toml index f8f52db..d950896 100644 --- a/crates/markkit/Cargo.toml +++ b/crates/markkit/Cargo.toml @@ -34,7 +34,9 @@ docx = ["dep:zip", "dep:quick-xml"] pptx = ["dep:zip", "dep:quick-xml"] spreadsheet = ["dep:calamine", "dep:zip", "dep:quick-xml", "dep:cfb"] markdown = ["dep:pulldown-cmark"] -email = ["dep:mail-parser"] +# Decoded provider bodies need neither MIME parsing nor its toolchain requirements. +email-body = [] +email = ["email-body", "dep:mail-parser"] odt = ["dep:zip", "dep:quick-xml"] epub = ["html", "dep:zip", "dep:quick-xml"] # Opt-in: the default build has no network stack (no reqwest/hyper/TLS). @@ -168,4 +170,4 @@ harness = false [[example]] name = "email_body" path = "../../examples/email_body.rs" -required-features = ["email"] +required-features = ["email-body"] diff --git a/crates/markkit/fuzz/Cargo.lock b/crates/markkit/fuzz/Cargo.lock index f3716a6..4547e94 100644 --- a/crates/markkit/fuzz/Cargo.lock +++ b/crates/markkit/fuzz/Cargo.lock @@ -573,7 +573,7 @@ checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6" [[package]] name = "markkit" -version = "0.3.2" +version = "0.3.3" dependencies = [ "calamine", "cfb 0.16.0", diff --git a/crates/markkit/src/email.rs b/crates/markkit/src/email.rs index 142131a..a5de900 100644 --- a/crates/markkit/src/email.rs +++ b/crates/markkit/src/email.rs @@ -4,7 +4,7 @@ //! trailing quoted block is hidden; inline replies and forwarded mail remain //! whole. Hosts retain MIME originals and enforce their own access policy. //! -//! With the `email` feature enabled: +//! With the `email-body` feature enabled (`email` also includes it): //! ``` //! use markkit::{email::{extract_body, EmailBody}, Limits}; //! let view = extract_body(EmailBody { diff --git a/crates/markkit/src/lib.rs b/crates/markkit/src/lib.rs index b3cbfa2..e368478 100644 --- a/crates/markkit/src/lib.rs +++ b/crates/markkit/src/lib.rs @@ -163,7 +163,7 @@ pub mod config; mod csv; #[cfg(feature = "docx")] mod docx; -#[cfg(feature = "email")] +#[cfg(feature = "email-body")] pub mod email; #[cfg(feature = "email")] mod eml; diff --git a/knowledge/formats/format-support.md b/knowledge/formats/format-support.md index 6c3dc3f..8c761a9 100644 --- a/knowledge/formats/format-support.md +++ b/knowledge/formats/format-support.md @@ -469,7 +469,9 @@ decoded in the pre-scan, and separately the total content interpreted, form reus ## Decoded email body views The Rust `email::extract_body` API accepts provider-decoded text and HTML without -requiring callers to synthesize MIME. It prefers text, otherwise extracts HTML +requiring callers to synthesize MIME. The `email-body` feature exposes this API +without a MIME dependency; the existing `email` feature includes it alongside +EML parsing. A Rust 1.96 consumer gate covers body-only and HTML alternatives. It prefers text, otherwise extracts HTML without remote image loading. It returns both a full normalized representation and a clean view with omission spans. Only conservative trailing quotes and exact mobile signatures are removed; forwarded and interleaved content is retained. diff --git a/knowledge/log.md b/knowledge/log.md index 4b6e1f5..4472242 100644 --- a/knowledge/log.md +++ b/knowledge/log.md @@ -1,5 +1,9 @@ # Markkit Knowledge Update Log +## 2026-11-26 + +- Split decoded email body views into `email-body`, preserving `email` as the full EML feature; add a Rust 1.96 compatibility and dependency-isolation gate. + ## 2026-11-25 - [Release Process](operations/release-process.md): prepare v0.3.2 across Rust, Python, native npm and WASM; includes reviewed dependency migrations, output-safety fixes, email body views, documentation and licensing updates. Publication remains verified separately on the release tag. diff --git a/knowledge/operations/testing.md b/knowledge/operations/testing.md index 68ecd33..5d58357 100644 --- a/knowledge/operations/testing.md +++ b/knowledge/operations/testing.md @@ -58,6 +58,10 @@ each security test states exactly which bytes it feeds the parser. - **Eval**: `just eval` scores extraction quality (mira study, not a gate); its unit tests run in `cargo test`. See [Evaluation Harness](eval.md) +The independent Email body compatibility job builds and tests `email-body` on +Rust 1.96, both with and without HTML, and rejects a MIME parser or HTTP client +in its normal dependency graph. Full `email` still exercises the EML suite. + ## Rules - Write the failing test first, then fix