Skip to content

Conversation

@joalves
Copy link
Contributor

@joalves joalves commented Jan 26, 2026

Summary

  • Upgrade Ruby version from 3.0.6 to 3.3.10
  • Add explicit ostruct require for Ruby 3.3+ compatibility
  • Add custom_field_value method for accessing custom field values
  • Fix type coercion for custom field values (json, number, boolean types)
  • Add peek alias to peek_treatment method

Test plan

  • Tests pass on Ruby 3.3.10
  • Cross-SDK test compatibility verified

Summary by CodeRabbit

  • Chores

    • Updated Ruby to 3.3.10 for improved stability and performance.
  • New Features

    • Added a new peek alias for streamlined access to treatment information.
    • Introduced attribute-sequence tracking to improve experiment assignment consistency.
  • Bug Fixes

    • Fixed boolean field parsing for consistent handling of boolean values.
    • Tightened variant boundary checks to prevent invalid assignments.
    • Improved audience matching to avoid incorrect assignment reuse.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 26, 2026

Warning

Rate limit exceeded

@joalves has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 18 minutes and 25 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Walkthrough

The PR updates Ruby from 3.0.6 to 3.3.10, adds attribute-sequence tracking via a new @attrs_seq in Context and Assignment (exposed as Assignment.attrs_seq), introduces a private Context#audience_matches(experiment, assignment) helper, and adds alias peek for peek_treatment. Assignment selection now validates audience_matches and propagates attrs_seq; variant index bounds tightened. Boolean parsing for custom fields changed from to_bool to (value == "true"). spec/spec_helper.rb gains a duplicate require "ostruct".

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested reviewers

  • marcio-absmartly
  • cwmpinho
  • mario-silva

Poem

🐰 I nibble bytes and hop with glee,
attrs_seq marches after me,
Audiences checked, variants in line,
True or false I read just fine.
Ruby 3.3 gleams — a tiny, tidy sign.

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title mentions Ruby 3.3 compatibility, which aligns with the .ruby-version update and ostruct require addition, but undersells the substantial changes to lib/context.rb including new attribute sequencing tracking, audience matching logic, and boolean field parsing modifications.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@joalves joalves force-pushed the feat/ruby-3.3-compatibility branch from 1107860 to 9f29c56 Compare January 26, 2026 10:01
- Add custom_field_value method for accessing custom field values
- Fix type coercion for custom field values (json, number, boolean types)
@joalves joalves force-pushed the feat/ruby-3.3-compatibility branch from 48aa997 to ad0aea2 Compare January 26, 2026 10:21
- Upgrade Ruby version from 3.0.6 to 3.3.10
- Update gem dependencies for compatibility
- Add peek alias to peek_treatment method
@joalves joalves force-pushed the feat/ruby-3.3-compatibility branch from ad0aea2 to 3c01a7a Compare January 26, 2026 10:24
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
lib/context.rb (1)

555-560: Handle boolean custom fields provided as actual booleans or differently-cased strings.

custom_value == "true" will coerce true (boolean) and "TRUE" to false, which can silently flip values if upstream JSON booleans or case variants appear. Consider normalising.

🔧 Proposed fix
-                elsif custom_field_value.type.start_with?("boolean")
-                  value.value = custom_value == "true"
+                elsif custom_field_value.type.start_with?("boolean")
+                  value.value = (custom_value == true) || custom_value.to_s.casecmp?("true")

- Add object key containment test for in_operator
- Add peek_treatment audience re-evaluation tests
- Add treatment audience re-evaluation tests for strict/non-strict modes
- Add tests for audience cache invalidation behavior
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