Skip to content

Improve recovery UX for blocked mdbase v0.2 migration rollback - #2693

Merged
callumalpass merged 1 commit into
mainfrom
mdbase-migration-recovery
Nov 24, 2026
Merged

callumalpass merged 1 commit into
mainfrom
mdbase-migration-recovery

Conversation

@callumalpass

Copy link
Copy Markdown
Owner

Summary

Improves recovery when an interrupted mdbase v0.2 -> v0.3 metadata migration leaves .tasknotes/migrations/mdbase-v0.2-pending.json behind and automatic rollback is blocked by a concurrent change to _types/task.md (or another managed metadata file).

Changes

  • Structured recovery state & safety fence (src/services/MdbaseSpecService.ts)
    • Records structured pending v0.2 recovery state (PendingV02MigrationRecovery) with the blocked metadata path(s), verified backup folder, reason (concurrent-change, backup-mismatch, invalid-journal, error), and whether backup restore is safe to offer (canRestoreBackup).
    • Preserves the safety fence: never silently overwrites concurrently changed metadata files or deletes backup folders, and refuses backup restore if the journal is invalid or backup copies do not match.
    • Replaces the repeated raw Error: notice wall on startup/settings saves with a calm, deduplicated notice pointing to Settings → TaskNotes → TaskNotes App.
    • Adds explicit user-confirmed recovery methods:
      • keepCurrentFilesAndResumeV02Migration(): removes only .tasknotes/migrations/mdbase-v0.2-pending.json, keeps current files and backups intact, and resumes canonical metadata sync if mdbase.yaml is valid v0.3.
      • restoreV02MigrationBackup(): re-verifies the pending journal and backup copies, restores the v0.2 metadata snapshots atomically, keeps the backup folder intact, and clears .tasknotes/migrations/mdbase-v0.2-pending.json.
  • Persistent recovery controls (src/settings/native/tasknotesApp.ts, styles/settings-view.css)
    • Adds a persistent Metadata upgrade recovery group at the top of Settings → TaskNotes → TaskNotes App when recovery is pending, naming the blocked file(s) and backup folder in plain language.
    • Provides confirmed Keep current files and resume and (only when backups are verified) destructive-confirmed Restore v0.2 backup actions.
  • Translations & release notes (src/i18n/locales/*/messages.po, docs/releases/unreleased.md)
    • Extracted and authored all new UI strings across all 10 supported locales (en, de, es, fr, it, ja, ko, pt, ru, zh).
    • Documented the user-facing change in docs/releases/unreleased.md.
  • Regression tests (tests/unit/services/MdbaseSpecService.test.ts, tests/unit/settings/NativeSettings.tasknotesApp.test.ts)
    • Added tests for blocked rollback startup state and calm deduplicated notices, keeping valid v0.3 files and resuming sync, keeping edited v0.2 files untouched, explicit verified backup restore, unsafe/mismatched backup refusal, and the Settings UI confirmation flows.

Verification

  • npx jest tests/unit/services/MdbaseSpecService.test.ts tests/unit/services/mdbaseSafeWrites.test.ts tests/unit/services/mdbaseRound3Robustness.test.ts tests/unit/bootstrap/mdbaseBootstrapRecognition.test.ts tests/unit/settings/NativeSettings.tasknotesApp.test.ts tests/unit/settings/NativeSettings.test.ts (6 suites, 218 tests passed)
  • npm run lint (test:lint-config, lint:ts, lint:review-types, lint:css, lint:architecture)
  • npm run typecheck
  • npm run i18n:check, npm run test:translation-contracts, npm run test:i18n-source
  • npm run check:obsidian-tokens, npm run build, npm run check:bundle-size

@callumalpass
callumalpass merged commit dc88b1f into main Nov 24, 2026
3 checks passed
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