feat: add static evaluation of activators#646
Closed
fadedDexofan wants to merge 5 commits intoreagento:developfrom
Closed
feat: add static evaluation of activators#646fadedDexofan wants to merge 5 commits intoreagento:developfrom
fadedDexofan wants to merge 5 commits intoreagento:developfrom
Conversation
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Classify activators as STATIC/DYNAMIC and evaluate static ones at container creation time, stripping inactive providers from the dependency graph.
37d9436 to
430f305
Compare
Tishka17
reviewed
Jan 25, 2026
Initial implementation evaluated activators after `build()`, leaving dead branches in SELECTORs. Move evaluation into `RegistryBuilder.build()` before `_unite_selectors()` to filter inactive factories earlier.
Tishka17
reviewed
Jan 25, 2026
| case None: | ||
| return True | ||
| case BoolMarker(): | ||
| return None if not marker.value else True |
- Fix duplicate condition bug in activator.py (Marker → BaseMarker) - Add type guard before isinstance() in static_evaluator.py - Extract _get_factory_deps() to reduce duplication in classifier - Add caching for inheritance-based context lookups - Extract HasMarkerEvaluator class for better SRP - Add 17 unit tests for ActivatorClassifier
|
Tishka17
reviewed
Jan 25, 2026
| from dishka.factory_index import FactoryIndex | ||
|
|
||
|
|
||
| class HasMarkerEvaluator: |
Member
There was a problem hiding this comment.
None of markers should handled differently. All markers must be proceded in the same way.
Tishka17
reviewed
Jan 25, 2026
|
|
||
| source = factory.source | ||
| if factory.is_to_bind and args: | ||
| result = source(args[0], *args[1:], **kwargs) |
Member
There was a problem hiding this comment.
binding is done in factory, do not reimplement it
Tishka17
reviewed
Jan 25, 2026
| from dishka.factory_index import FactoryIndex | ||
|
|
||
|
|
||
| def _make_factory( |
Member
There was a problem hiding this comment.
no need to create factories manually, use provide
Member
|
AI generated code. A lot of decisions are discussable. Closing as author is not able to discuss it |
fadedDexofan
added a commit
to fadedDexofan/dishka
that referenced
this pull request
Jan 25, 2026
- BoolMarker now returns marker.value directly - Remove is_to_bind reimplementation (factory handles binding) - Remove test_activator_classifier.py (internal class, behavior covered by integration tests in test_static_evaluation.py)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Classify activators as STATIC/DYNAMIC and evaluate static ones at container creation time, stripping inactive providers from the dependency graph.
Closes #642