Add the reconcile command: a per-folder report that a migration was complete #81

Merged
jcoffey-dev merged 1 commits from feat/reconcile into main 2026-11-13 18:38:46 +00:00
Owner

Adds a reconcile command: a read-only report that an archive holds what a migration should have brought across, folder by folder.

inbuxa-migrate reconcile <ARCHIVE>

It prints, in order:

  • Folders — one row per mailbox, by full path, with its message count and a content checksum (blake3 over the sorted content hashes of the messages in it). A message filed in more than one folder is counted in each.
  • Totals — messages, folders, stored content size and blob count, and a single checksum over the whole archive's mail.
  • Integrity — ok, or a line for each problem: messages pointing at content not in the archive, empty blobs, messages in no folder, and messages filed in a folder that is not there.

Two uses

  • Compare the per-folder counts against the old mailbox to prove the move was complete.
  • Compare two archives' checksums to prove they hold the very same mail — an export and a re-import, or a backup and its source. The checksum is order-independent, so identical content always matches.

Notes

  • Read-only, like inspect: no network, never writes, refuses to create an archive from a bare path, says "in use" if another run holds it.
  • Exit codes: 0 clean, 8 an integrity problem (past the 1–7 the other commands use, so a script can tell a reconciliation failure from any other error), 7 the archive can't be opened.
  • New module src/reconcile.rs mirrors inspect's shape and reuses init::open_read_only, inspect::{format_count, format_bytes}. stdlib + existing deps only (blake3, rusqlite).
  • 7 unit tests over in-memory archives (per-folder counts, nested paths, a message in two folders, identical-content checksum equality, each integrity failure, empty archive) + a CLI parse test. cargo fmt --check, clippy -D warnings, cargo test --locked all green. Smoke-tested end to end: imported a small Maildir, reconciled it clean (exit 0), then corrupted a blob pointer and confirmed exit 8 with the right message.

Documented in README (command list + prose), docs/usage.md (new Reconcile section), and CHANGELOG [Unreleased].

Adds a `reconcile` command: a read-only report that an archive holds what a migration should have brought across, folder by folder. ``` inbuxa-migrate reconcile <ARCHIVE> ``` It prints, in order: - **Folders** — one row per mailbox, by full path, with its message count and a content checksum (blake3 over the sorted content hashes of the messages in it). A message filed in more than one folder is counted in each. - **Totals** — messages, folders, stored content size and blob count, and a single checksum over the whole archive's mail. - **Integrity** — `ok`, or a line for each problem: messages pointing at content not in the archive, empty blobs, messages in no folder, and messages filed in a folder that is not there. ### Two uses - Compare the per-folder counts against the old mailbox to prove the move was complete. - Compare two archives' checksums to prove they hold the very same mail — an export and a re-import, or a backup and its source. The checksum is order-independent, so identical content always matches. ### Notes - Read-only, like `inspect`: no network, never writes, refuses to create an archive from a bare path, says "in use" if another run holds it. - Exit codes: `0` clean, `8` an integrity problem (past the `1`–`7` the other commands use, so a script can tell a reconciliation failure from any other error), `7` the archive can't be opened. - New module `src/reconcile.rs` mirrors `inspect`'s shape and reuses `init::open_read_only`, `inspect::{format_count, format_bytes}`. stdlib + existing deps only (`blake3`, `rusqlite`). - 7 unit tests over in-memory archives (per-folder counts, nested paths, a message in two folders, identical-content checksum equality, each integrity failure, empty archive) + a CLI parse test. `cargo fmt --check`, `clippy -D warnings`, `cargo test --locked` all green. Smoke-tested end to end: imported a small Maildir, reconciled it clean (exit 0), then corrupted a blob pointer and confirmed exit 8 with the right message. Documented in README (command list + prose), `docs/usage.md` (new Reconcile section), and CHANGELOG `[Unreleased]`.
jcoffey-dev added 1 commit 2026-11-13 18:32:28 +00:00
Add the reconcile command: a per-folder report that a migration was complete
ci / test (pull_request) Skipped
github/ci (branch) GitHub Actions
ci / github (pull_request) Successful in 6m12s
ci / announce (pull_request) Skipped
7862aa9bc2
reconcile <archive> reads a local archive and reports it folder by
folder -- a message count and a content checksum for each folder, totals
and a checksum for the whole, and an integrity check that every message
resolves to stored content and a real folder. It is read-only and
reaches no network, like inspect.

Two uses: compare the per-folder counts against the source mailbox to
prove the move brought everything across, and compare two archives'
checksums to prove they hold the very same mail (an export and a
re-import, or a backup and its source). It exits 8 when the archive is
not sound, past the 1-7 the other commands use, so a script can tell a
reconciliation failure from any other error.
jcoffey-dev force-pushed feat/reconcile from fa2a09d7ad to 7862aa9bc2 2026-11-13 18:32:28 +00:00 Compare
jcoffey-dev merged commit 851b070c32 into main 2026-11-13 18:38:46 +00:00
jcoffey-dev deleted branch feat/reconcile 2026-11-13 18:38:46 +00:00
Sign in to join this conversation.