feat: add contract tests for file-based flag overrides#374
Draft
kinyoklion wants to merge 1 commit into
Draft
Conversation
This was referenced Jul 7, 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.
Adds a contract test suite for the SDK flag-overrides feature (OVERRIDE spec), gated on a new
flag-overridescapability so SDKs that don't advertise it skip everything.Configuration follows the shared-filesystem arrangement already used for the TLS custom CA file: the harness writes override documents to temp files and passes absolute paths in a new
overridesconfig block (filePaths,duplicateKeysHandling,watch,poll,pollIntervalMs). AnOverrideFilehelper creates, rewrites (deliberately non-atomic truncate-and-write, since SDKs must tolerate mid-write reads), and clears the files during a test.Coverage:
OFFreason andisOverride: true; a full flag override evaluating targeting rules (RULE_MATCH); passthrough for non-overridden flags withisOverridestrictly absent; an overridden flag rule resolving an overridden segment through the merged view; all-flags state reflecting overrides.initCanFail): the overridden flag serves its override value and reason; a non-overridden flag still returns the default withCLIENT_NOT_READY."override": true(newoverrideFlagCountermatcher) while an ordinary flag's counter carries no marker (proven by the existing exact-key matcher), and a tracked (trackEvents: true) override evaluation produces no individual feature event — the payload's exact item set is index + summary only.ignoreduplicate handling (first file wins, later files still merged) and YAML documents.One note on reason assertions: the typed
ldreason.EvaluationReasonin the response model drops JSON properties it doesn't know, which would silently discardisOverride. The suite therefore asserts reasons at the raw-JSON level via a small same-package helper, which also lets the passthrough test enforce the spec's "omitted when false" serialization rule strictly.Verified end-to-end against the Go SDK's in-progress implementation: the new suite passes in both reload modes, and the full harness run (4945 tests) stays green.
SDK-2657