awslabs / awslabs/graphrag-toolkit
[FEATURE] Improve test coverage: graph_utils boundary cases and Cypher escaping
- Dominant language
- Python
- Stars
- 442
- Forks
- 106
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 41
Description
### Package
lexical-graph
### Problem statement
`graph_utils.py` functions lack boundary and edge-case test coverage. `test_graph_utils.py` covers happy paths; `test_graph_utils_injection.py` covers basic injection patterns (6 tests). The remaining gaps:
- `parse_metadata_filters_recursive`: NOT + empty filters, 3-level nesting, mixed children types
- `escape_cypher_label`: empty string, only-backtick, newline inputs
- `formatter_for_type`: empty string input
- Adversarial escaping: unicode null bytes, homoglyphs, oversized keys (10KB+), newlines in keys, nested backtick+quote combos, values containing Cypher syntax, non-string metadata values
Related: #408, #415
### Proposed solution
Extend `test_graph_utils.py` and `test_graph_utils_injection.py` with the above edge cases.
### Alternatives considered
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.