feat: evaluate big segments#550
Open
beekld wants to merge 3 commits into
Open
Conversation
1e33a1a to
20a23ce
Compare
ae98702 to
d0e181f
Compare
20a23ce to
c7a2817
Compare
kinyoklion
reviewed
Jun 11, 2026
| return detail; | ||
| } | ||
| EvaluationReason const& reason = *maybe_reason; | ||
| EvaluationReason updated( |
Member
There was a problem hiding this comment.
nit: Part of me wants this to be more colocated with the evaluation. But I suppose a real constructor change would be noticed.
kinyoklion
reviewed
Jun 12, 2026
kinyoklion
approved these changes
Jun 12, 2026
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.
Evaluate big segments
Wires the big segment store wrapper into the server-side evaluator so flags referencing big segments actually evaluate, and annotates the reason with the big segments status. Builds on SDK-2366, which introduced the
EvaluationReason::BigSegmentsStatustype.What's in
rules.cpp:<key>.g<generation>segment refEvaluationStackcarries the per-evaluation status, membership cache, and per-key store-error set, so a context key is queried at most once per evaluation.EvaluationReason.Design notes
When one evaluation queries multiple big segments with differing statuses, the least-trustworthy status wins (
NOT_CONFIGURED>STORE_ERROR>STALE>HEALTHY). This follows the spec but diverges from Java/Go, which take the last status written.Testing
Added unit tests covering each evaluation branch against an in-memory store.
Note
Medium Risk
Changes core segment-matching and evaluation-reason behavior for flags using big segments; incorrect membership or status aggregation could change targeting outcomes, though behavior is heavily unit-tested.
Overview
Big segment evaluation is wired into the server-side flag evaluator: unbounded segments now resolve membership via
BigSegmentStoreWrapperinstead of always returning non-match with a TODO.EvaluationStackis extended with a non-owning store pointer, per-evaluation membership cache (one store lookup per context key), per-key store-error short-circuit, and aggregated BigSegmentsStatus using worst-wins precedence (NOT_CONFIGURED>STORE_ERROR>STALE>HEALTHY).Evaluatoraccepts an optional big-segment store, seeds the stack from it, and stamps the aggregated status onto the returnedEvaluationReasonwhen any big segment was consulted.In
Contains/MatchBigSegment, big segments use the unbounded context kind’s key, check<segmentKey>.g<generation>, treat store errors as non-match without retry, skip regular include/exclude lists, and fall through to segment rules on membership miss. New gtest coverage exercises not-configured, healthy/stale/error paths, precedence, caching, and rule fallthrough.Reviewed by Cursor Bugbot for commit 9b37b9a. Bugbot is set up for automated code reviews on this repo. Configure here.