estimate: counts-only for JMAP and Microsoft Graph #72

Merged
jcoffey-dev merged 1 commits from feat/estimate-counts-jmap-graph into main 2026-11-12 17:31:18 +00:00
Owner

Stacks on #71 (base feat/estimate-takeout-pim). This closes the estimate line.

--estimate now covers the two remaining online sources, JMAP and Microsoft Graph. Both can enumerate an object's id cheaply, but a size would cost a body fetch per object — so these report counts without bytes: for each type, how many objects are new since the archive was last filled. The report already renders a bytes-less row as just a count, so no format change is needed.

JMAP

The dry run already computes the delta (d.new — new vs what the archive holds) per type. The estimate just keeps the per-type summary instead of printing the dry-run table and discarding it. Two-line wiring change in import_jmap.rs; the plain --dry-run table is unchanged (gated on !estimate).

Graph

Graph's dry run only counted folders, so this adds a read-only item pass, import_exchange_graph/estimate.rs:

  • walks the same folder tree the import does (mail tree via enumerate_mail_folders; nested + default contact folders via the same discovery the importer uses);
  • enumerates message / event / contact ids with $select=id;
  • counts those not already in the archive, deduped across folders;
  • skips single occurrences exactly as the import does (it stores the series master), so the count matches what an import would create and a re-estimate finds nothing new.

It writes nothing — a read-only pass over folder lists and id pages. default_contact_folder is made pub(crate) to reuse the importer's default-folder probe; classify_event_type was already public.

Changes

  • estimate_available gates Import (JMAP) and ImportExchangeGraph.
  • The shared new-id counter count_new is a small unit-tested helper (archived skipped, dedup within a pass, no-id ignored, bytes stay 0).
  • README, --estimate help and the fallback note now distinguish sized sources (imap, maildir, caldav, carddav, EWS, takeout) from these counts-only ones.

Verification

cargo fmt, cargo clippy --all-targets -D warnings, cargo test --locked — 1625 passed, 0 failed.

With this, --estimate covers every online/offline source the tool imports from. Only Graph/JMAP sizes (a per-object body fetch) and measured-throughput timing remain as possible future refinements.

Stacks on #71 (base `feat/estimate-takeout-pim`). This closes the estimate line. `--estimate` now covers the two remaining online sources, **JMAP** and **Microsoft Graph**. Both can enumerate an object's id cheaply, but a size would cost a body fetch per object — so these report **counts without bytes**: for each type, how many objects are new since the archive was last filled. The report already renders a bytes-less row as just a count, so no format change is needed. ### JMAP The dry run already computes the delta (`d.new` — new vs what the archive holds) per type. The estimate just **keeps the per-type summary** instead of printing the dry-run table and discarding it. Two-line wiring change in `import_jmap.rs`; the plain `--dry-run` table is unchanged (gated on `!estimate`). ### Graph Graph's dry run only counted folders, so this adds a read-only item pass, `import_exchange_graph/estimate.rs`: - walks the **same folder tree** the import does (mail tree via `enumerate_mail_folders`; nested + default contact folders via the same discovery the importer uses); - enumerates message / event / contact ids with `$select=id`; - counts those **not already in the archive**, deduped across folders; - skips single **occurrences** exactly as the import does (it stores the series master), so the count matches what an import would create and **a re-estimate finds nothing new**. It writes nothing — a read-only pass over folder lists and id pages. `default_contact_folder` is made `pub(crate)` to reuse the importer's default-folder probe; `classify_event_type` was already public. ### Changes - `estimate_available` gates `Import` (JMAP) and `ImportExchangeGraph`. - The shared new-id counter `count_new` is a small unit-tested helper (archived skipped, dedup within a pass, no-id ignored, bytes stay 0). - README, `--estimate` help and the fallback note now distinguish **sized** sources (imap, maildir, caldav, carddav, EWS, takeout) from these **counts-only** ones. ### Verification `cargo fmt`, `cargo clippy --all-targets -D warnings`, `cargo test --locked` — 1625 passed, 0 failed. With this, `--estimate` covers every online/offline source the tool imports from. Only Graph/JMAP **sizes** (a per-object body fetch) and measured-throughput timing remain as possible future refinements.
jcoffey-dev changed target branch from feat/estimate-takeout-pim to main 2026-11-12 17:31:09 +00:00
jcoffey-dev added 1 commit 2026-11-12 17:31:09 +00:00
estimate: counts-only for JMAP and Microsoft Graph
ci / test (pull_request) Skipped
github/ci (branch) GitHub Actions
ci / github (pull_request) Successful in 5m31s
ci / announce (pull_request) Skipped
a70efdbb82
--estimate now covers the two remaining online sources. Both can
enumerate an object's id cheaply, but a size would cost a body fetch per
object, so these report counts without bytes: for each type, how many
objects are new since the archive was last filled.

JMAP already computes that delta in its dry run (new versus what the
archive holds); the estimate just keeps the per-type summary instead of
printing the dry-run table and discarding it.

Graph's dry run only counted folders, so this adds a read-only item
pass (src/sync/import_exchange_graph/estimate.rs): it walks the same
folder tree the import does, enumerates message, event and contact ids
with $select=id, and counts those not already in the archive. It skips
single occurrences exactly as the import does (it stores the series
master) and walks nested and default contact folders, so the count
matches what an import would create and a re-estimate finds nothing new.
It writes nothing.

The shared new-id counter is a small, unit-tested helper. README, the
--estimate help and the fallback note now distinguish sized sources
from these counts-only ones.
jcoffey-dev merged commit b10ea7766b into main 2026-11-12 17:31:18 +00:00
jcoffey-dev deleted branch feat/estimate-counts-jmap-graph 2026-11-12 17:31:18 +00:00
Sign in to join this conversation.