Skip to content

Reject blank external id values so unrelated entities never merge - #526

Closed
saurav-shakya wants to merge 6 commits into
hydra-db:mainfrom
saurav-shakya:fix/blank-external-id-values
Closed

saurav-shakya wants to merge 6 commits into
hydra-db:mainfrom
saurav-shakya:fix/blank-external-id-values

Conversation

@saurav-shakya

@saurav-shakya saurav-shakya commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

An external id value that is empty or whitespace now raises invalid_argument (field external_ids) on create, update, and insert.facts in both SDKs, like a blank key. A blank value can no longer be stored, so two unrelated entities can no longer merge through it.

Implementation details

Decisions

  • The check sits in the existing mapping check (_require_str_mapping / requireStrMapping), which every external id write path already calls, right after the blank-key check from fix(write): reject empty external_id keys like properties keys #406. Error text: external_ids values cannot be empty or whitespace.
  • Rejecting on write rather than skipping blank pairs in the resolver keeps resolution unchanged and means a blank value is never stored to match later.

Validation

  • tests/test_entities.py and typescript/test/integration.test.ts: "" and " " through create, update, and insert.facts, checking code, field, and text, and that the stored graph still holds only Ann Lee, with no alias, external id, or merge record. The Python test fails on main.
  • Conformance: external_id_errors compares the code, field, and message from create and insert.facts across both SDKs. It fails against the old Python code.
  • scripts/precheck.py --base origin/main passes; full Python and TypeScript suites pass on Kuzu.

Limits

None.

Linked issue

Closes #524

AI Assistance

Model Effort
Claude Opus 5.5 High

Checklist

  • Implements an issue a maintainer has /approved.
  • Small and scoped to that issue.
  • New errors have a code and hint, the same on API, CLI, and MCP in both SDKs (see AGENTS.md).
  • Breaking changes described below, or none.

Breaking changes

A blank or whitespace external id value now raises ValidationError instead of being stored.


Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

Copilot AI balanced review requested due to automatic review settings November 26, 2026 19:57

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@github-actions

Copy link
Copy Markdown

This PR has no linked approved issue. Open an issue, get it discussed and /approved by a maintainer, then link it here with Closes #N. Closing for now; reopen once linked. (Fastest help: the #pr-discussion channel on Discord.)

Maintainers: reopen this PR to override the gate (it gets the gate-override label).

@github-actions

Copy link
Copy Markdown

This is PR 1 of 10 you may keep open at a time.

@github-actions github-actions Bot closed this Nov 26, 2026
@github-actions

Copy link
Copy Markdown

This PR has no linked approved issue. Open an issue, get it discussed and /approved by a maintainer, then link it here with Closes #N. Closing for now; reopen once linked. (Fastest help: the #pr-discussion channel on Discord.)

Maintainers: reopen this PR to override the gate (it gets the gate-override label).

1 similar comment
@github-actions

Copy link
Copy Markdown

This PR has no linked approved issue. Open an issue, get it discussed and /approved by a maintainer, then link it here with Closes #N. Closing for now; reopen once linked. (Fastest help: the #pr-discussion channel on Discord.)

Maintainers: reopen this PR to override the gate (it gets the gate-override label).

@saurav-shakya

Copy link
Copy Markdown
Contributor Author

@arrry-hydraDB review pls

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A blank external id value counts as an identity: unrelated entities with {"crm": ""} merge at confidence 1.0

2 participants