estimate: itemize a Takeout's calendars and contacts too #71

Merged
jcoffey-dev merged 1 commits from feat/estimate-takeout-pim into main 2026-11-12 17:31:08 +00:00
Owner

Follows the estimate work (#67–#70). Base is main; the whole estimate stack is merged.

Takeout's --estimate already counted and sized the mail, but calendars and contacts fell back to the plain per-file counts. Now it reads the .ics and .vcf files too: it counts the events and contacts that are new since the archive was last filled and sums the bytes of the record each would store — writing nothing.

How it dedupes

Each kind uses the same key the import keeps, so re-estimating a part-filled archive reports only what's left:

  • events by their UID — synthesised from the file path and ordinal when an event carries none, exactly as the import does;
  • contacts by the card UID.

So an object that appears in two files, or one already imported, counts once.

Changes

  • estimate_calendar / estimate_contacts in import_takeout/coordinator.rs, mirroring estimate_mail; the shared archived-id lookup is pulled into one archived_keys helper (mail now uses it too).
  • estimate_available's Takeout comment, the --estimate help, and the README updated: Takeout now itemizes mail, events and contacts.
  • The synthetic-Takeout estimate test asserts new events (≥2) and the four UID-deduped cards are counted and sized, and that a re-estimate after import finds nothing new of any kind (renamed estimate_counts_new_objects_and_sizes_them).

Verification

cargo fmt, cargo clippy --all-targets -D warnings, cargo test --locked (all 43 binaries) green.

With this, --estimate sizes imap, maildir, caldav, carddav, EWS and a full Takeout (mail + events + contacts). Remaining on the estimate line: Graph/JMAP counts-only (sizes cost an extra round-trip per item).

Follows the estimate work (#67–#70). Base is `main`; the whole estimate stack is merged. Takeout's `--estimate` already counted and sized the **mail**, but calendars and contacts fell back to the plain per-file counts. Now it reads the `.ics` and `.vcf` files too: it counts the **events** and **contacts** that are new since the archive was last filled and sums the bytes of the record each would store — writing nothing. ### How it dedupes Each kind uses the same key the import keeps, so re-estimating a part-filled archive reports only what's left: - **events** by their `UID` — synthesised from the file path and ordinal when an event carries none, exactly as the import does; - **contacts** by the card `UID`. So an object that appears in two files, or one already imported, counts once. ### Changes - `estimate_calendar` / `estimate_contacts` in `import_takeout/coordinator.rs`, mirroring `estimate_mail`; the shared archived-id lookup is pulled into one `archived_keys` helper (mail now uses it too). - `estimate_available`'s Takeout comment, the `--estimate` help, and the README updated: Takeout now itemizes mail, events and contacts. - The synthetic-Takeout estimate test asserts new events (≥2) and the four UID-deduped cards are counted and sized, and that a re-estimate after import finds **nothing new of any kind** (renamed `estimate_counts_new_objects_and_sizes_them`). ### Verification `cargo fmt`, `cargo clippy --all-targets -D warnings`, `cargo test --locked` (all 43 binaries) green. With this, `--estimate` sizes imap, maildir, caldav, carddav, EWS and a full Takeout (mail + events + contacts). Remaining on the estimate line: Graph/JMAP counts-only (sizes cost an extra round-trip per item).
jcoffey-dev added 1 commit 2026-11-12 17:01:23 +00:00
estimate: itemize a Takeout's calendars and contacts too
ci / test (pull_request) Skipped
github/ci (branch) GitHub Actions
ci / github (pull_request) Successful in 4m51s
ci / announce (pull_request) Skipped
6559b9812d
Takeout's --estimate counted and sized the mail but left calendars and
contacts to the plain file counts. Now it reads the .ics and .vcf files
as well: it counts the events and contacts that are new since the
archive was last filled and sums the bytes of the record each would
store, writing nothing.

Each kind dedupes by the same key the import keeps -- events by their
UID (synthesised from the file path and ordinal when an event has none,
exactly as the import does), contacts by the card UID -- so an object
that appears in two files, or one already imported, counts once. A
re-estimate of a part-filled archive reports only what is left.

The archived-id lookup the three scans share is pulled into one helper,
archived_keys. The synthetic-Takeout estimate test now asserts new
events and contacts are counted and sized, and that a re-estimate after
import finds nothing new of any kind.
jcoffey-dev merged commit 0f01d931ec into main 2026-11-12 17:31:08 +00:00
jcoffey-dev deleted branch feat/estimate-takeout-pim 2026-11-12 17:31:08 +00:00
Sign in to join this conversation.