Skip to content

fix: accept symbol feature flag keys#147

Open
dustinbyrne wants to merge 2 commits into
mainfrom
fix/flag-symbol-keys
Open

fix: accept symbol feature flag keys#147
dustinbyrne wants to merge 2 commits into
mainfrom
fix/flag-symbol-keys

Conversation

@dustinbyrne
Copy link
Copy Markdown
Contributor

💡 Motivation and Context

Feature flag APIs should accept Ruby symbols for flag keys as well as strings. Previously, symbol keys could miss local and remote flag lookups because SDK internals compared them directly against string keys.

This normalizes flag keys to strings across the flag APIs, including legacy single-flag methods, remote config payloads, and evaluate_flags(flag_keys:).

Review loop: checked the SDK diff against compatibility, API surface, entry-point tracing, performance, coverage, and error-handling criteria; no follow-up fixes were needed after the review.

💚 How did you test it?

  • bundle exec rspec
  • bundle exec rubocop

📝 Checklist

  • I reviewed the submitted code.
  • I added tests to verify the changes.
  • I updated the docs if needed.
  • No breaking change or entry added to the changelog.

If releasing new changes

  • Ran pnpm changeset to generate a changeset file

@dustinbyrne dustinbyrne requested a review from a team as a code owner May 12, 2026 14:12
Comment thread lib/posthog/client.rb
end

# @param [String] flag_key The unique flag key of the feature flag
# @param [String, Symbol] flag_key The unique flag key of the feature flag
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would that be a breaking change?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it's additive. This is like a String | Symbol in TypeScript, so you can now optionally call using a symbol like:

get_feature_flag(:beta_flag)

@dustinbyrne dustinbyrne force-pushed the fix/flag-symbol-keys branch from c85b703 to c9c3778 Compare May 12, 2026 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants