feat(lexical-graph): invoke graph_store init hook#185
feat(lexical-graph): invoke graph_store init hook#185zollie wants to merge 1 commit intoawslabs:mainfrom
Conversation
|
LexicalGraphQueryEngine creates a MultiTenantGraphStore via the same factory pattern but doesn't call init(). The indexes created by init() are needed for queries too — should the query engine also invoke the hook? |
| tenant_id = to_tenant_id(tenant_id) | ||
|
|
||
| self.graph_store = MultiTenantGraphStore.wrap(GraphStoreFactory.for_graph_store(graph_store), tenant_id) | ||
| self.graph_store.init() |
There was a problem hiding this comment.
self.graph_store.init() is called inside init() with no exception handling. Both Neo4jGraphStore.init() and the new FalkorDBDatabaseClient.init() (PR #186) perform network I/O. If the database is unreachable at construction time, the exception prevents self.tenant_id, self.extraction_dir, and the extraction pipeline from being set — leaving the object in a partially constructed state. This is a behavioral change for users who construct the index before the database is available.
| assert extraction_config.extraction_llm == llm_cache No newline at end of file | ||
| assert extraction_config.extraction_llm == llm_cache | ||
|
|
||
| class TestLexicalGraphIndex: |
There was a problem hiding this comment.
Would be worth adding a test for the failure case (graph_store.init.side_effect = Exception(...)) to document the expected behavior.
Invoke existing graph_store.init() lifecycle hook during LexicalGraphIndex initialization, so backend bootstrap logic (if implemented) runs automatically. No API change; no-op for stores that don’t override init().
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.