Skip to content

fix: correct BackRef type hinting#29

Merged
0x054 merged 1 commit intomainfrom
cursor/backref-typing
Apr 27, 2026
Merged

fix: correct BackRef type hinting#29
0x054 merged 1 commit intomainfrom
cursor/backref-typing

Conversation

@0x054
Copy link
Copy Markdown
Contributor

@0x054 0x054 commented Apr 27, 2026

Description

Fix misleading IDE type hints where annotating reverse collections as BackRef[list[T]] caused .all() to appear as list[list[T]].

Changes

  • Add BackRef.all() and BackRef.first() typing overloads to interpret both BackRef[T] and BackRef[list[T]] as returning model instances.
  • Override BackRef.all/first to delegate to Query while preserving the improved typing surface.

Bridge and Schema Impact

  • No Rust/Python bridge changes
  • Python model/schema changed
  • Rust core or SQL generation changed
  • src/ferro/_core.pyi updated (if needed)
  • Integration test added first for new behavior

Migration / Breaking Changes

  • No breaking changes
  • Breaking changes included (details below)

Documentation and Changelog

  • No docs update needed
  • Docs updated (README/docs/inline docs)
  • Changelog entry needed

Related Issues

Made with Cursor

Add overloads so BackRef[list[T]] no longer hints as list[list[T]].

Made-with: Cursor
@0x054 0x054 marked this pull request as ready for review April 27, 2026 12:45
@0x054 0x054 merged commit 6171923 into main Apr 27, 2026
7 checks passed
@0x054 0x054 deleted the cursor/backref-typing branch April 27, 2026 12:46
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