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

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.

… 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.

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