import files: read an account export back, manifest and all #54

Merged
jcoffey-dev merged 1 commits from feat/import-files into main 2026-10-31 20:52:56 +00:00
Owner

Adds import files, which reads an account export back into an archive, manifest and all. Until now only the open formats inside an export could be read back, so folder names, roles, the default address book and calendar, calendar colors, the active Sieve script, file links and identities were lost on the way in. This closes that gap for the layout at https://coffeylabs.org/specs/account-export/.

Copies of one message in several folders come back as one message in each, paths in the manifest are checked to stay inside the export, and symlinks are never followed. Archives gain a files source kind (the sources table is rebuilt with foreign keys off) and a new id table. An archive exported, imported and exported again gives the same tree; clippy and the full suite pass locally.

Adds `import files`, which reads an account export back into an archive, manifest and all. Until now only the open formats inside an export could be read back, so folder names, roles, the default address book and calendar, calendar colors, the active Sieve script, file links and identities were lost on the way in. This closes that gap for the layout at https://coffeylabs.org/specs/account-export/. Copies of one message in several folders come back as one message in each, paths in the manifest are checked to stay inside the export, and symlinks are never followed. Archives gain a `files` source kind (the sources table is rebuilt with foreign keys off) and a new id table. An archive exported, imported and exported again gives the same tree; clippy and the full suite pass locally.
jcoffey-dev added 1 commit 2026-10-31 20:41:28 +00:00
import files: read an account export back, manifest and all
ci / test (pull_request) Skipped
github/ci (branch) GitHub Actions
ci / github (pull_request) Successful in 4m31s
ci / announce (pull_request) Skipped
bb9bc66d63
export-files writes the layout specified at
https://coffeylabs.org/specs/account-export/, and until now only its open
formats could be read back (import maildir, import takeout). The parts only
the manifest holds were lost on the way back in: real folder names, roles
and subscriptions, the default address book and calendar, calendar colors
and time zones, the active Sieve script, media types, links, identities and
their signatures.

import files reads all of it. Copies of a message kept in several folders
come back as one message in each, matched by content, since the spec says
nothing in a file name but the Maildir flags can be relied on. Every path
in the manifest is checked to stay inside its part of the export and no
symbolic link is followed. A tree without a manifest, or of a later layout
version, is refused; the rc.2 format name is accepted. A second run brings
the archive up to date and deletes nothing.

Archives gain the source kind `files` (the sources table is rebuilt with
foreign keys off, so nothing cascades) and a sync_id_files table.

An archive exported, imported and exported again gives the same tree.
jcoffey-dev merged commit fc172ff218 into main 2026-10-31 20:52:56 +00:00
jcoffey-dev deleted branch feat/import-files 2026-10-31 20:52:57 +00:00
Sign in to join this conversation.