bosprimigenious opened a new issue, #397:
URL: https://github.com/apache/hugegraph-ai/issues/397

   ### Bug Type
   data inconsistency in the local PropertyGraphExtract operator
   
   ### Before submit
   - [x] Searched open/closed issues, PRs and relevant comments for 
numeric/zero/falsy/custom IDs. #331/#361 concern earlier normalization/import 
property changes; their current parser still reproduces this. No overlapping 
parser fix found. This is independent of the Ontogeny proposal #376 and 
implementations #380/#391.
   
   ### Environment
   - hugegraph-ai main: 3cea006825b49f7a66e47d9926501b1060069e7b
   - Python 3.12.6, macOS arm64; uv-managed local operator/test dependencies 
from the declared manifest ranges; no tracked uv.lock on this base
   - No graph server or real model call. The deterministic text-producing 
object below only supplies JSON to the actual operator.
   
   ### Expected & Actual behavior
   Given vertices 0 and 1 and an edge 0 -> 1, PropertyGraphExtract.run keeps 
both vertices but silently drops the edge. Integer 0 is tested with truthiness 
in the vertex map, endpoint resolution and normalized-edge filter. The same 
issue prevents a model-generated numeric alias 0 from resolving to a 
PRIMARY_KEY canonical ID.
   
   CUSTOMIZE_NUMBER validation in HugeGraph GraphTransaction.checkId requires a 
non-null numeric ID and LongId stores the long value; this is source-contract 
evidence, not a claim of live server insertion.
   
   ### Vertex/Edge example and Schema
   Run from the module development environment:
   
   ```python
   import json
   import socket
   from types import SimpleNamespace
   
   connections=[]
   def reject_connect(self,address):
       connections.append(repr(address))
       raise AssertionError("No network allowed in the reproduction")
   socket.socket.connect=reject_connect
   
   from hugegraph_llm.operators.llm_op.property_graph_extract import 
PropertyGraphExtract
   
   
schema={"vertexlabels":[{"name":"person","id_strategy":"CUSTOMIZE_NUMBER","primary_keys":[],"properties":[],"nullable_keys":[]}],"edgelabels":[{"name":"knows","source_label":"person","target_label":"person","properties":[]}]}
   
graph={"vertices":[{"id":0,"label":"person","properties":{}},{"id":1,"label":"person","properties":{}}],"edges":[{"label":"knows","outV":0,"outVLabel":"person","inV":1,"inVLabel":"person","properties":{}}]}
   response=json.dumps(graph)
   model=SimpleNamespace(generate=lambda **kwargs: response)
   
result=PropertyGraphExtract(llm=model).run({"schema":schema,"chunks":["Vertex 
zero knows vertex one."]})
   
print(json.dumps({"vertices":result["vertices"],"edges":result["edges"],"call_count":result["call_count"],"network_attempts":connections},indent=2))
   assert len(result["edges"])==1, "A valid edge from CUSTOMIZE_NUMBER vertex 0 
was dropped"
   assert result["edges"][0]["outV"]==0 and type(result["edges"][0]["outV"]) is 
int
   ```
   
   Actual: `vertices` retains ID 0 and ID 1, `edges` is `[]`, then the 
assertion fails. Expected: one edge whose outV is integer 0 and inV is integer 
1. The socket guard records zero connections.
   
   ### Proposed narrow fix and verification
   Treat integer 0 as present in the existing ID-normalization path while 
preserving rejection of None, empty strings and False. No model/API/dependency 
or SDK changes. Ten regressions give 4 failures/6 passes on the original 
source; after the fix, the complete operator test file gives 46 passes (one 
existing Pydantic warning). Seven extra local parser boundary controls also 
pass. Whole-repository Ruff format/check and scoped ty pass.
   
   Full acceptance is NOT READY: an additional HTTP integration collection 
fails because the lightweight environment lacks fastapi; the full application 
environment, coverage/matrix, live HugeGraph insertion and provider tests are 
unverified. In particular this does not fix the separate existing numeric-ID 
write-through limitation in CommitToHugeGraph.
   
   AI disclosure: reproduction, patch and this text were prepared with OpenAI 
Codex. No human review or end-to-end graph/provider verification is claimed.
   


-- 
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]

Reply via email to