Skip to content

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

Draft
kinyoklion wants to merge 1 commit into
rlamb/overrides-dotnet-reason-markerfrom
rlamb/overrides-dotnet-model-evaluator
Draft

kinyoklion wants to merge 1 commit into
rlamb/overrides-dotnet-reason-markerfrom
rlamb/overrides-dotnet-model-evaluator

Conversation

@kinyoklion

@kinyoklion kinyoklion commented Sep 25, 2026 •

Copy link
Copy Markdown
Member

Summary

Adds the override marker to the flag and segment models and makes the evaluator mark evaluations as override-affected, as defined by the OVERRIDE specification.

FeatureFlag and Segment gain an internal IsOverride property and an AsOverride() method that returns a marked copy sharing the immutable parts of the original. The marker lives on the model only: the JSON converters do not write it, so a marked definition serializes exactly like an unmarked one, and the original object handed to AsOverride() is never modified.

The evaluator marks an evaluation when any definition it read carried the marker: the evaluated flag, a prerequisite flag at any depth, or a segment consulted during clause matching, whether or not the segment matched. The marking propagates upward only. Each prerequisite evaluation is a scope of its own that starts from the prerequisite's marker, so the record for a prerequisite reflects only its own subtree, while the parent scope absorbs the nested marking when the nested evaluation returns or throws. Error results are marked too: a malformed override flag, a prerequisite cycle through an override flag, and an invalid context all produce an error reason that carries the indicator. A definition that cannot be resolved contributes nothing. The marking is reported through the reason's OverrideAffected indicator from the previous change in this series.

Nothing in this change produces marked definitions yet; the override store that does so is the next change. Every existing evaluation therefore behaves as before, which the existing evaluator tests confirm. The new tests cover each marking case, including the prerequisite tree in the specification where only one leaf is overridden.

This PR is based on the branch of the EvaluationReason indicator change, which it depends on.

SDK-3248


Note

Overview
Adds an internal override marker on FeatureFlag and Segment (IsOverride / AsOverride()), kept only in memory and not in serialized JSON.

The evaluator tracks whether an evaluation was override-affected when any definition actually read during that evaluation was marked: the root flag, nested prerequisite flags (each prereq gets its own scope; marking bubbles up to the parent), or segments loaded for clause matching (including non-matches and negated clauses). That flag is attached to the top-level EvaluationReason (and prerequisite eval records) via WithOverrideAffected, including error paths. Unresolved flags/segments do not contribute.

Extensive tests cover marking rules, serialization of markers, and interaction with big-segments status. Nothing in this PR yet supplies override definitions from an override store—that is follow-up work; default behavior for unmarked definitions is unchanged.

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

@kinyoklion
kinyoklion force-pushed the rlamb/overrides-dotnet-reason-marker branch from e4dfcf4 to 74be7f9 Compare September 28, 2026 20:39
@kinyoklion
kinyoklion force-pushed the rlamb/overrides-dotnet-model-evaluator branch from aff3a67 to ae86267 Compare September 28, 2026 20:39
@kinyoklion
kinyoklion force-pushed the rlamb/overrides-dotnet-reason-marker branch from 74be7f9 to 93c9160 Compare October 1, 2026 23:43
@kinyoklion
kinyoklion force-pushed the rlamb/overrides-dotnet-model-evaluator branch from ae86267 to 533647f Compare October 1, 2026 23:43
@kinyoklion
kinyoklion force-pushed the rlamb/overrides-dotnet-reason-marker branch from 93c9160 to 3996906 Compare October 3, 2026 01:34
@kinyoklion
kinyoklion force-pushed the rlamb/overrides-dotnet-model-evaluator branch from 533647f to 511de7f Compare October 3, 2026 01:34
@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 511de7f. Configure here.

@kinyoklion
kinyoklion force-pushed the rlamb/overrides-dotnet-reason-marker branch from 3996906 to 285612d Compare October 3, 2026 01:52
@kinyoklion
kinyoklion force-pushed the rlamb/overrides-dotnet-model-evaluator branch from 511de7f to 33e2973 Compare October 3, 2026 01:52
@kinyoklion
kinyoklion force-pushed the rlamb/overrides-dotnet-reason-marker branch from 285612d to 5200c06 Compare October 5, 2026 21:55
@kinyoklion
kinyoklion force-pushed the rlamb/overrides-dotnet-model-evaluator branch from 33e2973 to 22c3c01 Compare October 5, 2026 21:55
@kinyoklion
kinyoklion force-pushed the rlamb/overrides-dotnet-reason-marker branch from 5200c06 to 4038dce Compare October 5, 2026 22:12
@kinyoklion
kinyoklion force-pushed the rlamb/overrides-dotnet-model-evaluator branch from 22c3c01 to 426dbe4 Compare October 5, 2026 22:12
@kinyoklion
kinyoklion force-pushed the rlamb/overrides-dotnet-reason-marker branch from 4038dce to dca375c Compare October 5, 2026 22:28
@kinyoklion
kinyoklion force-pushed the rlamb/overrides-dotnet-model-evaluator branch from 426dbe4 to 167a54a Compare October 5, 2026 22:28
… evaluations

FeatureFlag and Segment gain an internal IsOverride marker and an
AsOverride method that returns a marked copy sharing the immutable parts
of the original. The marker lives on the model only and is never
serialized.

The evaluator marks an evaluation as override-affected when any
definition it read carried the 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
record reflects only the definitions its own subtree read. Error results
are marked too. The result is reported through the evaluation reason's
OverrideAffected indicator, as defined by the OVERRIDE specification.
@kinyoklion
kinyoklion force-pushed the rlamb/overrides-dotnet-reason-marker branch from dca375c to 6b919c2 Compare October 5, 2026 23:56
@kinyoklion
kinyoklion force-pushed the rlamb/overrides-dotnet-model-evaluator branch from 167a54a to 6894b3d Compare October 5, 2026 23:56

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