Skip to content

feat: Add the override marker to the flag and segment models and mark evaluations - #221

Draft
kinyoklion wants to merge 1 commit into
rlamb/overrides-java-filedata-reloaderfrom
rlamb/overrides-java-model-marker
Draft

kinyoklion wants to merge 1 commit into
rlamb/overrides-java-filedata-reloaderfrom
rlamb/overrides-java-model-marker

Conversation

@kinyoklion

@kinyoklion kinyoklion commented Sep 25, 2026 •

Copy link
Copy Markdown
Member

Summary

The OVERRIDE specification requires an evaluation to be marked as override-affected when any definition it read carried the override marker: the evaluated flag, a prerequisite at any depth, or a segment consulted during matching, whether or not the segment matched. The marking propagates upward only: a prerequisite's own record reflects only the definitions that its own subtree read, while the evaluation that requested it accumulates the result. An evaluation that fails is still marked when it read a marked definition, and a requested-type mismatch keeps the marking on its error reason.

  • DataModel.FeatureFlag and DataModel.Segment carry a transient isOverride marker. It is never serialized and never read from JSON. markedAsOverride() returns a shallow copy with the marker set, sharing nested collections and preprocessing with the source and never modifying it. The override layer will use it in the next change.
  • The evaluator tracks the marking per evaluation scope. The scope starts from its own flag's marker, each segment read can set it, and the value is saved, reset to the prerequisite's own marker, and restored around every prerequisite evaluation. Each result and each prerequisite record carries the marking on its reason.
  • EvalResult.isOverrideAffected() reads the reason's indicator, and withOverrideAffected(boolean) returns a copy so that the shared precomputed results are never mutated.
  • The server SDK now depends on launchdarkly-java-sdk-common 2.6.0, which adds EvaluationReason.isOverrideAffected() and the overrideAffected JSON property (written only when true). CI for this change cannot pass until that version is released.

Flag overrides are currently experimental and subject to change.

This PR is based on the file data reliability branch (rlamb/overrides-java-filedata-reloader) so the series applies in order; retarget it to feat/overrides once that branch merges.

The existing file data source keeps its current behavior; this change does not touch its code paths.

SDK-3246


Note

Overview
Adds experimental flag-override tracking so evaluations can be labeled when they used override-store flag or segment definitions (not LaunchDarkly-served data).

Data model: FeatureFlag and Segment get a transient isOverride flag (never serialized) and markedAsOverride() shallow copies for the future override layer.

Evaluation: The evaluator accumulates override impact per scope—the evaluated flag, any prerequisite subtree, and any segment consulted during matching (match or not)—and sets EvaluationReason.overrideAffected on the final result and prerequisite records. Marking flows up only; each prerequisite record reflects its own subtree. EvalResult exposes isOverrideAffected() / withOverrideAffected() without mutating shared precomputed results. InputValidatingEvaluator keeps the marker on type-mismatch and malformed-flag errors.

Dependency: Bumps launchdarkly-java-sdk-common to 2.6.0 for EvaluationReason.isOverrideAffected() / JSON support.

Reviewed by Cursor Bugbot for commit 996b8d3. Bugbot is set up for automated code reviews on this repo. Configure here.

@kinyoklion
kinyoklion force-pushed the rlamb/overrides-java-filedata-reloader branch from f0038ed to 79250a7 Compare September 28, 2026 21:03
@kinyoklion
kinyoklion force-pushed the rlamb/overrides-java-model-marker branch 2 times, most recently from d82beda to 1ba722a Compare October 1, 2026 23:43
… evaluations

The OVERRIDE specification requires an evaluation to be marked as
override-affected when any definition it read carried the override
marker: the evaluated flag, a prerequisite at any depth, or a segment
consulted during matching, whether or not the segment matched. The
marking propagates upward only. A prerequisite's own record reflects
only the definitions that its own subtree read. An evaluation that fails
is still marked when it read a marked definition.

DataModel.FeatureFlag and DataModel.Segment carry a transient
isOverride marker that is never serialized and never read from JSON,
with a markedAsOverride() shallow copy that the override layer will use
without modifying the source's entity.

The evaluator tracks the marking per evaluation scope: the scope starts
from its own flag's marker, each segment read can set it, and the value
is saved, reset to the prerequisite's marker, and restored around each
prerequisite evaluation. The result and every prerequisite record carry
the marking on their reason. EvalResult exposes isOverrideAffected() and
withOverrideAffected(), which copies rather than mutating the shared
precomputed results. A requested-type mismatch keeps the marking on its
error reason.

The server SDK now depends on launchdarkly-java-sdk-common 2.6.0, which
adds the overrideAffected indicator to EvaluationReason. CI for this
change cannot pass until that version is released.

Flag overrides are currently experimental and subject to change.
@kinyoklion
kinyoklion force-pushed the rlamb/overrides-java-model-marker branch from 1ba722a to 996b8d3 Compare October 3, 2026 00:58
@kinyoklion

Copy link
Copy Markdown
Member Author

bugbot review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 996b8d3. Configure here.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant