Summary
The SDK integration spec states that add_feature_flag should accept:
"a value which is a union of string, boolean, integer, float, and structure."
However, the current JS SDK implementation silently drops any non-boolean value as a no-op.
Relevant code
In packages/core/src/utils/featureFlags.ts:
// _INTERNAL_insertToFlagBuffer
if (typeof value !== 'boolean') {
return; // silently ignored
}
// _INTERNAL_addFeatureFlagToActiveSpan
if (typeof value !== 'boolean') {
return; // silently ignored
}
The FeatureFlag type also restricts result to boolean:
export type FeatureFlag = { readonly flag: string; readonly result: boolean };
The conflict
The event payload contexts spec defines the result field as boolean only:
"The boolean result of flag evaluation."
This contradicts the SDK integration spec which allows a broader union type. It seems the JS SDK was intentionally restricted to match the narrower wire protocol definition.
Ask
- Is the
result: boolean constraint in the contexts spec intentional/permanent, or is broadening it to string | boolean | integer | float planned?
- Would a PR to the JS SDK (and the spec docs if needed) be welcome once the protocol question is resolved?
Use case
Many feature flag providers (e.g. Rollout/rox-ssr, LaunchDarkly, Statsig) support string variant flags (e.g. "control", "variant-a", "variant-b"). Currently there is no way to send these to Sentry via the feature flags integration — setContext is the only workaround, which bypasses the structured flags UI entirely.
Summary
The SDK integration spec states that
add_feature_flagshould accept:However, the current JS SDK implementation silently drops any non-boolean value as a no-op.
Relevant code
In
packages/core/src/utils/featureFlags.ts:The
FeatureFlagtype also restrictsresulttoboolean:The conflict
The event payload contexts spec defines the
resultfield asbooleanonly:This contradicts the SDK integration spec which allows a broader union type. It seems the JS SDK was intentionally restricted to match the narrower wire protocol definition.
Ask
result: booleanconstraint in the contexts spec intentional/permanent, or is broadening it tostring | boolean | integer | floatplanned?Use case
Many feature flag providers (e.g. Rollout/rox-ssr, LaunchDarkly, Statsig) support string variant flags (e.g.
"control","variant-a","variant-b"). Currently there is no way to send these to Sentry via the feature flags integration —setContextis the only workaround, which bypasses the structured flags UI entirely.