Skip to content

fix: Prevent TestDataV2 from restoring an old flag builder when the flag key is a Symbol - #495

Open
keelerm84 wants to merge 1 commit into
feat/9.xfrom
mk/SDK-3540/symbol-flag-keys
Open

keelerm84 wants to merge 1 commit into
feat/9.xfrom
mk/SDK-3540/symbol-flag-keys

Conversation

@keelerm84

@keelerm84 keelerm84 commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

TestDataV2 stored a flag builder under the key that the caller passed
to flag. use_preconfigured_flag discards the builder under the String
key from the flag data, so it missed a builder that flag(:key) created.
A later flag(:key) then returned the old builder, and update replaced
the preconfigured flag with it.

flag and FlagBuilderV2 now convert the key to a String. A Symbol key
and a String key get the same builder, and a built flag has a String
key, as a flag from LaunchDarkly has.


Note

Overview
TestDataV2 now normalizes flag keys to strings in flag and in FlagBuilderV2#initialize, so a Symbol and String key refer to the same cached builder and stored flags always use a string key (matching LaunchDarkly).

This fixes a test-data bug where building a flag with flag(:key) left a builder under the symbol key while use_preconfigured_flag only cleared the string-keyed entry—later flag(:key) could resurrect the old builder and overwrite the preconfigured flag on update.

Specs cover symbol/string equivalence, correct storage after updates, and a fresh default builder after preconfigured replacement when the flag was originally built with a symbol key.

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

…lag key is a Symbol

TestDataV2 stored a flag builder under the key that the caller passed
to flag. use_preconfigured_flag discards the builder under the String
key from the flag data, so it missed a builder that flag(:key) created.
A later flag(:key) then returned the old builder, and update replaced
the preconfigured flag with it.

flag and FlagBuilderV2 now convert the key to a String. A Symbol key
and a String key get the same builder, and a built flag has a String
key, as a flag from LaunchDarkly has.
@keelerm84
keelerm84 requested a review from a team as a code owner November 10, 2026 20:45

This branch has not been deployed

No deployments
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