lplalbert opened a new pull request, #421:
URL: https://github.com/apache/hugegraph-ai/pull/421
## What
`GraphQueryNode` subgraph-knowledge assembly loses and duplicates vertices
(the `may lack some single vertex` TODO):
1. **Duplicate representations of the same vertex.**
`_format_graph_from_vertex` (vertex query) and `_process_vertex` (path
traversal) formatted the same vertex differently — falsy-prop filtering and
`max_v_prop_len` truncation applied in one path only — so set-based dedup
missed and rerank buckets carried both `A{name: alice}` and `A{name: alice,
role: }`.
2. **Lost single vertices.** A matched vertex that no path reached (isolated
under the edge-label/depth constraints) entered `graph_result` only when no
path existed at all; with any path present it silently vanished from the
knowledge.
## Approach
- One canonical `_format_props_str` renderer feeds vertex, edge and
standalone formatting, so the same element always formats to the same string
and set membership dedups globally.
- New `_merge_vertex_knowledge` folds matched vertices into the path results
by coverage: a vertex already represented in the paths keeps its path entry; an
uncovered one stays as standalone knowledge (this also covers the empty-paths
case). The stale TODO is removed.
## Validation
- New `src/tests/nodes/hugegraph_node/test_graph_query_node.py` (4 tests:
cross-source dedup, isolated-vertex retention, covered-vertex no-standalone
entry, empty-paths regression). Red before the fix (formatting assertion +
missing merge behavior), green after.
- `SKIP_EXTERNAL_SERVICES=true uv run pytest src/tests/operators/
src/tests/nodes/ src/tests/integration/test_graph_rag_pipeline.py` — 250
passed, 5 subtests passed.
- `ruff format --check` / `ruff check` clean on touched files; `ty check` on
`nodes` + `tests/nodes` reports 106 diagnostics, identical to the main baseline
for those paths (none in touched code).
Refs #107
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]