Skip to content

feat(openfeature): activate delivery during provider initialization - #6295

Draft
pavlokhrebto wants to merge 13 commits into
pavlo.khrebto/FFLSDK-10/agentless-deliveryfrom
pavlo.khrebto/FFLSDK-10/provider-initialization
Draft

pavlokhrebto wants to merge 13 commits into
pavlo.khrebto/FFLSDK-10/agentless-deliveryfrom
pavlo.khrebto/FFLSDK-10/provider-initialization

Conversation

@pavlokhrebto

@pavlokhrebto pavlokhrebto commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Activates the selected Feature Flags configuration source when the Datadog OpenFeature provider initializes and waits for the first valid configuration. It reports initialization timeouts as provider errors, supports late recovery to ready, emits configuration-change events, and dynamically registers Remote Configuration capabilities and receivers.

Configuration activation is owned by the Datadog component tree, including preservation of the adopted provider across Datadog.configure component rebuilds.

Motivation:

This layer connects the configuration, readiness, and delivery primitives introduced by the preceding PRs to the public OpenFeature provider. Provider replacement, fork recovery, configuration-loss events, and Remote Configuration synchronization were extracted into #6323 so both PRs remain focused and reviewable.

Change log entry

Yes. Adds agentless configuration delivery and initialization lifecycle support to the Datadog OpenFeature provider.

Additional Notes:

Warning

This is PR 4 of a 5-PR stack. It contains code that depends on its parent PRs and is completed by #6323; it must not be merged directly into master.

Merge the stack last-to-first: #6323 into #6295, #6295 into #6294, #6294 into #6292, #6292 into #6291, and finally #6291 into master.

The five PRs are split only to allow focused reviews and will land atomically as one feature.

How to test the change?

StandardRB and full Steep type checking pass. The OpenFeature rake suite passes on Ruby 3.1 and Ruby 4.0. Targeted activation, provider initialization, component-tree, Remote Configuration registration, dispatcher, and component-state coverage is included.

@linear-code

linear-code Bot commented Sep 8, 2026

Copy link
Copy Markdown

FFLSDK-10

@dd-octo-sts dd-octo-sts Bot added core Involves Datadog core libraries openfeature A new component that provider an ability to configure feature flags labels Sep 8, 2026
@dd-octo-sts

dd-octo-sts Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Thank you for updating Change log entry section 👏

Visited at: 2026-09-09 09:35:43 UTC

@dd-octo-sts

dd-octo-sts Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Typing analysis

Note: Ignored files are excluded from the next sections.

Untyped methods

This PR introduces 1 partially typed method. It increases the percentage of typed methods from 71.71% to 71.92% (+0.21%).

Partially typed methods (+1-0)Introduced:
sig/datadog/open_feature/provider.rbs:76
└── def provider_error: (Hash[Symbol, untyped] details) -> void

Untyped other declarations

This PR introduces 1 partially typed other declaration. It increases the percentage of typed other declarations from 86.09% to 86.22% (+0.13%).

Partially typed other declarations (+1-0)Introduced:
sig/datadog/open_feature/provider.rbs:20
└── @error_handler: (^(Hash[Symbol, untyped]) -> void)?

If you believe a method or an attribute is rightfully untyped or partially typed, you can add # untyped:accept on the line before the definition to remove it from the stats.

@datadog-prod-us1-3

datadog-prod-us1-3 Bot commented Sep 8, 2026

Copy link
Copy Markdown

Tests

All CI checks and tests passed.

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 93.52%
Overall Coverage: 90.47% (+0.01%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 6da2a15 | Docs | View more details | Give us feedback!

@pavlokhrebto pavlokhrebto changed the title feat(openfeature): activate configuration delivery on provider initia… feat(openfeature): activate delivery during provider initialization Sep 9, 2026
@pavlokhrebto
pavlokhrebto requested a lite review from Copilot September 10, 2026 17:10

Copilot AI 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.

🟡 Changes recommended

The system-tests.yml reusable workflow call is no longer pinned to an immutable commit SHA, which is a supply-chain and reproducibility risk for CI.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR wires the OpenFeature provider’s initialization lifecycle to Datadog Feature Flags configuration delivery: adopting a provider now activates the configured delivery source, waits for the first valid configuration (or times out), and emits OpenFeature SDK provider events to reflect readiness/error transitions. It also introduces runtime Remote Configuration registration and receiver updates so Feature Flags capabilities can be enabled dynamically when the provider is adopted.

Changes:

  • Add Datadog::OpenFeature::Activation to manage eager Remote Configuration start vs. lazy agentless delivery start on provider adoption, and to forward component configuration-change events to the provider.
  • Update Datadog::OpenFeature::Provider#init to activate delivery, block until initial configuration (with timeout/error reporting), and emit OpenFeature SDK events (PROVIDER_ERROR, PROVIDER_READY, PROVIDER_CONFIGURATION_CHANGED).
  • Extend Remote Configuration runtime plumbing (dispatcher, component, capabilities) to support idempotent receiver/capability registration for already-running clients.
File summaries
File Description
vendor/rbs/openfeature-sdk/0/openfeature-sdk.rbs Expand vendored OpenFeature SDK stubs to cover event emitter, provider events/state, and configuration handlers used by the provider lifecycle.
spec/datadog/open_feature/provider_spec.rb Add provider initialization and event-ordering coverage (timeout/error then late recovery, config-changed emission).
spec/datadog/open_feature/provider_span_enrichment_spec.rb Update provider installation path to account for initialization waiting/activation behavior.
spec/datadog/open_feature/component_spec.rb Update component build signature and add expectations for configuration-change callback behavior.
spec/datadog/open_feature/activation_spec.rb New spec suite covering activation idempotency, concurrency serialization, delivery source selection, and shutdown behavior.
spec/datadog/open_feature_spec.rb Adjust expectations to reflect engine build vs. delivery/provider adoption timing.
spec/datadog/core/remote/dispatcher_spec.rb Add coverage for dynamic receiver registration and receiver collection encapsulation.
spec/datadog/core/remote/component_spec.rb Add coverage ensuring runtime register updates both future and current client dispatchers/capabilities.
spec/datadog/core/remote/client/capabilities_spec.rb Update base64 helper signature usage and add coverage for runtime registration idempotency/atomicity.
spec/datadog/core/configuration/components_state_spec.rb Add coverage for persisting adopted OpenFeature provider across component-tree replacement.
spec/datadog/core/configuration/components_spec.rb Add coverage for eager OpenFeature delivery start and provider reactivation from prior component state.
sig/datadog/open_feature/provider.rbs Type provider initialization state, OpenFeature event emitter inclusion, and internal lifecycle helpers.
sig/datadog/open_feature/component.rbs Add configuration event type and callback typing for configuration-change notifications.
sig/datadog/open_feature/activation.rbs New RBS for Activation API and its delivery-start helpers.
sig/datadog/core/remote/dispatcher.rbs Type the new receiver encapsulation and runtime receiver registration methods.
sig/datadog/core/remote/component.rbs Type new register API for runtime Remote Configuration capability/receiver updates.
sig/datadog/core/remote/client/capabilities.rbs Type runtime registration and adjust the base64 helper signature to accept explicit capabilities.
sig/datadog/core/configuration/components.rbs Update component API surface for OpenFeature activation and startup state carry-over.
sig/datadog/core/configuration/components_state.rbs Add open_feature_provider state typing for component-tree replacement behavior.
lib/datadog/open_feature/provider.rb Implement initialization lifecycle: activate delivery, wait for initial config, handle timeouts, and emit OpenFeature SDK events.
lib/datadog/open_feature/component.rb Add configuration-change event reporting and callback forwarding from reconfigure!.
lib/datadog/open_feature/activation.rb New activation orchestrator to start selected delivery source and bridge component events to the adopted provider.
lib/datadog/core/remote/dispatcher.rb Encapsulate receiver list and add thread-safe runtime receiver registration.
lib/datadog/core/remote/component.rb Add register to update both future client capabilities and the current client dispatcher.
lib/datadog/core/remote/client/capabilities.rb Add atomic runtime registration (capabilities/products/receivers) and synchronize access to capability state/base64.
lib/datadog/core/configuration/components.rb Replace direct OpenFeature component construction with activation-driven lifecycle; persist adopted provider in state and reactivate after rebuild.
lib/datadog/core/configuration/components_state.rb Persist adopted OpenFeature provider across component tree replacements.
.github/workflows/system-tests.yml Update system-tests workflow reference (currently to a branch ref).
Review details

Suppressed comments (4)

sig/datadog/core/remote/client/capabilities.rbs:27

  • These method return types also use unnecessary :: prefixes for core types; prefer Array[...]/Integer/String without :: for consistency with other signatures in this repo.
          def capabilities: () -> ::Array[::Integer]

          def products: () -> ::Array[::String]

          def receivers: () -> ::Array[Core::Remote::Dispatcher::Receiver]

sig/datadog/core/remote/client/capabilities.rbs:35

  • Keyword argument types here also don’t need :: prefixes for core classes; using Array[Integer]/Array[String] keeps the signatures aligned with repo conventions.
          def register_runtime: (
            capabilities: ::Array[::Integer],
            products: ::Array[::String],
            receivers: ::Array[Core::Remote::Dispatcher::Receiver]
          ) -> void

sig/datadog/core/configuration/components_state.rbs:17

  • This keyword arg type can also drop the redundant Datadog:: prefix within the Datadog namespace (OpenFeature::Provider?).
          ?open_feature_provider: Datadog::OpenFeature::Provider?

sig/datadog/core/configuration/components_state.rbs:26

  • The attr_reader type should be OpenFeature::Provider? here as well for consistency (no redundant Datadog:: prefix inside the Datadog module).
        attr_reader open_feature_provider: Datadog::OpenFeature::Provider?
  • Files reviewed: 27/28 changed files
  • Comments generated: 5
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread .github/workflows/system-tests.yml Outdated
Comment thread .github/workflows/system-tests.yml Outdated
Comment thread sig/datadog/core/configuration/components_state.rbs Outdated
Comment thread sig/datadog/core/remote/client/capabilities.rbs Outdated
Comment thread sig/datadog/core/remote/component.rbs
Comment thread lib/datadog/core/configuration/components.rb Outdated
Comment thread lib/datadog/open_feature/activation.rb
Comment thread lib/datadog/open_feature/activation.rb
Comment thread .github/workflows/system-tests.yml Outdated
Comment thread lib/datadog/open_feature/provider.rb
Comment thread lib/datadog/core/configuration/components.rb Outdated
Comment thread lib/datadog/core/remote/component.rb
Comment thread lib/datadog/open_feature/component.rb Outdated
Comment thread spec/datadog/open_feature/activation_spec.rb Outdated
Comment thread spec/datadog/core/remote/client/capabilities_spec.rb
@pavlokhrebto
pavlokhrebto marked this pull request as ready for review September 15, 2026 10:09
@pavlokhrebto
pavlokhrebto requested review from a team as code owners September 15, 2026 10:09
@pavlokhrebto
pavlokhrebto requested review from TonyCTHsu, danyal002 and leoromanovsky and removed request for a team September 15, 2026 10:09
@pavlokhrebto
pavlokhrebto removed the request for review from danyal002 September 15, 2026 10:09

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8601fb1164

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread lib/datadog/open_feature/activation.rb
Comment thread lib/datadog/open_feature/activation.rb
Comment thread lib/datadog/core/configuration/components.rb
@pavlokhrebto
pavlokhrebto marked this pull request as draft September 15, 2026 11:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Involves Datadog core libraries openfeature A new component that provider an ability to configure feature flags

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants