Skip to content

feat: Add Config#with_wrapper_information - #421

Open
kinyoklion wants to merge 1 commit into
mainfrom
devin/config-with-wrapper-information
Open

feat: Add Config#with_wrapper_information#421
kinyoklion wants to merge 1 commit into
mainfrom
devin/config-with-wrapper-information

Conversation

@kinyoklion

@kinyoklion kinyoklion commented Aug 19, 2026

Copy link
Copy Markdown
Member

Adds Config#with_wrapper_information so wrapper libraries can derive a configuration that identifies themselves without reconstructing the application's configuration.

  • Returns a copy of the configuration with wrapper_name and wrapper_version replaced; the original is unchanged.
  • Mirrors the equivalent capability in the .NET (Configuration.Builder(config)) and Java (LDConfig.Builder.fromConfig) SDKs.
  • Needed by the Ruby OpenFeature provider, which currently has no supported way to report itself as the wrapper when the application supplies its own Config.
Implementation details

Requirements

  • I have added test coverage for new or changed functionality
  • I have followed the repository's pull request submission guidelines
  • I have validated my changes against all supported platform versions

Related issues

The Ruby OpenFeature provider accepts a LaunchDarkly::Config from the application and needs to add wrapper identification to it. Config exposes wrapper_name/wrapper_version as readers only, so today a wrapper would have to either mutate instance variables or rebuild the configuration option by option, which silently drops any options it does not know about.

Describe the solution you've provided

with_wrapper_information(wrapper_name, wrapper_version = nil) uses dup plus protected writers for the two wrapper fields, so all other configuration — including options added in the future — carries over unchanged.

Describe alternatives you've considered

Reconstructing a Config from the public readers — rejected because it must be updated whenever a configuration option is added and would drop unknown options. Public writers for the wrapper fields — rejected because Config is otherwise immutable after construction.

Testing

bundle exec rspec on Ruby 3.4: 1027 examples, 0 failures. bundle exec rubocop on the changed files: no offenses. The protected attr_writer form was also verified on Ruby 3.1, the minimum supported version.

@cursor review

Link to Devin session: https://app.devin.ai/sessions/0c452d209ec54b068ba120b4c92b8f6c
Requested by: @kinyoklion


Note

Overview
Adds Config#with_wrapper_information(wrapper_name, wrapper_version = nil) so wrapper libraries (e.g. the Ruby OpenFeature provider) can derive a config that reports their own wrapper identity in User-Agent headers without rebuilding the app’s Config from public readers.

The method dups the config, updates wrapper_name and wrapper_version via new protected writers, and leaves the original unchanged. wrapper_version defaults to nil when omitted.

Specs cover updated wrapper fields, preservation of other options (e.g. offline?), no mutation of the source config, and the default wrapper_version behavior.

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

Co-Authored-By: rlamb@launchdarkly.com <4955475+kinyoklion@users.noreply.github.com>
@kinyoklion kinyoklion self-assigned this Aug 19, 2026
@devin-ai-integration

Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

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.

1 participant