mirror of
https://github.com/basicmachines-co/basic-memory
synced 2026-06-21 13:47:35 +00:00
e8c11b843d
Three follow-ups from PR review: **Codex P2 — Load sqlite-vec on the delete session.** The previous revision swallowed every `vec0` OperationalError as "no embeddings exist", but sqlite-vec is loaded **per connection**: a pooled connection that hosts ProjectRepository.delete may not have vec0 loaded even when another connection successfully wrote embeddings. That would silently leave orphan vectors behind. The new `_load_sqlite_vec_on_session` helper mirrors SQLiteSearchRepository._ensure_sqlite_vec_loaded as a free function and tries to load the extension on the current session. Only when the load itself fails — because the Python build lacks enable_load_extension, or the sqlite_vec package isn't installed — do we skip the embeddings DELETE. Every connection in the pool shares the same interpreter, so in that case no embeddings could have been written from any connection and skipping is safe. **Claude review — Missing logger.debug calls.** The override now logs at entry, when the project id isn't found, and after the ORM delete, matching the base Repository.delete contract. **Claude review — NoResultFound branch uncovered.** New test `test_delete_returns_false_for_missing_project_id` asserts the False return for a nonexistent project id. Verified locally: 32 passed / 1 skipped (SQLite), 27 passed / 1 skipped (Postgres via testcontainers). Signed-off-by: phernandez <paul@basicmachines.co>