fix: address all 21 code review issues for MM-72 SQLite migration
CRITICAL (5):
- Add DbError::InvalidUrl variant to distinguish URL parsing failures from pool-open failures
- Remove #[from] on DbError::Pool, add explicit error handling at each call site
- Add DbError::Setup.step field to provide detailed context (4 distinct failure stages)
- Update run_migrations doc comment to accurately describe bootstrap vs transaction scope
- Update DbError::Setup doc comment to list all 4 failure stages (bootstrap DDL, fetch versions, begin, commit)
IMPORTANT (9):
- Extract db_url normalization into to_sqlite_url() function with comprehensive unit tests
- Fix i32/u32 type mismatch: fetch as i64, convert with u32::try_from(), bind as i64
- Add tracing::info!() at: migrations start, each migration apply, commit success; debug for no-op
- Add tracing::error!() before fatal errors propagate to main() eprintln
- Update migration failure context to include database URL
- Add test for server_metadata PRIMARY KEY uniqueness constraint enforcement
- Add tracing::warn!() for relative-path URL normalization (CWD sensitivity)
- Fix open_pool doc: 're-issues' not 'tracks' for WAL PRAGMA behavior
- Update db/CLAUDE.md Guarantees section to accurately describe bootstrap vs transaction scope
MINOR (7):
- Document that commit() failure triggers Drop rollback; no partial schema, safe to re-run
- Document that pool creation succeeds even if file path is invalid; failure surfaces at first query
- Add distinct purpose doc to migrations_apply_on_first_run (row count = 1 after first run)
- Add doc comment to select_one_succeeds explaining it's a pool-connectivity smoke test
- Strengthen applied_at assertion: check length=19 and ISO-8601 format (starts with '20')
- Remove duplicate '// pattern: Imperative Shell' comment from top of db/mod.rs
- Consolidate duplicate #[allow(dead_code)] comments in AppState struct
All tests pass; build clean; clippy and fmt verified.
authored by
malpercio.dev
and committed by