Skip to content

feat(ldreason): add isOverride indicator to EvaluationReason#56

Draft
kinyoklion wants to merge 1 commit into
v3from
rlamb/sdk-2651/ldreason-isoverride
Draft

feat(ldreason): add isOverride indicator to EvaluationReason#56
kinyoklion wants to merge 1 commit into
v3from
rlamb/sdk-2651/ldreason-isoverride

Conversation

@kinyoklion

@kinyoklion kinyoklion commented Jul 7, 2026

Copy link
Copy Markdown
Member

Adds an optional boolean isOverride indicator to ldreason.EvaluationReason, identifying evaluations whose flag definition was supplied by an SDK override source rather than by LaunchDarkly. This is the go-sdk-common piece of the SDK flag-overrides feature (OVERRIDE spec).

  • Unexported isOverride field with an IsOverride() accessor, following the inExperiment pattern.
  • NewEvalReasonFromReasonWithIsOverride copy-style helper, mirroring NewEvalReasonFromReasonWithBigSegmentsStatus, since the indicator can apply to a reason of any kind.
  • Serialized only when true, so the wire format is unchanged for all existing evaluations. One writer/reader change covers encoding/json, jsonstream, and easyjson (the easyjson methods delegate to the shared functions); an easyjson build-tagged round-trip test verifies that path.
  • The serialization test table now also exercises every reason kind with the indicator set, and asserts that setting it to false serializes identically to today.

SDK-2651


Note

Low Risk
Additive API and backward-compatible JSON; no evaluation or auth logic changed in this package.

Overview
Adds an optional isOverride flag on EvaluationReason so evaluation details can record when the evaluated flag came from an SDK override source instead of LaunchDarkly (OVERRIDE spec / SDK-2651).

IsOverride() and NewEvalReasonFromReasonWithIsOverride mirror inExperiment / NewEvalReasonFromReasonWithBigSegmentsStatus, so any reason kind can carry the indicator without changing its kind. JSON only emits isOverride when true, keeping the wire shape unchanged for existing payloads; shared jsonstream read/write covers encoding/json and easyjson.

Tests factor serialization cases into makeSerializationTestParams, cover override on every reason kind, and add an easyjson round-trip test behind launchdarkly_easyjson.

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

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