lplalbert opened a new pull request, #416:
URL: https://github.com/apache/hugegraph-ai/pull/416
Refs #397, #166 (Tiny Task)
## What
`Commit2Graph.load_into_graph` uses truthiness checks where absence is
meant, so
legitimate 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-side
instances below were still open:
- a vertex whose single primary-key value is `0` is dropped with
"Primary-key missing"; multi-key vertices log a spurious "mark empty"
warning
and have the value reset to the type default
- a vertex with explicit id `0` falls back to the composite mapping key, and
`if mapping_id:` never records the `0` → server-vid mapping, so edges with
integer-zero endpoints are written against raw id `0`
## Changes
- Treat only `None` as 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`).
- The `CUSTOMIZE_STRING` guard still ignores empty/False custom ids on
purpose
(those fall back to server-generated ids) — unchanged.
- Regression tests in `test_commit_to_hugegraph_load_into_graph.py` for all
three
instances.
## Validation (actually run; offline only)
- red→green (stash-demonstrated): 3 new tests fail on the old code — the
failure
output shows the bug directly ("Primary-key 'code' missing in vertex
{'code': 0}",
`add_edge` receiving raw `0` endpoints) → whole file passes after
- `SKIP_EXTERNAL_SERVICES=true uv run pytest
src/tests/operators/hugegraph_op/` → 52 passed
- `ruff format --check` / `ruff check` → clean (588 files)
- `ty check` → 271 (same as current `main`); the only hits mentioning this
file are
2 pre-existing ones in untouched helpers
- Real-provider verification: none (offline tests only; no local HugeGraph
instance
was exercised)
Refs #397
Refs #166
🤖 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]