Skip to content

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

Merged
keelerm84 merged 2 commits into
feat/9.xfrom
mk/SDK-3540/symbol-flag-keys
Nov 12, 2026
Merged

keelerm84 merged 2 commits 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
Fixes a TestData bug where passing a Symbol flag key (e.g. flag(:myflag)) stored builders under a different hash key than String keys, so use_preconfigured_flag could fail to clear the builder and later updates resurrected stale configuration.

TestData#flag and FlagBuilder now coerce keys to strings, so symbol and string accessors share one builder and built flags expose a string key. Specs cover preconfigured replacement, builder reuse, and stored flag keys when symbols are used.

Reviewed by Cursor Bugbot for commit 5c406c8. 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
…l-flag-keys

# Conflicts:
#	lib/ldclient-rb/integrations/test_data/flag_builder.rb
@keelerm84
keelerm84 merged commit 8db13f3 into feat/9.x Nov 12, 2026
10 checks passed
@keelerm84
keelerm84 deleted the mk/SDK-3540/symbol-flag-keys branch November 12, 2026 21:35
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.

2 participants