fix(local): pass the migration error as a logging format arg - #1335
fix(local): pass the migration error as a logging format arg#1335Anai-Guo wants to merge 1 commit into
Conversation
`logging.error("...:", e)` hands the exception to the logging module as a
%-format argument for a message that has no placeholder, so `record.getMessage()`
raises `TypeError: not all arguments converted during string formatting`.
logging swallows that into a `--- Logging error ---` traceback, so the one line
that says what actually went wrong during the dbm -> sqlite migration is lost.
✅ 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: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe migration failure log now passes the caught exception to the logging API as a Estimated code review effort: 1 (Trivial) | ~2 minutes Mergeability Score: ⚪ Minimal · up to This localized change only fixes error reporting during migration without changing control flow; no actionable merge-blocking risk remains after normal checks and review. 🚥 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 |
Problem
qdrant_client/local/persistence.py, in the dbm → sqlite migration path:The message has no
%placeholder, sologgingtreatseas a stray %-format argument andrecord.getMessage()raises.loggingcatches that internally and prints a--- Logging error ---traceback instead of the message — so the one line naming what actually failed is replaced by noise, exactly when a user's local storage is failing to migrate.Reproduced on Python 3.12 with a
ValueError("disk image is malformed"):Fix
Add the
%splaceholder so the exception is interpolated instead of being passed as an unused argument. One character of behaviour change; the followinglogging.error(...)and theraise eare untouched, so control flow is identical.I scanned the rest of
qdrant_clientfor the same shape (logger.<level>with a constant message whose placeholder count doesn't match the number of positional args) — this is the only occurrence.Note, not addressed here
While reading this function: if the migration raises after
sqlite3.connect(str(sql_path))has created the file, a partially-populatedstorage.sqliteis left on disk. The next call then hitsif sql_path.exists(): returnat the top and skips migration silently, so the remaining points instorage.dbmare never carried over. Whether to unlink the partial file, migrate to a temp path and rename, or leave it as-is is a maintainer call, so I left it out of this PR — happy to open a separate issue if it's worth tracking.Branched from
devper CONTRIBUTING.🤖 Generated with Claude Code