Skip to content

fix: Convert OpenFeature context values to LaunchDarkly values - #47

Open
kinyoklion wants to merge 3 commits into
mainfrom
devin/1794846250-ruby-context-values
Open

kinyoklion wants to merge 3 commits into
mainfrom
devin/1794846250-ruby-context-values

Conversation

@kinyoklion

@kinyoklion kinyoklion commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

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

Accepted OFP requirements 2.5.1–2.5.2.1.

Describe the solution you've provided

Convert Time and DateTime attributes to UTC ISO-8601 strings, preserving fractional seconds, and Date attributes to midnight UTC. Recursively convert arrays/structures, preserve JSON scalars, and replace unsupported values with null while logging an error. Applies to custom attributes in single/multi-contexts without mutating input values.

Describe alternatives you've considered

JSON serialization leaves native date/object instances in the evaluation context, so local targeting does not see the string/null values required by OFP.

Additional context

The affected converter and original tests were written by Matthew M. Keeler; this fix is by Devin for Ryan. Independent of #45 and held lifecycle work. Updated cleanly with main after #45 merged (8ae500c). Local Ruby 3.4: 82 examples pass; RuboCop clean. CI passes on Linux Ruby 3.4, JRuby 10.0 and Windows Ruby 3.4; Devin Review found no issues. Left as a draft per Ryan's account setting.


OpenFeature Maintainer opened this PR for Ryan
Implemented in session Audit openfeature-ruby-server provider this week
Review with Devin · Open in Devin Desktop


SDK-3721


Note

Overview
OpenFeature evaluation contexts are now normalized before they become LDContext, so custom attributes match OpenFeature provider behavior (OFP 2.5.x) instead of being passed through as Ruby objects.

EvaluationContextConverter routes non-reserved attributes through a new convert_value helper: JSON scalars stay as-is; Time / DateTime become UTC ISO-8601 strings (with fractional seconds when present); Date becomes midnight UTC; arrays and hashes are converted recursively. Unsupported types are nil with an error log. Input hashes/arrays are not mutated. Conversion applies in single- and multi-kind contexts.

Specs cover timezone conversion without mutating frozen inputs, nested structures, unsupported types, fractional seconds, and multi-context attributes.

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

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@kinyoklion
kinyoklion marked this pull request as ready for review November 16, 2026 22:20
@kinyoklion
kinyoklion requested a review from a team as a code owner November 16, 2026 22:20
@cursor cursor Bot added the risk:medium label Nov 16, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Risk: medium.

Automated risk review (dry run): Medium

This PR would not be automatically approved. Human approval required.

Why: This updates evaluation-context conversion in lib/ldclient-openfeature/impl/context_converter.rb so custom attributes used for targeting are transformed (dates to UTC ISO-8601, nested structures recursively, unsupported types to null), which is a bounded but meaningful SDK evaluation-behavior change. Tests in spec/impl/context_converter_spec.rb cover it, but that does not make the targeting behavior change Low risk.

If you disagree with this review, share this PR in #feedback-agent-approvals or submit a changes-requested review explaining why.

Open in Web View Automation 

Sent by Cursor Approval Agent: Dry-Run PR Approver

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant