Repository navigation
docs: Note that a flagValues override is not available to client-side SDKs - #2135
Conversation
… SDKs A flagValues entry becomes a flag without client-side availability, so allFlagsState with clientSideOnly leaves it out even when the flag it overrides is client-side. A full definition with clientSideAvailability is the way to override such a flag. A test pins both.
|
bugbot review |
|
@launchdarkly/js-sdk-common size report |
|
@launchdarkly/js-client-sdk size report |
|
@launchdarkly/js-client-sdk-common size report |
There was a problem hiding this comment.
✅ 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 7a8a5ab. Configure here.
Summary
A
flagValuesentry in an override file expands into a flag that is on and serves its value by fallthrough (OVERRIDE spec 1.3.2.1). That flag has no client-side availability, soallFlagsStatewithclientSideOnlyleaves it out, even when the flag it overrides is available to client-side SDKs. A client-side SDK bootstrapped from that state then evaluates the flag with its own default instead of the overridden value.This is the intended behavior: making value-only overrides available to client-side SDKs would expose overridden server-only flags to browsers. The
FileOverrideSourceOptionsdocumentation now says so and names the way to override a flag that client-side SDKs use: a full definition inflagswith"clientSideAvailability": { "usingEnvironmentId": true }. The Node SDK reads client-side availability fromclientSideAvailability.usingEnvironmentIdonly.A test in
LDClientImpl.fileOverrides.test.tspins both halves: from one override file, the full definition with client-side availability is in the client-side-only state and the value-only entry is not, while both are in the full state.The other server-side SDKs get the same note.
Opened from termag
SDK-3419
Note
Overview
Documents that
flagValuesoverrides are server-only: they still expand to on/fallthrough flags for evaluation, butallFlagsState({ clientSideOnly: true })omits them even when the underlying LaunchDarkly flag is client-visible—by design, so value-only overrides do not leak server-only flags to browsers.The
FileOverrideSourceOptionsJSDoc now states that workaround: put a full entry underflagswithclientSideAvailability: { usingEnvironmentId: true }.Adds a file-override integration test that loads both a
flagValuesentry and a client-sideflagsdefinition from one file and asserts the full state includes both keys while the client-side-only state includes only the full definition.Reviewed by Cursor Bugbot for commit 7a8a5ab. Bugbot is set up for automated code reviews on this repo. Configure here.