test(core): regression guard for vector-row cleanup on entity delete (#764)#771
test(core): regression guard for vector-row cleanup on entity delete (#764)#771phernandez merged 2 commits intomainfrom
Conversation
…764) The delete-path cleanup the reporter asked for already shipped in PR #733 ("clean up delete vectors and cloud sync", merged 2026-04-10): handle_delete calls _clear_entity_vectors which delegates to repository.delete_entity_vector_rows. Issue #764 was filed two weeks later without referencing #733, so this PR locks the wiring in with a regression test. The test spies on the repository's delete_entity_vector_rows and asserts handle_delete invokes it with the entity id. monkeypatch flips _semantic_enabled=True so we exercise the real delegation rather than the no-op short-circuit that fires when semantic is disabled. The two follow-up comments on #764 describe distinct issues that are out of scope here: - pavelasm: project info doesn't surface orphaned vector embeddings. Reporting gap for pre-existing drift, not a delete-path bug. - natedev: the watch service single-file sync path doesn't refresh vectors on update. Different code path (sync_service.sync_file), not delete-related. Both should land as separate issues. Closes #764 Signed-off-by: phernandez <paul@basicmachines.co>
|
Claude finished @phernandez's task in 1m 21s —— View job PR Review
This is a clean, focused regression test. The implementation is sound and aligns with project conventions. A few observations below. Code Quality & Standards
Testing & Documentation
Minor Observations
monkeypatch.setattr(
search_service.repository, "_semantic_enabled", True, raising=False
)Using Spy return type is Architecture & Compatibility
SummaryThe test is well-scoped, documents the regression risk clearly, and exercises the right wiring. The |
The repository instance under test always exposes `_semantic_enabled`, so `raising=False` was masking a hypothetical rename rather than guarding against a real condition. Use the default raising=True so a future rename or removal fails loudly at the patch site instead of mutating drift downstream. Signed-off-by: phernandez <paul@basicmachines.co>
|
Claude finished @phernandez's task in 41s —— View job PR Review
The follow-up commit ( Code Quality & Standards
Testing & Documentation
Basic Memory Architecture
Security & Performance
Compatibility
SummaryClean regression test, well-scoped, and the |
Summary
handle_delete→_clear_entity_vectors→repository.delete_entity_vector_rows.What the test does
Spies on
repository.delete_entity_vector_rowsvia monkeypatch, callshandle_delete, asserts the spy was called with the entity id. Forces_semantic_enabled=Trueso we exercise the real delegation rather than the no-op short-circuit.Out of scope (filed in the issue, will land separately)
search_vector_embeddingsrows from pre-fix DBs. Reporting gap, not a correctness bug.sync_service.sync_file), unrelated to the delete-path issue.I'll recommend in the issue comment that those land as separate issues so they get individual triage.
Test plan
pytest tests/services/test_search_service.py::test_handle_delete_clears_entity_vectors --no-cov— passestest_delete_entity_without_permalinkstill passesruff checkcleanCloses #764
🤖 Generated with Claude Code