Skip to content

chore(release): v1.4.4#123

Merged
ds1sqe merged 2 commits intomasterfrom
develop
Apr 9, 2026
Merged

chore(release): v1.4.4#123
ds1sqe merged 2 commits intomasterfrom
develop

Conversation

@ds1sqe
Copy link
Copy Markdown
Owner

@ds1sqe ds1sqe commented Apr 9, 2026

Summary

ds1sqe added 2 commits April 9, 2026 04:28
…117)

Add Entity.has / Relation.has / <Concrete>.has for finding instances
that own a given attribute, optionally filtered by value or expression.

Cross-type form (Entity.has(db, Name)) returns mixed concrete subtypes
across all entities owning Name. Concrete-class form
(HLPerson.has(db, Name)) narrows to that type and its TypeDB subtypes
via isa polymorphism — abstract base subclasses get subtype matching
for free without any extra branching.

Relation results always include hydrated role players. Entity lookups
remain single-query; relations are re-fetched per result through
concrete_class.manager(connection).get(_iid=iid) to reuse the existing
relation manager's role-player extraction. The relation path is
therefore N+1 in returned relations, which is acceptable for typical
attribute-keyed result sets and is explicitly disclosed in the public
docstring.

Key changes:

- New crud/has_lookup.py with _build_has_query as the single source of
  truth for query construction, and _hydrate_results split into
  _hydrate_entity (wildcard fast path) and _hydrate_relation_via_manager
  (delegates to manager.get for role players).
- New TypeDBType.has classmethod that dispatches kind and computes
  narrow_type via the cls is base_cls check.
- Reverse _attribute_owners index in ModelRegistry, populated from
  Entity / Relation __init_subclass__, plus Attribute.get_owners() for
  static discovery without a database connection.
- Narrowed query uses the existing $t sub <type>; $x isa! $t pattern
  from crud/typedb_manager.py:597-616. The first attempt with label($x)
  was rejected by TypeDB 3 because $x is an Object variable, not a
  Type variable — hence the type-variable dance.

Tests: 32 unit + 25 integration covering cross-type, narrowed, and
abstract base subclass paths plus role-player hydration on both
concrete and cross-type relation receivers.
Ship the #117 cross-type attribute lookup work under v1.4.4 by bumping
every workspace version string and regenerating Cargo.lock.

Also fix a stale type_bridge.__version__ that was missed by the 1.4.2
and 1.4.3 bump commits — it still read "1.4.1" before this change.

Files touched:

- pyproject.toml: version + type-bridge-core>= pin
- type-bridge-core/pyproject.toml
- type-bridge-core/crates/{core,orm,orm-derive,python,server}/Cargo.toml:
  self version and intra-workspace dependency pins
- type-bridge-core/Cargo.lock: regenerated via cargo update -w
- type_bridge/__init__.py: __version__ 1.4.1 -> 1.4.4 (carried over)
- CHANGELOG.md: new 1.4.4 section summarizing #117

Refs #117
@ds1sqe ds1sqe merged commit 2a68507 into master Apr 9, 2026
52 checks passed
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 9, 2026

Codecov Report

❌ Patch coverage is 77.11864% with 27 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
type_bridge/crud/has_lookup.py 79.01% 14 Missing and 3 partials ⚠️
type_bridge/models/base.py 37.50% 9 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

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.

1 participant