Roadmap item 11, part two: a contact in two address books goes into both, instead of failing on every run.
The archive keeps one row per card UID. When a CardDAV server lists the same card in two address books, the second INSERT used to fail on every run. Now:
The second book is added to the first row's address_book_ids.
sync_id_dav lets two server items point at one archive row. Older archives are rebuilt without that UNIQUE, keeping their rows.
If a card vanishes from one book while another book still holds it, only that book is taken off. The card is deleted when no book holds it any more.
Deleting an address book deletes only the cards no other book holds (db::cards::remove_book).
If the two copies differ, the one read last is kept.
Takeout doesn't need this: it puts every card in a single default book.
Tests:
tests/mock_import_carddav_books.rs runs in CI. It covers a card in two books, a re-run, the card leaving one book, coming back, its first book being deleted, and the card going away entirely. It fails on old main (failed: 1) and passes here.
The in-memory DAV server from mock_export_dav.rs moves to tests/fake_dav/, gaining multiget REPORT, DELETE and a configurable list of refused paths.
New unit tests cover the migration, items_for_local, and the book-set helpers. The old test that asserted the UNIQUE is replaced.
Live runs: integration_radicale, integration_baikal and integration_export_dav all pass. sync_carddav fails while provisioning its Stalwart server (FileNode/set rejects nodeType), before any import runs. That's a drift between that rig's image and its seed code, not this change.
Checks: fmt, clippy -D warnings, cargo test --locked (1480 passed).
Roadmap item 11, part two: a contact in two address books goes into both, instead of failing on every run.
The archive keeps one row per card UID. When a CardDAV server lists the same card in two address books, the second INSERT used to fail on every run. Now:
- The second book is added to the first row's `address_book_ids`.
- `sync_id_dav` lets two server items point at one archive row. Older archives are rebuilt without that `UNIQUE`, keeping their rows.
- If a card vanishes from one book while another book still holds it, only that book is taken off. The card is deleted when no book holds it any more.
- Deleting an address book deletes only the cards no other book holds (`db::cards::remove_book`).
- If the two copies differ, the one read last is kept.
Takeout doesn't need this: it puts every card in a single default book.
Tests:
- `tests/mock_import_carddav_books.rs` runs in CI. It covers a card in two books, a re-run, the card leaving one book, coming back, its first book being deleted, and the card going away entirely. **It fails on old main (`failed: 1`) and passes here.**
- The in-memory DAV server from `mock_export_dav.rs` moves to `tests/fake_dav/`, gaining multiget REPORT, DELETE and a configurable list of refused paths.
- New unit tests cover the migration, `items_for_local`, and the book-set helpers. The old test that asserted the `UNIQUE` is replaced.
- Live runs: `integration_radicale`, `integration_baikal` and `integration_export_dav` all pass. `sync_carddav` fails while provisioning its Stalwart server (`FileNode/set` rejects `nodeType`), before any import runs. That's a drift between that rig's image and its seed code, not this change.
Checks: fmt, clippy `-D warnings`, `cargo test --locked` (1480 passed).
The archive keeps one row per card UID, so a CardDAV server that lists
the same card in two address books made the second INSERT fail, on every
run. The second book now joins the first row's address_book_ids, and
sync_id_dav lets two server items map to one local row (older archives
are rebuilt without that UNIQUE). A vanished item takes only its book
off a card another item still maps; deleting an address book deletes
only the cards no other book holds.
The in-memory DAV server from mock_export_dav moves to tests/fake_dav,
gaining multiget and DELETE, and drives a new import test that fails on
the old code.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Roadmap item 11, part two: a contact in two address books goes into both, instead of failing on every run.
The archive keeps one row per card UID. When a CardDAV server lists the same card in two address books, the second INSERT used to fail on every run. Now:
address_book_ids.sync_id_davlets two server items point at one archive row. Older archives are rebuilt without thatUNIQUE, keeping their rows.db::cards::remove_book).Takeout doesn't need this: it puts every card in a single default book.
Tests:
tests/mock_import_carddav_books.rsruns in CI. It covers a card in two books, a re-run, the card leaving one book, coming back, its first book being deleted, and the card going away entirely. It fails on old main (failed: 1) and passes here.mock_export_dav.rsmoves totests/fake_dav/, gaining multiget REPORT, DELETE and a configurable list of refused paths.items_for_local, and the book-set helpers. The old test that asserted theUNIQUEis replaced.integration_radicale,integration_baikalandintegration_export_davall pass.sync_carddavfails while provisioning its Stalwart server (FileNode/setrejectsnodeType), before any import runs. That's a drift between that rig's image and its seed code, not this change.Checks: fmt, clippy
-D warnings,cargo test --locked(1480 passed).