Skip to content

feat(lexical-graph): invoke graph_store init hook#185

Open
zollie wants to merge 1 commit intoawslabs:mainfrom
zollie:feat/graph-store-init-hook-upstream-pr
Open

feat(lexical-graph): invoke graph_store init hook#185
zollie wants to merge 1 commit intoawslabs:mainfrom
zollie:feat/graph-store-init-hook-upstream-pr

Conversation

@zollie
Copy link
Copy Markdown
Contributor

@zollie zollie commented Apr 4, 2026

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.

@mykola-pereyma
Copy link
Copy Markdown
Contributor

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()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be worth adding a test for the failure case (graph_store.init.side_effect = Exception(...)) to document the expected behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants