migrate: --repeat, keep syncing until the cutover #73

Merged
jcoffey-dev merged 1 commits from feat/migrate-repeat into main 2026-11-12 19:52:02 +00:00
Owner

Roadmap item: migrate true delta re-sync (inbuxa-drafts/27.1-tooling-roadmap.md:143) — "keep syncing until cutover … for near-zero-downtime cutovers." Shape chosen with John: a repeat driver on migrate --plan.

Moving a busy account means moving it twice — the bulk ahead of time, then a short catch-up at the cutover so almost no mail is lost to downtime. The import and export steps already converge (each run moves only what changed), so the catch-up existed; what was missing was driving it (run, wait, run again).

--repeat <DURATION>

After each pass over the accounts it waits that long (30s, 5m, 1h) and runs them again, each pass moving only what has arrived at the source since the last, until interrupted. Setup runs once, before the first pass. Leave it running while the old server still takes mail; change the MX and stop it, and the final pass is a short catch-up instead of the whole mailbox. A pass in flight is resumable, so Ctrl-C is safe.

  • --max-passes <N> bounds it.
  • --until-quiet stops on the first pass that moves nothing new — the source has gone quiet and the servers are in step, a cue that the cutover is safe.
  • Each pass re-runs every step (like --again); that's what makes it catch the delta instead of skipping the done steps.

Changes

  • The account pass is factored into run_accounts_pass; run loops it. migrate_account takes again per pass.
  • Outcome gains passes; the summary line notes it; json progress gains a per-pass end (with pass) and a waiting event between passes.
  • --repeat/--max-passes/--until-quiet on the CLI, with a small duration parser.
  • README + docs/usage.md document the cutover workflow.

Verification

cargo fmt, clippy --all-targets -D warnings, cargo test --locked — 1628 passed, 0 failed. New tests cover the multi-pass loop, the --until-quiet stop, and the duration parser (the mock-migrate harness runs the real binary per step).

Roadmap item: migrate **true delta re-sync** (`inbuxa-drafts/27.1-tooling-roadmap.md:143`) — *"keep syncing until cutover … for near-zero-downtime cutovers."* Shape chosen with John: a repeat driver on `migrate --plan`. Moving a busy account means moving it twice — the bulk ahead of time, then a short catch-up at the cutover so almost no mail is lost to downtime. The import and export steps already **converge** (each run moves only what changed), so the catch-up existed; what was missing was driving it (run, wait, run again). ### `--repeat <DURATION>` After each pass over the accounts it waits that long (`30s`, `5m`, `1h`) and runs them again, each pass moving only what has arrived at the source since the last, until interrupted. Setup runs once, before the first pass. Leave it running while the old server still takes mail; change the MX and stop it, and the final pass is a short catch-up instead of the whole mailbox. A pass in flight is resumable, so **Ctrl-C is safe**. - `--max-passes <N>` bounds it. - `--until-quiet` stops on the first pass that moves nothing new — the source has gone quiet and the servers are in step, a cue that the cutover is safe. - Each pass re-runs every step (like `--again`); that's what makes it catch the delta instead of skipping the done steps. ### Changes - The account pass is factored into `run_accounts_pass`; `run` loops it. `migrate_account` takes `again` per pass. - `Outcome` gains `passes`; the summary line notes it; json progress gains a per-pass `end` (with `pass`) and a `waiting` event between passes. - `--repeat`/`--max-passes`/`--until-quiet` on the CLI, with a small duration parser. - README + `docs/usage.md` document the cutover workflow. ### Verification `cargo fmt`, `clippy --all-targets -D warnings`, `cargo test --locked` — **1628 passed, 0 failed**. New tests cover the multi-pass loop, the `--until-quiet` stop, and the duration parser (the mock-migrate harness runs the real binary per step).
jcoffey-dev added 1 commit 2026-11-12 18:17:35 +00:00
migrate: --repeat, keep syncing until the cutover
ci / test (pull_request) Skipped
github/ci (branch) GitHub Actions
ci / github (pull_request) Successful in 6m12s
ci / announce (pull_request) Skipped
4bbce61615
Moving a busy account means moving it twice: the bulk ahead of time, then
a short catch-up at the cutover so almost no mail is lost to downtime. The
import and export steps already converge -- each run moves only what
changed -- so the catch-up was there, but driving it was manual: run,
wait, run again.

--repeat <DURATION> drives it. After each pass over the accounts it waits
that long and runs them again, each pass moving only what has arrived at
the source since the last, until the run is interrupted. The setup runs
once, before the first pass. Leave it running while the old server still
takes mail; change the MX and stop it, and the final pass is a short
catch-up, not the whole mailbox. A pass in flight is resumable, so Ctrl-C
is safe.

--max-passes <N> bounds it, and --until-quiet stops on the first pass that
moves nothing new -- the source has gone quiet and the servers are in
step, a cue the cutover is safe. Each pass re-runs every step, like
--again, which is what makes it catch the delta rather than skip the
done steps.

The account pass is factored into run_accounts_pass and the run loops it;
Outcome gains the pass count, the json progress gains a per-pass end event
and a waiting event between passes. Tests cover the multi-pass loop, the
--until-quiet stop and the duration parser.
jcoffey-dev merged commit 608fc4d56e into main 2026-11-12 19:52:02 +00:00
jcoffey-dev deleted branch feat/migrate-repeat 2026-11-12 19:52:02 +00:00
Sign in to join this conversation.