Skip to content

feat(core): pass bound domain to provider init and enforce domain-scoped binding - #298

Closed
jonathannorris wants to merge 3 commits into
mainfrom
feat/domain-scoped-provider-init
Closed

jonathannorris wants to merge 3 commits into
mainfrom
feat/domain-scoped-provider-init

Conversation

@jonathannorris

Copy link
Copy Markdown
Member

Summary

  • Add optional domain: keyword to provider init and pass the bound domain from the provider mutator (spec 1.1.2.2, 2.4.1)
  • Add domain_scoped? provider declaration and reject binding a domain-scoped instance to more than one domain (spec 2.4.3, 1.1.8.1)
  • Add conformance tests, including legacy single-argument init backward compatibility

Motivation

Unblocks OFREP static-context providers that need the bound domain at init time to scope persisted cache keys per open-feature/spec#393 and protocol ADR 0009.

Parallel implementations: js-sdk#1433, java-sdk#1982, python-sdk#616.

Notes

  • Non-breaking: domain: is an optional keyword on init
  • Non-domain-scoped providers retain existing behavior (single instance can back multiple domains; init runs once)
  • Legacy providers that only implement init(evaluation_context) remain compatible; the registry inspects the init signature on the class and omits domain: when it is not accepted

Test plan

  • bundle exec rspec (431 examples)
  • bundle exec steep check
  • bundle exec standardrb

…ped binding

Signed-off-by: Jonathan Norris <jonathan.norris@dynatrace.com>
@coderabbitai

coderabbitai Bot commented Jul 3, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f0aea4eb-4750-4997-b4d5-f3853a27b0cc

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

Signed-off-by: Jonathan Norris <jonathan.norris@dynatrace.com>
@codecov

codecov Bot commented Jul 3, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.52%. Comparing base (0e986fd) to head (fc504e7).
⚠️ Report is 14 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #298      +/-   ##
==========================================
+ Coverage   99.50%   99.52%   +0.02%     
==========================================
  Files          31       31              
  Lines         808      851      +43     
==========================================
+ Hits          804      847      +43     
  Misses          4        4              

☔ View full report in Codecov by Harness.
📢 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.

Signed-off-by: Jonathan Norris <jonathan.norris@dynatrace.com>
@josecolella

Copy link
Copy Markdown
Collaborator

Hi Jonathan, this is on the spec v0.9.0 path (#300). Are you planning to take it out of draft soon? I'm starting a small stack of changes in configuration.rb (#341 detaches replaced providers; next come event ordering for #332 and provider-owned lifecycle events). The stack starts from main and doesn't depend on this PR. Whichever lands second will rebase onto the other, and I won't push to your branch. Two review notes for when you're ready:

  1. call_init reads the init signature from the class (instance_method_on_class). That misses providers that delegate through method_missing/respond_to_missing?; contrib's flagd ConfiguredClient does this. It doesn't break today, because flagd has no init.
  2. Are the .github/workflows/main.yml and Gemfile.lock changes intended for this PR?

@josecolella

Copy link
Copy Markdown
Collaborator

Hi @jonathannorris, I've taken this over in #345 so it can ship with the rest of the spec v0.9.0 work (#300).

  • Your two code commits are cherry-picked unchanged, so they keep your authorship and sign-off. I dropped the CI and lockfile commit, since main has moved past it.
  • One commit on top fixes three things:
    • init arguments. The signature is now read from provider.method(:init).parameters instead of the class chain. Delegating wrappers (like contrib flagd's ConfiguredClient), an init defined in a module, and (...) or *args signatures now get the right arguments.
    • Domain-scoped detection. domain_scoped? is detected with respond_to?, so a module can provide it. It's also called before the provider lock is taken.
    • Failed init. A provider whose init failed is no longer reported READY when it's set again, because each registration now tracks its init outcome.

I'd appreciate your review on #345. I'll close this PR once that one merges, and the squash commit will credit you as co-author.

@josecolella

Copy link
Copy Markdown
Collaborator

This shipped in #345 (released in 0.6.7). Your two commits are in it, and the squash commit f3cf6b7 credits you as co-author. Two small follow-up fixes are in #348. Closing this one in favor of #345. Thank you for the original implementation.

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