Skip to main content

Module chain_migrate

Module chain_migrate 

Source
Expand description

weaver migrate user-chain: copy the legacy ~/.clawft chain to the Phase 1 user chain location (~/.weftos/chain), verified, source untouched.

Safety sequence (ADR-103 Phase 1, plan package E):

  1. refuse when the destination already holds something that is not this migration (identical or already-migrated is a no-op);
  2. refuse when a kernel holds the source chain.lock, or when the mixed-version guard says a lock-unaware writer touched it recently;
  3. take the source chain.lock ourselves for the whole run;
  4. copy to a temp dir beside the destination, fsync every file;
  5. re-hash the source: any change since the plan aborts;
  6. load the copy with the kernel’s own restore path, check byte hashes, event count, head hash, integrity and signature against the source;
  7. write MIGRATED_FROM.json, atomically rename into place, then write the marker beside the source.

Any failure before step 7’s rename removes the temp dir. The source chain files are never modified, moved or deleted; the only writes in the source directory are the transient chain.lock and the final marker.

Structs§

FileEntry
One file in the set.
Head
What restoring the chain yields.
Marker
MIGRATED_FROM.json.
MigrateOptions
Inputs. Paths are injected; the CLI resolves $HOME.
Plan
What a migration would copy, from the source.

Enums§

MigrateError
Why a migration did not happen.
Outcome
Result of a run.

Functions§

migrate_user_chain
Migrate. See the module docs for the sequence.