Skip to content

Add bounded UIDONLY session APIs - #2

Draft
gabeosx wants to merge 6 commits into
rustmailer:mainfrom
gabeosx:codex/rustmailer-uidonly
Draft

Add bounded UIDONLY session APIs#2
gabeosx wants to merge 6 commits into
rustmailer:mainfrom
gabeosx:codex/rustmailer-uidonly

Conversation

@gabeosx

@gabeosx gabeosx commented Jul 29, 2026

Copy link
Copy Markdown

Summary

Add an opt-in, bounded async-imap API for servers that support UIDONLY,
PARTIAL, and MESSAGELIMIT:

  • require exact ENABLE UIDONLY confirmation before entering UIDONLY mode;
  • return UIDFETCH results whose leading identifier is always a UID;
  • expose ascending and descending PARTIAL ranges for bounded metadata and body
    fetches;
  • deliver typed UIDONLY VANISHED events;
  • expose MESSAGELIMIT completion instead of silently truncating results;
  • enforce caller-configured response and literal ceilings before allocation;
    and
  • drain semantic errors through the tagged completion, or poison the session
    when it is unsafe to reuse.

Ordinary FETCH and UID FETCH behavior remains unchanged unless UIDONLY has been
explicitly enabled.

Why

This is the client-library step for rustmailer/bichon#333. Bichon needs a
bounded, typed UIDONLY boundary so it can inventory a fixed UID snapshot,
resume safely, and avoid treating UIDs as mutable message sequence numbers.

Dependencies

Until the parser PR is accepted, Cargo.toml pins its exact feature commit,
05439a90033d67297892c3fe206b8c4285df3821, from gabeosx/tokio-imap.
Before this PR merges, that temporary source should be replaced with the
accepted Rustmailer commit or release.

Because this branch is based on #1, GitHub will temporarily show the fork-sync
commits here as well and may report a conflict against the current stale
main. Merge #1 first; this branch is mergeable on that synchronized history.
The UIDONLY API is the single feature commit
905a005234f89d046c2f439cee27daf947917b41.

Verification

  • cargo fmt --all -- --check
  • async-std: 88 passed
  • async-std with compression: 89 passed
  • Tokio: 89 passed
  • Tokio with compression: 90 passed
  • cargo clippy --all -- -D warnings

The focused coverage includes UIDONLY enable confirmation, UIDFETCH/PARTIAL
formatting, VANISHED routing, MESSAGELIMIT completion, malformed responses,
literal/response ceilings, session draining/poisoning, compression handoff,
and ordinary FETCH compatibility.

The Bichon integration using this API is rustmailer/bichon#334.

link2xt and others added 6 commits July 17, 2026 15:40
1.85.0 is the version that introduced Rust 2024 edition.
1.88.0 is needed for stable if-chains (<rust-lang/rust#53667>),
otherwise clippy suggests them but they cannot be used.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants