Skip to content

Commit 9fd510f

Browse files
committed
1.2.6 - Polymorphic Role Player Type Resolution
1 parent 61dabd7 commit 9fd510f

2 files changed

Lines changed: 58 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,63 @@
22

33
All notable changes to TypeBridge will be documented in this file.
44

5+
## [1.2.6] - 2026-02-01
6+
7+
### New Features
8+
9+
#### Polymorphic Role Player Type Resolution (PR #92)
10+
- **Role players now resolve to their concrete Python types**
11+
- When querying relations with abstract role types, role players are resolved to concrete types (e.g., `Person` instead of `Profile`)
12+
- Uses TypeQL `label()` function to fetch type labels and resolve to correct Python class
13+
- Location: `type_bridge/crud/relation/manager.py`
14+
15+
#### Relations as Role Players
16+
- **Fixed hydration for relations serving as role players**
17+
- Relations can now properly participate as role players in other relations
18+
- Comprehensive test suites added for this pattern
19+
- Location: `type_bridge/crud/relation/manager.py`
20+
21+
### Improvements
22+
23+
#### Modular Helper Methods (PR #92)
24+
- **Extracted reusable helper methods for DRY refactoring**
25+
- `_resolve_entity_class_from_label()` - Resolves concrete types using TypeQL `label()` function
26+
- `_hydrate_entity_from_data()` - Helper for role player instantiation
27+
- Eliminates duplicate code in `get()` and `get_by_iid()` methods
28+
29+
#### Generator Enhancements (PR #92)
30+
- **Improved code generation for relations**
31+
- Role cardinality annotations now properly rendered
32+
- Docstrings and type annotations rendering improvements
33+
- Location: `type_bridge/generator/`
34+
35+
### Bug Fixes
36+
37+
#### Polymorphic Role Validation (PR #92)
38+
- **Fixed polymorphic role validation and role player IIDs**
39+
- Correct handling of abstract types in role player resolution
40+
- Fixed role player IID extraction in polymorphic queries
41+
42+
#### Test Fixes (PR #92)
43+
- Fixed `manager.count()``manager.filter().count()` in tests
44+
- Renamed attribute types to avoid naming collisions
45+
46+
### Testing
47+
48+
- **19 new integration tests** (`tests/integration/queries/test_social_network_queries.py`)
49+
- Deep inheritance (3-level: Entity → Profile → Person/Organization)
50+
- Self-referential symmetric relations (Friendship)
51+
- Geographic hierarchy chains (Person → City → Country)
52+
- Polymorphic role players with concrete type verification
53+
- Multi-value attributes with `@card(0..*)`
54+
- Chained relations and complex filter combinations
55+
56+
### Key Files Modified
57+
58+
- `type_bridge/crud/relation/manager.py` - Polymorphic role player resolution
59+
- `type_bridge/generator/render/` - Role cardinality and annotations rendering
60+
- `tests/integration/queries/test_social_network_queries.py` - New comprehensive tests
61+
562
## [1.2.5] - 2026-01-31
663

764
### New Features

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "type-bridge"
7-
version = "1.2.5"
7+
version = "1.2.6"
88
description = "A modern, Pythonic ORM for TypeDB with an Attribute-based API"
99
readme = "README.md"
1010
requires-python = ">=3.13"

0 commit comments

Comments
 (0)