Skip to content

chore: improve repository quality, metadata, and contributor experience#242

Merged
josecolella merged 3 commits intomainfrom
chore/repo-improvements
Mar 8, 2026
Merged

chore: improve repository quality, metadata, and contributor experience#242
josecolella merged 3 commits intomainfrom
chore/repo-improvements

Conversation

@josecolella
Copy link
Collaborator

Summary

Brings the Ruby SDK repository up to parity with sibling OpenFeature SDKs (Go, Java, .NET) and Ruby community standards based on a comparative analysis.

Gemspec Fixes (High Priority)

  • Fix all URLs from stale openfeature-ruby to correct ruby-sdkRubyGems links were broken
  • Fix description typo ("an the specifications" → proper description)
  • Add rubygems_mfa_required metadata (modern security best practice)
  • Move dev dependencies from gemspec to Gemfile (modern Ruby gem convention)

README Improvements (High Priority)

  • Add CI status, RubyGems version, and Codecov coverage badges
  • Add Ruby version maintenance policy note
  • Add Known Providers table (flagd, Flipt, Flagsmith, GO Feature Flag)

CONTRIBUTING.md Fixes (Medium Priority)

  • Fix Ruby version mismatch (said 3.0, gemspec requires 3.4)
  • Add Cucumber/Gherkin test instructions
  • Document Standard Ruby linting (not RuboCop)

CI/CD Improvements (Medium Priority)

  • Add Cucumber/Gherkin conformance job
  • Add Ruby head to matrix with continue-on-error for early breakage detection
  • Add bundler-audit security scanning job
  • Update status job to depend on all new jobs

New Repository Files (Medium Priority)

  • SECURITY.md — CNCF/CII best practice for vulnerability reporting
  • .yardopts + YARD Rake task — enables API documentation generation
  • examples/ directory — basic_usage.rb, custom_provider.rb, rails_integration.rb

Minor Improvements (Low Priority)

  • Add minimum_coverage 90 to SimpleCov
  • Add Gemfile.lock to .gitignore (gem convention)

Verification

Check Result
bundle exec rspec 420 examples, 0 failures (99.5% coverage)
bundle exec standardrb 77 files, no offenses
gem build openfeature-sdk.gemspec Builds successfully
gem specification metadata All URLs correctly point to ruby-sdk

Test plan

  • All existing RSpec tests pass
  • Standard Ruby lint passes with no offenses
  • Gem builds successfully with correct metadata
  • Verify README badges render correctly on GitHub
  • Verify Cucumber CI job runs on push
  • Verify bundler-audit CI job runs on push

🤖 Jose's AI agent

- Fix gemspec URLs (openfeature-ruby → ruby-sdk) and description typo
- Add rubygems_mfa_required metadata for security
- Move dev dependencies from gemspec to Gemfile
- Add CI/coverage/gem version badges to README
- Add Ruby version policy and known providers table to README
- Fix CONTRIBUTING.md Ruby version (3.0 → 3.4)
- Document Standard Ruby linting and Cucumber tests in CONTRIBUTING.md
- Add Cucumber conformance and bundler-audit jobs to CI
- Add Ruby head to CI matrix with continue-on-error
- Create SECURITY.md for vulnerability reporting
- Add .yardopts and YARD rake task for API docs
- Create examples/ directory (basic_usage, custom_provider, rails_integration)
- Add SimpleCov minimum_coverage 90
- Add Gemfile.lock to .gitignore

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Jose Colella <jose.colella@gusto.com>
@josecolella josecolella requested a review from a team as a code owner March 8, 2026 18:16
@gemini-code-assist
Copy link

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request aims to enhance the overall quality, metadata, and contributor experience of the Ruby SDK. It aligns the repository with other OpenFeature SDKs and Ruby community best practices by addressing gemspec issues, improving documentation, refining CI/CD processes, and adding new examples and security guidelines.

Highlights

  • Gemspec Fixes: Corrected broken RubyGems links, fixed a description typo, added "rubygems_mfa_required" for security, and moved development dependencies to the Gemfile.
  • README Improvements: Integrated CI status, RubyGems version, and Codecov coverage badges, included a Ruby version maintenance policy, and listed known providers.
  • CONTRIBUTING.md Fixes: Updated the Ruby version requirement to 3.4, added instructions for Cucumber/Gherkin tests, and documented the use of Standard Ruby for linting.
  • CI/CD Improvements: Introduced a Cucumber/Gherkin conformance job, added Ruby "head" to the build matrix with "continue-on-error", and integrated "bundler-audit" for security scanning.
  • New Repository Files: Added "SECURITY.md" for vulnerability reporting, ".yardopts" and a YARD Rake task for API documentation, and an "examples/" directory with usage examples.
  • Minor Improvements: Set "minimum_coverage 90" for SimpleCov and added "Gemfile.lock" to ".gitignore".
Changelog
  • .gitignore
    • Added "Gemfile.lock" to the ignore list.
  • .simplecov
    • Configured "minimum_coverage" to 90%.
  • .yardopts
    • Added a new file to configure YARD documentation generation.
  • CONTRIBUTING.md
    • Updated the minimum Ruby version requirement from 3.0 to 3.4.
    • Added instructions for running Cucumber Gherkin tests.
    • Documented the use of Standard Ruby for linting.
  • Gemfile
    • Grouped development and test dependencies.
    • Moved several development dependencies from "openfeature-sdk.gemspec" to "Gemfile".
  • README.md
    • Added CI build status, RubyGems version, and Codecov badges.
    • Included a note about Ruby version maintenance policy.
    • Added a table listing known OpenFeature providers.
  • Rakefile
    • Added a YARD Rake task for generating API documentation.
  • SECURITY.md
    • Added a new file outlining the security policy and vulnerability reporting process.
  • examples/basic_usage.rb
    • Added a new example demonstrating basic OpenFeature SDK usage with an in-memory provider.
  • examples/custom_provider.rb
    • Added a new example illustrating how to create a custom OpenFeature provider.
  • examples/rails_integration.rb
    • Added a new example showing patterns for integrating OpenFeature with Ruby on Rails.
  • openfeature-sdk.gemspec
    • Updated the project description for clarity.
    • Corrected all repository URLs from "openfeature-ruby" to "ruby-sdk".
    • Added "rubygems_mfa_required" metadata.
    • Removed development dependencies, as they were moved to "Gemfile".
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/main.yml
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@codecov
Copy link

codecov bot commented Mar 8, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.50%. Comparing base (56520ef) to head (7244871).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #242   +/-   ##
=======================================
  Coverage   99.50%   99.50%           
=======================================
  Files          31       31           
  Lines         808      808           
=======================================
  Hits          804      804           
  Misses          4        4           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a wide range of improvements to the repository, enhancing quality, metadata, and contributor experience. The changes align the Ruby SDK with other OpenFeature SDKs and community best practices. My review found a couple of areas for improvement: one regarding dependency grouping in the Gemfile for better maintainability, and a more critical issue in a new Rails integration example that could lead to resource leaks if used as-is.

Comment on lines +32 to +42
# def call(env)
# request = ActionDispatch::Request.new(env)
# OpenFeature::SDK.set_transaction_context(
# OpenFeature::SDK::EvaluationContext.new(
# targeting_key: request.session[:user_id]&.to_s,
# "ip" => request.remote_ip,
# "user_agent" => request.user_agent
# )
# )
# @app.call(env)
# end

Choose a reason for hiding this comment

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

high

The example OpenFeatureContextMiddleware sets the transaction context using thread-local storage but fails to clear it after the request is complete. In a multi-threaded server environment (like Puma, which is common for Rails), this will cause the context to leak between requests handled by the same thread, leading to incorrect evaluations and potential data exposure. The context should be cleared within an ensure block to guarantee cleanup, even if the request processing raises an error.

#   def call(env)
#     request = ActionDispatch::Request.new(env)
#     OpenFeature::SDK.set_transaction_context(
#       OpenFeature::SDK::EvaluationContext.new(
#         targeting_key: request.session[:user_id]&.to_s,
#         "ip" => request.remote_ip,
#         "user_agent" => request.user_agent
#       )
#     )
#     @app.call(env)
#   ensure
#     # Clear context to prevent leakage in threaded servers.
#     OpenFeature::SDK.set_transaction_context(nil)
#   end
References
  1. Cleanup of thread-local storage is the responsibility of the consumer of the SDK. Automatic cleanup mechanisms should be provided in framework-specific integration gems, not the core SDK.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good catch! Fixed — added an ensure block to clear the transaction context after the request completes, preventing thread-local leakage in multi-threaded servers like Puma.

🤖 Jose's AI agent

Comment on lines +8 to +23
group :development, :test do
gem "debug"
gem "markly"
gem "rake", "~> 13.0"
gem "rspec", "~> 3.12.0"
gem "standard"
gem "standard-performance"
gem "simplecov", "~> 0.22.0"
gem "simplecov-cobertura", "~> 3.0"
gem "timecop", "~> 0.9.10"
end

group :test do
gem "cucumber", "~> 10.0"
gem "logger"
end

Choose a reason for hiding this comment

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

medium

For consistency and to reduce redundancy, the gems in the separate :test group can be merged into the :development, :test group. This keeps all development and test-related dependencies consolidated in a single block, improving the Gemfile's readability and maintainability.

group :development, :test do
  gem "debug"
  gem "markly"
  gem "rake", "~> 13.0"
  gem "rspec", "~> 3.12.0"
  gem "standard"
  gem "standard-performance"
  gem "simplecov", "~> 0.22.0"
  gem "simplecov-cobertura", "~> 3.0"
  gem "timecop", "~> 0.9.10"
  gem "cucumber", "~> 10.0"
  gem "logger"
end

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Keeping the groups separate is intentional — cucumber and logger are test-only dependencies that aren't needed during development. This is a common Ruby convention for gems that have distinct test harnesses (Cucumber for conformance tests) separate from the development workflow.

🤖 Jose's AI agent

josecolella and others added 2 commits March 8, 2026 11:20
Prevents thread-local context leakage in multi-threaded servers like
Puma by clearing the transaction context after each request.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Jose Colella <jose.colella@gusto.com>
- Add comment explaining trivial method implementations in custom_provider example
- Standardize Ruby version pinning to "3.4" across all CI jobs
- Use bundle lock instead of bundle install in security audit job

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Jose Colella <jose.colella@gusto.com>
@josecolella josecolella merged commit 8f16c1a into main Mar 8, 2026
22 checks passed
@josecolella josecolella deleted the chore/repo-improvements branch March 8, 2026 18:23
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.

1 participant