feat: expose original feature name on flags, fix analytics casing - #426
Closed
matthewelwell wants to merge 1 commit into
Closed
matthewelwell wants to merge 1 commit into
matthewelwell wants to merge 1 commit into
Conversation
Flag keys in `getAllFlags()` are lower-cased with spaces replaced, and the
feature's original name was discarded at ingest. Consumers who want a map
keyed by their real feature names - e.g. to hold every flag in app state
rather than reading them one at a time - had no way to recover it.
Each flag now carries the feature's own name as `name`:
const flagsByName = Object.fromEntries(
Object.entries(flagsmith.getAllFlags()).map(([key, flag]) => [flag.name ?? key, flag])
)
This is purely additive - flag keys are unchanged. `name` is absent on
flags supplied via `defaultFlags` and on flags restored from a cache
written by an older SDK, hence the `?? key` fallback.
Also fixes analytics being recorded against the caller's casing rather
than the feature's name. The API resolves analytics with a case-sensitive
match on Feature.name, so getValue('MyFlag') and getValue('myflag') were
reported as two separate features and neither resolved unless it matched
exactly - meaning flags in projects that don't use lower-case names never
registered as in use. evaluateFlag, the Sentry addFeatureFlag call and
trackExposureEvent now all report the resolved flag's name.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
matthewelwell
requested review from
talissoncosta
and removed request for
a team
October 6, 2026 07:16
Contributor
Author
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 an optional
nameto each flag carrying the feature's original casing, sogetAllFlags()can be re-keyed by real feature names — additive, flag keys are unchanged.Fixes analytics being recorded under the caller's casing rather than the feature name; the API matches
Feature.namecase-sensitively, so flags in projects not using lower-case names never registered as in use.🤖 Generated with Claude Code