Migration: calternal migrate-v0 (M1-M9) #48

Closed
kayg wants to merge 1 commit from issue/12-migrate-v0 into dev
Owner

Part of #12 (step 2: the tool plus a dry run on staging).

calternal migrate-v0 --from <v0 user dir> --to <home> --report <file> [--dry-run] [--overwrite-edited], a new crate crates/migrate-v0 implementing kayg's decisions M1-M9 (ADR 0034 updated).

  • M1 day notes become YYYY-MM-DD.md with id day-YYYY-MM-DD (the same id the daily-notes plugin derives, agreed with #8), and v0's generated daily heading and title are removed. Other notes become <Title>.md (from title:, then the H1, then the file name), with a number added when names clash.
  • M2 links are repaired by file name, date, title, slug or alias and written as [t](<Note.md>). Unmatched links stay as written and are reported. [[wikilinks]] always become standard links. Code blocks and inline code are never touched.
  • M3, M5 frontmatter keys are dropped, times move to ISO +05:30, empty last edited: is filled from the file time, and aliases stay.
  • M4 unreferenced ^ids are stripped. M6 conflict copies are not migrated. M7 tasks blocks are stripped and listed.
  • M8 only notes and the files they link to move.
  • Safety: the v0 Home is only read. The same input always gives the same bytes. A file edited after a run is never overwritten unless asked.

Tests: 22 new tests cover every rule on synthetic v0 Homes, plus idempotency (same dir and a fresh dir), the edited-file guard and dry runs. The whole workspace passes: 152 tests, clippy -D warnings clean.

Real data on staging (read-only copy off prod):

  • 693 notes migrated, all adopted by a real calternal serve with day-* ids.
  • A second run is a no-op.
  • Debian and Nix builds produce byte-identical output.
  • The summary (counts only) is on #12.
  • The migrated Home is at /mnt/hdd/calternal-migrate/home on calternal-staging. It is installed into kayg's next account only after the account exists, with the service stopped (see crates/migrate-v0/README.md).

🤖 Generated with Claude Code

https://claude.ai/code/session_018Yyy8fQGxPLkLa8v8NXz7T

Part of #12 (step 2: the tool plus a dry run on staging). `calternal migrate-v0 --from <v0 user dir> --to <home> --report <file> [--dry-run] [--overwrite-edited]`, a new crate `crates/migrate-v0` implementing kayg's decisions M1-M9 (ADR 0034 updated). - **M1** day notes become `YYYY-MM-DD.md` with id `day-YYYY-MM-DD` (the same id the daily-notes plugin derives, agreed with #8), and v0's generated daily heading and title are removed. Other notes become `<Title>.md` (from `title:`, then the H1, then the file name), with a number added when names clash. - **M2** links are repaired by file name, date, title, slug or alias and written as `[t](<Note.md>)`. Unmatched links stay as written and are reported. `[[wikilinks]]` always become standard links. Code blocks and inline code are never touched. - **M3, M5** frontmatter keys are dropped, times move to ISO +05:30, empty `last edited:` is filled from the file time, and `aliases` stay. - **M4** unreferenced `^ids` are stripped. **M6** conflict copies are not migrated. **M7** `tasks` blocks are stripped and listed. - **M8** only notes and the files they link to move. - **Safety:** the v0 Home is only read. The same input always gives the same bytes. A file edited after a run is never overwritten unless asked. **Tests:** 22 new tests cover every rule on synthetic v0 Homes, plus idempotency (same dir and a fresh dir), the edited-file guard and dry runs. The whole workspace passes: 152 tests, clippy `-D warnings` clean. **Real data on staging (read-only copy off prod):** - 693 notes migrated, all adopted by a real `calternal serve` with `day-*` ids. - A second run is a no-op. - Debian and Nix builds produce byte-identical output. - The summary (counts only) is on #12. - The migrated Home is at `/mnt/hdd/calternal-migrate/home` on calternal-staging. It is installed into kayg's next account only after the account exists, with the service stopped (see `crates/migrate-v0/README.md`). 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_018Yyy8fQGxPLkLa8v8NXz7T
Migration: calternal migrate-v0 moves v0 notes into a new Home
All checks were successful
CI / rust (pull_request) Successful in 45s
CI / web (pull_request) Successful in 53s
ba72d680ba
Implements kayg's decisions M1-M9 (#12): day notes become YYYY-MM-DD.md
with id day-YYYY-MM-DD, other notes <Title>.md; links repaired by file
name, date, title, slug or alias and written as [t](<Note.md>), the rest
kept and reported; wikilinks always become standard links; navigation
keys, uid/type/slug/calternal-events/calternal-reminders dropped; dates
to ISO +05:30, empty last edited filled from the file time; unreferenced
^ids and tasks query blocks stripped; conflict copies not migrated; only
notes and the files they link to move.

The v0 Home is only read. Same input, same bytes; files edited after a
run are never overwritten without --overwrite-edited. Code is never
rewritten. ADR 0034 updated.

Part of #12

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018Yyy8fQGxPLkLa8v8NXz7T
Author
Owner

Superseded by #51: rebased onto dev after #46 and #47, plus calternal user create.

Superseded by #51: rebased onto dev after #46 and #47, plus `calternal user create`.
kayg closed this pull request 2026-10-13 19:04:42 +00:00
All checks were successful
CI / rust (pull_request) Successful in 45s
CI / web (pull_request) Successful in 53s

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
kayg/calternal!48
No description provided.