fix(profile): roll back partial import on checksum/migrate failure#28
Conversation
Bare `?` after step 3 left the new profile row + directory orphaned if `normalise_migration_checksums` or `profile_db::open` errored. Factor the existing cleanup into `cleanup_partial_profile` and call it from all three post-insert failure paths so a failed import always leaves the profile list in the pre-import state.
π WalkthroughWalkthroughThe PR adds consistent best-effort rollback cleanup during archive profile import. A new ChangesArchive import error handling with consistent rollback
Estimated code review effortπ― 2 (Simple) | β±οΈ ~10 minutes Possibly related PRs
Suggested labels
Poem
π₯ Pre-merge checks | β 4 | β 1β Failed checks (1 inconclusive)
β Passed checks (4 passed)
βοΈ Tip: You can configure your own custom pre-merge checks in the settings. β¨ Finishing Touchesπ Generate docstrings
π§ͺ Generate unit tests (beta)
Comment |
Summary
Follow-up to #27. The post-extract steps
normalise_migration_checksumsanddb::profile_db::openused a bare?to propagate errors, which skipped the cleanup that the extract step already performed. A failure there left the freshly insertedprofilerow and the partial profile directory on disk β the user would see a phantom profile in the selector pointing at a half-imported DB.cleanup_partial_profile(state, profile_id).pool.close()on the success path is unchanged.Test plan
cargo check --manifest-path src-tauri/Cargo.toml --all-targetsdata.dbinside a test archive, attempt import, confirm the profile row + directory are gone afterwards._sqlx_migrations, attempt import, confirm the rejection path also cleans up.Summary by CodeRabbit