lplalbert opened a new pull request, #422:
URL: https://github.com/apache/hugegraph-ai/pull/422

   Refs #373 (stale claim comment from September had no linked PR - happy to 
yield if someone is actively working on it).
   
   ## Problem (as observed in #373)
   
   A single property value failing the declared-type check dropped the **whole 
vertex** while logging as if only the property was skipped, and edges 
referencing it were sent with the raw local id (e.g. `1:Sarah`), failing with 
`Invalid vertex id`.
   
   ## Approach
   
   - **Lossless coercion first**: numeric strings to numbers, numbers to text, 
integral floats to ints, scalars to single-element LIST/SET collections (then 
each element), strict `yyyy-MM-dd` dates.
   - **Un-coercible nullable property** -> drop just that property (warning), 
keep creating the vertex.
   - **Un-coercible non-nullable / primary-key property** -> skip only that 
vertex with a named reason.
   - **Edges referencing skipped vertices** are skipped with a named reason 
instead of being written with unresolved local ids. Endpoints never seen in 
this import are passed through unchanged - they may legitimately reference 
pre-existing server vertices, so unknown stays unknown rather than being 
treated as invalid (deviation from the issue's strict rule, stated here for 
review).
   - **Partial import + summary**: per-vertex/edge reasons in the logs plus an 
import-summary line. `Failed to create vertex` raises only when *no* vertex 
could be imported at all, and before any edge write.
   
   Adjacent fixes in the same validation boundary: `bool` no longer validates 
as INT (`True` is not a valid number), BLOB validates as text to match its TEXT 
creation mapping, unknown property keys are dropped instead of a `KeyError` 
crash, and unknown data types are reported per property instead of raising out 
of the whole import.
   
   ## Validation
   
   - `SKIP_EXTERNAL_SERVICES=true uv run pytest hugegraph-llm/src/tests/` -> 
1227 passed, 12 skipped (full suite; the 2 known Windows mode-bit failures in 
test_external_config.py are excluded from this branch's config run - actually 
config included, see below), including 6 new tests in 
`test_commit_to_hugegraph*.py` that fail against the old code (red/green 
verified).
   - `ruff format --check` / `ruff check` / `ty check` clean on touched files 
(also fixed the pre-existing Match-vs-bool return in the DATE check that ty 
flagged in the rewritten method).
   
   ## Out of scope (flagged for maintainer decision)
   
   - Edge property coercion (the issue's "Extended Scope") - same helper 
applies, kept as a follow-up.
   - The issue proposes skipping vertices with *missing* non-nullable 
properties; the current code default-fills them with a warning. Kept current 
behavior since it is deliberate and separately pinned.
   - This touches the same function as #416 (identity handling); whichever 
lands second gets a rebase - no semantic conflict expected.
   
   🤖 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]

Reply via email to