Repository navigation
Conversation
Commit2Graph.load_into_graph used truthiness checks where absence was meant, silently losing legitimate zero values (same bug class as apache#397, which apache#398 fixes on the extraction side): - a vertex whose single primary-key value is 0 was dropped with 'Primary-key missing'; multi-key vertices logged a spurious 'mark empty' warning and had the value reset to the type default - a vertex with explicit id 0 fell back to the composite mapping key, and 'if mapping_id:' never recorded the 0 -> server-vid mapping, so edges with integer-zero endpoints were written against raw id 0 Treat only None as absent for primary-key values and declared ids. The CUSTOMIZE_STRING guard still ignores empty/False custom ids on purpose (those fall back to server-generated ids). Co-Authored-By: Claude Code <noreply@anthropic.com>
bitflicker64
left a comment
There was a problem hiding this comment.
Blocking: yes. Summary: The 0 id and primary-key fixes work, and the new tests fail on the base and pass here. Narrowing the check to is None also lets an empty-string primary key through, which merges distinct vertices into one.
| # 2. Handle primary-keys mode vertex | ||
| for pk in primary_keys: | ||
| if not input_properties.get(pk): | ||
| if input_properties.get(pk) is None: |
There was a problem hiding this comment.
Important: a single-key vertex with "" as its primary key was skipped before and is written now, so every such vertex of a label maps to the same server id and their edges all attach to that one vertex. Treat "" as missing too (value is None or value == ""), matching primary_key_id in hugegraph_llm_sdk/graph_utils.py, and add a test for it.
An empty-string primary key or declared id carries no identity: distinct vertices would collide on the same vid_mapping key and merge their edges. Treat "" as absent for pk values (skip single-pk vertices, mark-empty for composite keys) and fall back to the composite mapping for empty declared ids, matching the extraction layer's truthy-id checks. Zero and False stay values. Co-Authored-By: Claude Code <noreply@anthropic.com>
|
Agreed — pushed (17bd04c). Root cause: Fix: Tests: three regressions in |
bitflicker64
left a comment
There was a problem hiding this comment.
Blocking: no. Score: 9/10. Summary: load_into_graph keeps 0 ids and primary keys and still treats "" as absent, matching primary_key_id; the new tests fail on the base and pass here.
imbajin
left a comment
There was a problem hiding this comment.
Score: 8.0/10 · Confidence: medium
Blocking: no
Summary
The loader now retains zero-valued primary keys and maps zero IDs; the earlier empty-string collision is addressed. Approval is deferred until the write path is exercised against HugeGraph.
Evidence
Reviewed the loader, extraction caller, regression tests and existing review thread. Current-head LLM and quality CI passed; the author reports offline tests.
Validation notes
No independent live HugeGraph write or edge-resolution test was run; the upstream extraction path has separate pre-existing zero endpoint limitations.
|
Acknowledged — and the deferral is fair: verification at What the offline evidence pins (regressions fail on the pre-fix tree and pass at this head, against a mocked What it does not pin: the write path against a live HugeGraph server — real The upstream extraction path's zero endpoint limitations you note are separate and pre-existing — this PR owns the loader side only (refs #397/#166) and leaves extraction unchanged. |
Refs #397, #166 (Tiny Task)
What
Commit2Graph.load_into_graphuses truthiness checks where absence is meant, solegitimate zero values are silently lost. This is the same bug class as #397 —
while #398 fixes the extraction side (
property_graph_extract.py), the load-sideinstances below were still open:
0is dropped with"Primary-key missing"; multi-key vertices log a spurious "mark empty" warning
and have the value reset to the type default
0falls back to the composite mapping key, andif mapping_id:never records the0→ server-vid mapping, so edges withinteger-zero endpoints are written against raw id
0Changes
Noneas absent for primary-key values (input_properties.get(pk) is None)and declared ids (
mapping_id is None), and record every declared id mapping(
if mapping_id is not None).CUSTOMIZE_STRINGguard still ignores empty/False custom ids on purpose(those fall back to server-generated ids) — unchanged.
test_commit_to_hugegraph_load_into_graph.pyfor all threeinstances.
Validation (actually run; offline only)
output shows the bug directly ("Primary-key 'code' missing in vertex {'code': 0}",
add_edgereceiving raw0endpoints) → whole file passes afterSKIP_EXTERNAL_SERVICES=true uv run pytest src/tests/operators/hugegraph_op/→ 52 passedruff format --check/ruff check→ clean (588 files)ty check→ 271 (same as currentmain); the only hits mentioning this file are2 pre-existing ones in untouched helpers
was exercised)
Refs #397
Refs #166
🤖 Generated with Claude Code