-
Notifications
You must be signed in to change notification settings - Fork 11
feat: Lazy identity-flag evaluation in local-eval mode #200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
khvn26
wants to merge
6
commits into
main
Choose a base branch
from
feat/lazy-identity-flags
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
7b1e3af
feat: Lazy identity-flag evaluation in local-eval mode
khvn26 57208f3
chore(deps): Bump flagsmith-flag-engine to ^10.0.4
khvn26 5a7d7dc
refactor(lazy): Route per-flag resolution through engine.get_evaluati…
khvn26 3a9e0c4
refactor: Drop lazy_identity_evaluation rollback kwarg
khvn26 783c683
test(lazy): Lift _make_lazy_context into pytest fixtures
khvn26 7ce45cf
style: Use single backticks in comments and docstrings
khvn26 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lazy path skips identity-key enrichment (multivariate + percentage_split break)
flagsmith/models.py:265–311 — Flags._resolve_flag
context_matches_condition in the engine falls back to _get_identity_key(context) (engine evaluator.py:301), and that key is never set on this context.
None, so the if key is not None and (variants := ...) branch (engine evaluator.py:183) is skipped — multivariate always returns the control value.
flagsmith/flagsmith.py:431–456 — _get_identity_flags_from_document
flagsmith/mappers.py:88–99 — map_context_and_identity_data_to_context
doesn't.
Maybe we should consider bringing back the testing harness we had that used to cover all SDKs but was limited to just the engine during the last context value work — to avoid issues like this.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks — all this fixed by using
get_evaluation_resultagainst a trimmed context in 5a7d7dc.I'll have a think on this... there's a bit of a chicken & egg problem when it comes to remote evaluation.