fix(types): skip ForwardRef resolution for unannotated attribute probes - #6929
fix(types): skip ForwardRef resolution for unannotated attribute probes#6929benedikt-bartscher wants to merge 2 commits into
Conversation
Greptile SummaryThis PR avoids resolving unrelated forward references during unannotated attribute probes and consolidates event callback type-hint resolution.
Confidence Score: 4/5The PR is not yet safe to merge because the annotation-name cache can reject attributes added after its first snapshot. The cached MRO annotation-name set is never refreshed, so a later class annotation remains invisible to the new gate and ObjectVar attribute access raises VarAttributeError. Files Needing Attention: packages/reflex-base/src/reflex_base/utils/compat.py and packages/reflex-base/src/reflex_base/utils/types.py
|
| Filename | Overview |
|---|---|
| packages/reflex-base/src/reflex_base/utils/compat.py | Adds cached MRO annotation-name discovery, but the cache remains stale after class annotation mutation. |
| packages/reflex-base/src/reflex_base/utils/types.py | Uses annotation-name discovery to avoid unnecessary ForwardRef resolution, while relying on the potentially stale cached result. |
| packages/reflex-base/src/reflex_base/event/init.py | Extracts the existing NameError fallback for callback type-hint resolution into a shared helper. |
| tests/units/test_attribute_access_type.py | Covers unannotated probes, unresolved annotations, and Python 3.14 lazy annotations, but does not cover annotation mutation after an initial probe. |
Reviews (2): Last reviewed commit: "fix: actually test it for python3.14" | Re-trigger Greptile
Merging this PR will not alter performance
Comparing Footnotes
|
There was a problem hiding this comment.
All reported issues were addressed across 5 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Uh oh!
There was an error while loading. Please reload this page.