Description:
Problem
EmbeddingStore in code_review_graph/embeddings.py:357-388 opens a SQLite
connection in init but does not implement enter/exit. If an
exception occurs during usage before .close() is called, the connection leaks.
store = EmbeddingStore(db_path)
store.embed_nodes(nodes) # if this raises, connection is never closed
store.close()
Expected Behavior
Add context manager support, consistent with GraphStore which already
implements this pattern:
class EmbeddingStore:
...
def enter(self):
return self
def __exit__(self, *exc):
self.close()
This enables safe usage:
with EmbeddingStore(db_path) as store:
store.embed_nodes(nodes)
Impact
Connection leaks under error conditions, especially relevant for long-running
processes like watch mode or MCP server.
Description:
Problem
EmbeddingStore in code_review_graph/embeddings.py:357-388 opens a SQLite
connection in init but does not implement enter/exit. If an
exception occurs during usage before .close() is called, the connection leaks.
store = EmbeddingStore(db_path)
store.embed_nodes(nodes) # if this raises, connection is never closed
store.close()
Expected Behavior
Add context manager support, consistent with GraphStore which already
implements this pattern:
class EmbeddingStore:
...
def enter(self):
return self
This enables safe usage:
with EmbeddingStore(db_path) as store:
store.embed_nodes(nodes)
Impact
Connection leaks under error conditions, especially relevant for long-running
processes like watch mode or MCP server.