Skip to content

Match entity types case-insensitively during entity resolution - #180

Merged
arrry-hydraDB merged 1 commit into
hydra-db:mainfrom
kruschdev:fix/resolution-type-case
Nov 16, 2026
Merged

arrry-hydraDB merged 1 commit into
hydra-db:mainfrom
kruschdev:fix/resolution-type-case

Conversation

@kruschdev

@kruschdev kruschdev commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Compare entity types through _ops.entity_type_key (ops.entityTypeKey in TypeScript) everywhere in src/selfgraph/resolution.py and typescript/src/resolution.ts, including DefaultResolver, LLMResolver, compatible_types, fallback-type handling, and plan_resolution.
  • Scan L_ENTITY with equals={} and filter via entity_type_key when entities_matching is not used so stores with exact-match node property filters still surface type-compatible candidates regardless of casing.
  • Add mirrored regression tests in tests/test_resolution.py and typescript/test/resolution.test.ts covering cross-batch, within-batch, default, fuzzy, llm, fallback-type, and schema hierarchy/alias resolution.

Linked issue

Closes #163

AI Assistance

Model Effort
Gemini 4 Carbon / Hydrogen High

Checklist

  • Implements an issue a maintainer has /approved.
  • Small and scoped to that issue.
  • Breaking changes described below, or none.

Breaking changes

None.


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

@github-actions

Copy link
Copy Markdown

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

@arrry-hydraDB arrry-hydraDB left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

check this

Comment thread src/selfgraph/resolution.py Outdated
return out
index = _entity_index(schema)
own = index.get(etype)
own = index.get(etype) or next((t for name, t in index.items() if _ops.entity_type_key(name) == folded), None)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

canonical_entity_type already does this lookup, please use index.get(canonical_entity_type(etype, schema)) as terms.py does. Insert already fixes the casing before resolution, so the scan is never reached here. Also please add a mixed case resolution case to the conformance pair, and update the plan_resolution docstring, which still says each type is read once.

Comment thread typescript/src/resolution.ts Outdated
if (schema === null) return out;
const index = entityIndex(schema);
const own = index.get(etype);
const own = index.get(etype) ?? [...index.entries()].find(([name]) => ops.entityTypeKey(name) === folded)?.[1];

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Same here with canonicalEntityType.

@kruschdev
kruschdev force-pushed the fix/resolution-type-case branch from d1b14d7 to 4cae93d Compare November 16, 2026 14:51
@kruschdev

Copy link
Copy Markdown
Contributor Author

Updated compatible_types / compatibleTypes to use index.get(canonical_entity_type(etype, schema)), updated the plan_resolution / planResolution docstrings, and added a mixed_case_merges conformance case in py_side.py and ts_side.ts.

@arrry-hydraDB arrry-hydraDB left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@arrry-hydraDB
arrry-hydraDB merged commit 1a95ad4 into hydra-db:main Nov 16, 2026
17 checks passed
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.

Entity resolution compares entity types case-sensitively, creating duplicates when type casing differs

2 participants