Expand description
Journaled, resumable migration of the legacy oxicode home (~/.oxicode)
into the unified Oxi home layout (<oxicode_home>).
Contract:
- Preflight produces a plan: source, destination, file count, total
bytes, and a state (
MigrationState::NothingToDo,MigrationState::Ready,MigrationState::AlreadyMigrated,MigrationState::Conflict). - Conflict = the destination already contains a file that differs
(size or SHA-256) from its source counterpart. The migration aborts,
reports both paths, and touches nothing. A destination identical to the
source means
MigrationState::AlreadyMigrated(no-op). - The journal (
<oxi_home>/oxicode.migration-journal.json) is written atomically (temp + rename) BEFORE the first filesystem mutation, withstatus: "in_progress"; on success it is rewritten withstatus: "complete". - The copy step is idempotent per file: a destination file with the
same size + SHA-256 is skipped; otherwise the file is copied to
<dest>.part-<pid>, fsynced, and renamed into place (destination directory fsynced best-effort). Because of this, a run that dies mid-copy can simply be re-run: the journal staysin_progressand the rerun repairs/resumes. - The verify step walks both trees and requires every source file to
exist in the destination with a matching hash. Any mismatch is an error
and the journal stays
in_progressfor the next run to repair. - The source is never deleted or modified — migration is copy-only. (Rename optimization is deferred to a later cutover release.)
Structs§
- Migration
Journal - On-disk migration journal. Written atomically before the first mutation; a missing or unreadable journal is treated as “no journal”.
- Migration
Plan - Result of a preflight run.
Enums§
- Home
Migration Error - Errors the migration engine can surface.
- Migration
State - Outcome of the preflight analysis. See module docs for the semantics.
- RunOutcome
- What a
runinvocation did.
Constants§
- JOURNAL_
VERSION - Current journal schema version.
Functions§
- copy_
file_ idempotent - Copy
source→destinationif the destination does not already match. - preflight
- Analyze a legacy → canonical migration without touching the filesystem.
- run
- Execute (or dry-run) the migration.
- verify
- Verify the migration: every source file must exist in the destination with a matching size + SHA-256. Extra destination files are not part of the migration set and are ignored.
- walk_
files - Recursively list files under
rootasroot-relative paths, sorted for deterministic plans.