Add import --estimate: preview counts, sizes and a rough time before committing #67

Merged
jcoffey-dev merged 1 commits from feat/import-estimate into main 2026-11-12 16:42:21 +00:00
Owner

Operators hit one question before any migration: how big is this, and how long will it take? --estimate answers it without committing.

inbuxa-migrate import <source> … --estimate connects to the source, reports how much is new to fetch since the archive was last filled — counts, bytes and a rough time — and writes nothing (it implies --dry-run).

Estimate (no writes):
  mailbox: 2 new
  email: 24,318 new, 4.2 GB
  ----
  total: 24,320 new, 4.2 GB
  rough time: 20–81 min (first run, no measured rate yet)

How it works. It reuses each source's existing dry-run delta enumeration (new vs already in the archive — so a re-estimate against a filled archive correctly shows only what arrived since) and adds a size pass that asks the source only for sizes, never bodies: over IMAP a UID FETCH … RFC822.SIZE, on a Maildir the file lengths.

Scope (v1). IMAP and Maildir report sizes today — that is ~all the volume in a real mail migration. Other sources fall back to a plain dry-run with a note (--estimate isn't available for this source yet); adding each is small per-source follow-up work (Takeout needs message-level counting; CalDAV/CardDAV have getcontentlength in the PROPFIND; EWS has item sizes in enumeration). Measured-throughput time (vs the conservative default rate) is a noted follow-up too.

Design calls (agreed): a --estimate flag on import, not a standalone verb (which would duplicate the 8-source arg tree); v1 ships a clearly-labeled rough time range.

Code. TypeCounts gains a bytes field; sync::estimate renders the report; a want_sizes flag threads into the IMAP and Maildir dry-run summaries. README + unit tests (byte formatting, time range, report rendering); smoke-tested end to end against a Maildir, including the delta path. cargo test --locked (the CI gate), fmt and clippy -D warnings all pass.

Operators hit one question before any migration: how big is this, and how long will it take? `--estimate` answers it without committing. `inbuxa-migrate import <source> … --estimate` connects to the source, reports how much is **new** to fetch since the archive was last filled — counts, bytes and a rough time — and **writes nothing** (it implies `--dry-run`). ``` Estimate (no writes): mailbox: 2 new email: 24,318 new, 4.2 GB ---- total: 24,320 new, 4.2 GB rough time: 20–81 min (first run, no measured rate yet) ``` **How it works.** It reuses each source's existing dry-run delta enumeration (new vs already in the archive — so a re-estimate against a filled archive correctly shows only what arrived since) and adds a size pass that asks the source **only for sizes, never bodies**: over IMAP a `UID FETCH … RFC822.SIZE`, on a Maildir the file lengths. **Scope (v1).** IMAP and Maildir report sizes today — that is ~all the volume in a real mail migration. Other sources fall back to a plain dry-run with a note (`--estimate isn't available for this source yet`); adding each is small per-source follow-up work (Takeout needs message-level counting; CalDAV/CardDAV have `getcontentlength` in the PROPFIND; EWS has item sizes in enumeration). Measured-throughput time (vs the conservative default rate) is a noted follow-up too. **Design calls (agreed):** a `--estimate` flag on `import`, not a standalone verb (which would duplicate the 8-source arg tree); v1 ships a clearly-labeled *rough* time range. **Code.** `TypeCounts` gains a `bytes` field; `sync::estimate` renders the report; a `want_sizes` flag threads into the IMAP and Maildir dry-run summaries. README + unit tests (byte formatting, time range, report rendering); smoke-tested end to end against a Maildir, including the delta path. `cargo test --locked` (the CI gate), fmt and clippy `-D warnings` all pass.
jcoffey-dev added 1 commit 2026-11-12 15:30:10 +00:00
Add import --estimate: preview counts, sizes and a rough time
ci / test (pull_request) Skipped
github/ci (branch) GitHub Actions
ci / github (pull_request) Successful in 5m12s
ci / announce (pull_request) Skipped
87b143b898
Before committing to a migration, an operator wants to know how big it
is. --estimate connects to the source, reports how much is new to fetch
since the archive was last filled -- counts, bytes and a rough time --
and writes nothing. It implies --dry-run.

It reuses each source dry run's delta enumeration (new vs already in
the archive) and adds a size pass that asks only for sizes, never bodies:
over IMAP a UID FETCH RFC822.SIZE, on a Maildir the file lengths. Those
two sources report sizes today; the others fall back to a plain dry run
with a note, which is per-source follow-up work.

TypeCounts gains a bytes field; sync::estimate renders the report, with
a wide, clearly-rough time range since a first run has no measured
throughput to go on.
jcoffey-dev merged commit 2a33fa4043 into main 2026-11-12 16:42:21 +00:00
jcoffey-dev deleted branch feat/import-estimate 2026-11-12 16:42:22 +00:00
Sign in to join this conversation.