Repository navigation
Conversation
khvn26
marked this pull request as draft
October 16, 2026 17:19
khvn26
force-pushed
the
feat/flags-context-values
branch
from
October 19, 2026 10:22
35891e0 to
a029f90
Compare
khvn26
force-pushed
the
feat/flags-context-values
branch
2 times, most recently
from
October 19, 2026 10:31
aa94f73 to
8775019
Compare
khvn26
marked this pull request as ready for review
October 19, 2026 11:59
Environment flags are now evaluated with segments whose conditions all read `$.environment` or `$.flags`, as `GET /api/v1/flags/` does since Flagsmith/flagsmith#8576. Segments reading traits or identity context are left out. When segment conditions read `$.flags`, identity flags are evaluated at once against the full context, as a context trimmed to one feature lacks the flags it depends on. Otherwise, they are still evaluated lazily. Closes #245
khvn26
force-pushed
the
feat/flags-context-values
branch
from
October 20, 2026 16:10
b2d63e6 to
f1af8bb
Compare
`_get_context_reads` and `LocalEvaluation.__init__` both combined reads through booleans, then built a `_ContextReads` from them. `_ContextReads` now combines with `|`, from empty defaults.
Renames `_get_context_reads` to `_get_context_reads_from_rules`, and adds `_get_context_reads_from_segments` for `LocalEvaluation.reads`, as suggested in review.
…lags Identity-free segments are only used to evaluate environment flags, at most once per environment document. They are now filtered there, rather than eagerly for every environment document.
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.
Closes #245.
In this PR, we allow local evaluation's
get_environment_flagsto process segments without identity-specific segment conditions. In other words, if a segment only contains$.flags.*and$.environment.*conditions, it will apply to environment flags.Lazy evaluation, introduced in #200, is now skipped for environments containing segments with
$.flags.*conditions.