fix(local): publish DBM migrations only after successful conversion - #1442
Kuang-xianxin wants to merge 1 commit into
Conversation
✅ Deploy Preview for poetic-froyo-8baba7 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughThe migration now writes SQLite data in a temporary directory and publishes the completed database by replacement. It opens the legacy DBM store in read-only mode and closes resources through context managers. Failed migrations leave the legacy store available for retry and do not create a partial destination. A new test covers failure, retry, point loading, and legacy-file cleanup.
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to The migration preserves the legacy store until a completed SQLite database is published, and failed conversions can be retried without exposing a partial destination. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
If DBM-to-SQLite migration fails after opening the destination, it leaves
storage.sqlitebehind. The next collection open treats that file as a completed migration and silently skips the points still instorage.dbm.Build the SQLite database in a temporary directory beside the destination, commit and close both stores, then publish the completed file with
Path.replace. The legacy store is opened read-only and removed only after publication. Exceptions close the handles and remove the staging files, allowing a later open to retry.The regression uses real DBM and SQLite files: a malformed legacy key aborts migration; after repairing that key, opening the store again recovers every valid point. It fails on the unmodified
devimplementation. This addresses the recovery limitation noted in #1335; its separate logging-format change remains outside this PR.Validation on Windows / Python 3.13.14: the regression and 10 other applicable persistence/in-memory tests pass. The two complete files report 11 passed and 4 failures; the same four failures reproduce on unmodified
da05a2b(existing Windows collection-deletion/open-handle behavior). Scoped Ruff lint/format, source Mypy, andgit diff --checkpass. No server-backed integration suite was run.All Submissions
dev.Changes to Core Features