export: bring matched items up to date on every run #7

Merged
jcoffey-dev merged 1 commits from feat/export-updates into main 2026-09-30 18:40:49 +00:00
Owner

Export matched each item against the target and then skipped it, so a second
run -- the usual final pass of a cutover -- never carried anything that had
changed at the source since the first: read and flagged state, moves between
folders, edited contacts, events and Sieve scripts. It reported them as
skipped and exited 0, while the usage guide said matched items were updated.

Matched items are now updated, with one batched /set per type:

  • Email: keywords are set to the archive's, added and removed, compared
    case-insensitively. Memberships of folders this run migrated are added and
    removed to match; folders that exist only on the target are left alone,
    and a message is never left in no folder. Properties the server did not
    report are not touched.
  • Contacts and events: when both copies carry updated, the archive's is
    written only if it is newer; otherwise each property the archive writes is
    compared, and those that differ are sent whole.
  • Sieve scripts: the target's copy is downloaded and compared byte for byte,
    and replaced with the archive's when it differs.

Updated items are counted as updated; unchanged ones stay skipped. The
usage guide now describes this.

Roadmap item 1. Stacked on #4: this branch contains #4's commit (5ae0625) and should be merged after it; once #4 lands, this PR's diff is just its own commit.

Tests: unit tests for email patches (folders added, moves between migrated folders, never no folder, keywords both ways with JSON Pointer escaping) and for contact/event change detection (unchanged, changed properties, updated deciding). End-to-end mock tests: a re-run carries a read flag and drops a stale one; a contact edited at the source is updated; one whose target copy is newer is left alone; a same-named Sieve script is updated when its content differs and left alone when it doesn't. The upstream test that locked in skip-by-name for Sieve is replaced by those two.

Export matched each item against the target and then skipped it, so a second run -- the usual final pass of a cutover -- never carried anything that had changed at the source since the first: read and flagged state, moves between folders, edited contacts, events and Sieve scripts. It reported them as skipped and exited 0, while the usage guide said matched items were updated. Matched items are now updated, with one batched /set per type: - Email: keywords are set to the archive's, added and removed, compared case-insensitively. Memberships of folders this run migrated are added and removed to match; folders that exist only on the target are left alone, and a message is never left in no folder. Properties the server did not report are not touched. - Contacts and events: when both copies carry `updated`, the archive's is written only if it is newer; otherwise each property the archive writes is compared, and those that differ are sent whole. - Sieve scripts: the target's copy is downloaded and compared byte for byte, and replaced with the archive's when it differs. Updated items are counted as `updated`; unchanged ones stay `skipped`. The usage guide now describes this. Roadmap item 1. **Stacked on #4:** this branch contains #4's commit (5ae0625) and should be merged after it; once #4 lands, this PR's diff is just its own commit. Tests: unit tests for email patches (folders added, moves between migrated folders, never no folder, keywords both ways with JSON Pointer escaping) and for contact/event change detection (unchanged, changed properties, `updated` deciding). End-to-end mock tests: a re-run carries a read flag and drops a stale one; a contact edited at the source is updated; one whose target copy is newer is left alone; a same-named Sieve script is updated when its content differs and left alone when it doesn't. The upstream test that locked in skip-by-name for Sieve is replaced by those two.
jcoffey-dev added 1 commit 2026-09-30 18:37:43 +00:00
export: bring matched items up to date on every run
ci / test (pull_request) Skipped
github/ci (branch) GitHub Actions
ci / github (pull_request) Successful in 2m50s
ci / announce (pull_request) Skipped
687027c7cb
Export matched each item against the target and then skipped it, so a second
run -- the usual final pass of a cutover -- never carried anything that had
changed at the source since the first: read and flagged state, moves between
folders, edited contacts, events and Sieve scripts. It reported them as
skipped and exited 0, while the usage guide said matched items were updated.

Matched items are now updated, with one batched /set per type:

- Email: keywords are set to the archive's, added and removed, compared
  case-insensitively. Memberships of folders this run migrated are added and
  removed to match; folders that exist only on the target are left alone,
  and a message is never left in no folder. Properties the server did not
  report are not touched.
- Contacts and events: when both copies carry `updated`, the archive's is
  written only if it is newer, compared as instants so an offset or a
  fraction of a second is not taken for a change; otherwise each property the
  archive writes is compared, and those that differ are sent whole.
- Sieve scripts: the target's copy is downloaded and compared byte for byte
  with what export would write -- after renaming Stalwart's vendor names for
  an inbuxa target -- and replaced when it differs, so a renamed script is
  not re-uploaded on every run.

Updated items are counted as `updated`; unchanged ones stay `skipped`. The
usage guide now describes this.
jcoffey-dev force-pushed feat/export-updates from db76a1044f to 687027c7cb 2026-09-30 18:37:43 +00:00 Compare
jcoffey-dev merged commit 97d126fbfa into main 2026-09-30 18:40:49 +00:00
jcoffey-dev deleted branch feat/export-updates 2026-09-30 18:40:49 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: inbuxa/inbuxa-migrate#7