Skip to content

Slice 034: Export, import, restore - #43

Merged
HackTuah merged 10 commits into
mainfrom
slice/034-export-import-restore
Sep 21, 2026
Merged

HackTuah merged 10 commits into
mainfrom
slice/034-export-import-restore

Conversation

@HackTuah

Copy link
Copy Markdown
Member

One gzip tarball with the two databases snapshotted by VACUUM INTO (consistent, beside a running Trinity), the key registry, the private key only with --keys, and a manifest with a digest per file and the schema versions. The import checks the schema versions against this binary's migrations, verifies every digest and every path against the tarball's bytes before writing anything, refuses a non-empty directory unless --force (then says what it replaced) and a directory a live Trinity holds. mix trinity.export, mix trinity.import, the first /settings page with the download, docs/backup.md. The receipt chain verifies after the round trip.

Also carried: fix(s030) for a test that put a trinity-* directory on the code path (it made Application.app_dir(:trinity) point at /tmp for later tests). One real finding closed before the slice closed: a manifest path like keys/../../x would have resolved outside the layout; paths are validated before the digests now, with a planted test.

PROOF.md at slices/034-export-import-restore/PROOF.md.

Signed-off-by: Ayla Croft aylacroft@proton.me

…measured, and the slice opens

ROADMAP row 034 to in_progress. NOTES.md records VACUUM INTO at 9 ms
over 8,029 messages and a 713 KB tarball for this machine's dev data,
then the six-line build plan, the empty manual queue and two
deviations stated before any code. plan_check: PASS.

Signed-off-by: Ayla Croft <aylacroft@proton.me>
…efore any write, the manifest

Layout (the data directory's files by role, or the running app's),
Manifest (format, app version, schema versions per database, keys
included, a digest per file), export (each database snapshotted, the
registry copied, private keys only with keys: true) and import (the
manifest read, the schema versions checked against this binary's
migration files, every digest verified against the tarball's bytes,
a non-empty target refused or forced with what it replaced, then the
files written and a RESTORED marker). Six tests on real files: AC1 and
AC2 through dynamic repos on the restored databases, AC3 to AC6, the
manifest's JSON. The first run refused this machine's test database,
which carried 033's migration from another branch: the check works.

Signed-off-by: Ayla Croft <aylacroft@proton.me>
…ry on the code path

:code.lib_dir/1 takes a code-path entry named <app>-<vsn> as the
application's directory, so the prepended /tmp/trinity-policy-N made
Application.app_dir(:trinity) point at /tmp for every later test;
slice 034's migration listing came back empty. The directory is
planted-policy-N and the path is removed on exit. The persona picker
test reads the session it was redirected to rather than the newest
row on disk.

Signed-off-by: Ayla Croft <aylacroft@proton.me>
…ownload, docs/backup.md

mix trinity.export (--out, --keys, --data-dir) and mix trinity.import
(--force, --data-dir), the import refusing a data directory a live
Trinity holds (Lock.live_holder/1) before anything else. The first
/settings page: the export as a download with and without the private
key (ExportController), the data directory, links. docs/backup.md:
what the archive holds and does not, the restore procedure, the size
measured. Five tests.

Signed-off-by: Ayla Croft <aylacroft@proton.me>
Signed-off-by: Ayla Croft <aylacroft@proton.me>
…rite; sobelow reasons

Layout.safe_path?/1 accepts the two databases and relative paths
under keys/, skills/ or personas/ with no dot segments; Manifest.verify
refuses anything else as :unsafe_path before the digests, so
keys/../../x from an archive is never resolved. A test plants one.
The remaining file operations carry their reasons inline; the lock's
new function sits at the file's end so the fingerprinted skips keep
their lines.

Signed-off-by: Ayla Croft <aylacroft@proton.me>
…ackup.md says what Postgres does

Run 35553598612's postgres job had no SQLite file to snapshot.

Signed-off-by: Ayla Croft <aylacroft@proton.me>
PROOF.md with every criterion's evidence by test name against run
35553822292 (gate, postgres and fips green). NOTES.md: eight findings,
four follow-ups. ROADMAP row 034 to done; coverage.tsv row 78.83 %.

Signed-off-by: Ayla Croft <aylacroft@proton.me>
Signed-off-by: Ayla Croft <aylacroft@proton.me>
The three conflicts were the export list in lib/trinity.ex (both
sub-boundaries kept), the coverage rows (033 before 034) and the two
ROADMAP rows (both done).

Signed-off-by: Ayla Croft <aylacroft@proton.me>
@HackTuah
HackTuah merged commit 7e0bea4 into main Sep 21, 2026
8 checks passed
@HackTuah
HackTuah deleted the slice/034-export-import-restore branch September 21, 2026 03:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant