Skip to content

fix(llm): preserve integer-zero vertex IDs - #398

Open
bosprimigenious wants to merge 1 commit into
apache:mainfrom
bosprimigenious:fix/zero-numeric-vertex-id-20261105
Open

bosprimigenious wants to merge 1 commit into
apache:mainfrom
bosprimigenious:fix/zero-numeric-vertex-id-20261105

Conversation

@bosprimigenious

@bosprimigenious bosprimigenious commented Nov 4, 2026 •

Copy link
Copy Markdown

Summary

Closes #397.

PropertyGraphExtract currently retains integer-zero vertices but silently discards their edges. A model-generated alias 0 also fails to resolve to a PRIMARY_KEY ID.

- treat every falsy ID as missing
+ recognize integer 0 while keeping False/None/empty-string rejection

Use the same internal presence predicate for mapping vertices, resolving endpoints and filtering normalized edges. No public API, model, SDK, dependency or prompt change; this restores the existing single-operator ID contract rather than introducing a multi-file feature or cross-module design. The staged feature workflow is not claimed as approved.

Evidence

  • Before: final 10 new regression cases against byte-identical original source: 4 fail, 6 pass; the public run path drops an otherwise valid edge.
  • After: entire operator test file 46 pass, one existing Pydantic class-config deprecation warning. Covers outgoing/incoming/self-loop integer zero, negative/ordinary/string controls, absent/False IDs, and a PRIMARY_KEY numeric alias.
  • Seven additional local operator boundary controls pass, including False/0 dictionary-key collision controls, missing zero vertices and integer/string zero distinction. Socket guard observes 0 connections.
  • Whole repository ruff check . and ruff format --check . pass (581 files); ty check on the changed source passes. Manifest ranges are unchanged, and this base has no tracked uv.lock.
  • Python 3.12.6, uv-managed lightweight operator environment with exact resolved package inventory retained locally. Tests use the existing deterministic FakeLLM fixture, not a live provider.

Configured required CI gates passed; ready for maintainer review. Exact-head workflow 41877038653 attempt 2 tests synthetic merge 9cac8ed with parents [3cea0068, 7f347be3]. Raw logs confirm:

  • Python 3.12 unit/contract suite: 1384 passed, 3 skipped, 18 deselected, 5 subtests passed; coverage 64.97%, above the configured 34% threshold. All ten new regressions passed.
  • The 22 existing HTTP custom-ID contract cases which could not collect in the lightweight local environment all pass in CI.
  • Real HugeGraph Server 1.8.0 was verified and 16 boundary/smoke tests passed. This is not live provider/model verification.
  • Full-root format/check and required quality checks, license headers, CodeQL (538/538 Python files scanned), and CI Result pass. Unselected client/SDK/MCP/dependency jobs were skipped, not counted as passed.

Remaining failures and scope: the full LLM ty step reports 303 diagnostics and exits 1. This step is explicitly advisory (continue-on-error: true) in the repository workflow; it is not a passed type check and is not hidden by the aggregate success. The changed source's scoped ty check passes. Only the configured Linux/Python 3.12 CI leg was exercised; no broader platform/provider matrix is claimed. The separate existing numeric-ID write-through limitation in CommitToHugeGraph remains outside this PR, which only restores local extraction and alias resolution.

Merge Danger

Door: two-way; no migration or stored-data changes.

Blast Radius: extraction. Integer-zero references can now retain edges that were previously discarded; existing nonzero/string IDs and invalid/missing-ID controls remain covered. This is not general ID validation and does not newly accept float 0.0.

AI disclosure: patch, tests, analysis and this prose were prepared with OpenAI Codex. No human review is claimed. This independent bug is separate from the Ontogeny scope in #376/#380/#391, which already has public implementations.

Existing ID truthiness checks silently discard edges and primary-key
aliases using integer zero. Keep zero without accepting False as an ID.

Fixes apache#397

Signed-off-by: bosprimigenious <bosprimigenious@foxmail.com>
Generated-by: OpenAI Codex
@github-actions github-actions Bot added the llm label Nov 4, 2026
@bosprimigenious
bosprimigenious marked this pull request as ready for review November 4, 2026 18:29

@bitflicker64 bitflicker64 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking: no. Score: 9/10. Summary: _has_vertex_id treats integer 0 as present in the vertex map, endpoint lookup and edge filter, while None, "", False and float 0.0 stay rejected, so 0 -> 1 edges and a 0 alias on a PRIMARY_KEY vertex survive extraction. Four of the new cases fail against the base source and all 46 pass at this head, and CI is green.

@bosprimigenious

Copy link
Copy Markdown
Author

Hi @bitflicker64 — thanks again for the approval. Is there anything else you'd like on this one before it can land (more instances in the regression set, a different assertion shape, or a changelog/version bump for the module)? Happy to adjust; otherwise it should be ready to merge.

@imbajin imbajin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Score: 8.0/10 · Confidence: medium

Blocking: no

Summary

No new actionable finding in the extraction and alias-resolution changes. The shared presence predicate preserves integer zero while continuing to reject False, missing or empty IDs, and floating-point zero.

Evidence

Checked vertex normalization, endpoint resolution and normalized-edge filtering at this head. Eight isolated cases exercised the actual presence predicate. Current LLM, quality, CodeQL and CI Result checks are successful.

Validation notes

No local full operator suite or live database write-through was independently run. The downstream loader's pre-existing CUSTOMIZE_NUMBER handling remains outside this patch; extraction-only checks do not establish end-to-end numeric-ID writes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] PropertyGraphExtract drops edges with integer vertex ID 0

3 participants