awslabs / awslabs/graphrag-toolkit
[FEATURE] Improve test coverage: graph builder Cypher generation and VersionManager lifecycle
- Dominant language
- Python
- Stars
- 442
- Forks
- 106
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 41
Description
### Package
lexical-graph
### Problem statement
11 graph builder methods generate Cypher via f-strings. Tests verify call counts but never assert on query string content — structurally invalid Cypher (like #408's `WHERE () AND ...`) passes all tests. `source_graph_builder` has no test file at all. `test_delete_sources.py` and `test_entity_graph_builder_label_injection.py` already assert on query strings — this targets the remaining builders.
`test_version_manager.py` only tests version numbering (get/set/increment/compare). Query generation, source node lookup, lifecycle orchestration, and vector store updates have zero coverage.
Related: #408, #415
### Proposed solution
- Add at least one query-string assertion per builder method (11 total: source, graph_summary, entity, entity_relation, topic, fact, statement, chunk builders + version_manager._get_existing_source_nodes + delete_sources.accept + neo4j_graph_store.init)
- Test VersionManager state transitions: first-time indexing, re-indexing with existing/expired source, accept() lifecycle, error propagation
### Alternatives considered
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.