Commit e570f76
feat(openfeature): vendor the flagging provider instead of an optional peer dependency (#9570)
* feat(openfeature): return a ready provider from the openfeature entrypoint
dd-trace/openfeature previously only existed as a side-effect require for
file tracers (#9324). Turn it into the real public entrypoint: it now
returns a usable FlaggingProvider instance after tracer.init(), and
tracer.openfeature is deprecated in its favor since it doesn't work in
bundled applications.
Extract the base provider class into a factory so it can be constructed
from either the bundler-opaque require-provider wrapper (legacy
tracer.openfeature) or a plain require (the new entrypoint) without
duplicating the class body.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* test(openfeature): raise nft trace timeout for the entrypoint test
openfeature.js now pulls in the full tracer package to check
tracer.init() state, so nodeFileTrace has a much larger dependency
tree to walk. The default 5s mocha timeout was tight enough that CI
runners under load exceeded it.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* feat(openfeature): vendor the flagging provider instead of an optional peer
`@datadog/openfeature-node-server` was an optional peer dependency resolved
through a bundler-opaque require, requiring dedicated esbuild/webpack plugin
code to keep the require invisible when the peer wasn't installed (#8635) and
to inline it so bundles survived relocation when it was (#8980). Vendoring the
provider into `vendor/dist/` removes the need for a peer at all, so all of
that machinery (`feature-registry.js`, `register.js`, `require-provider.js`,
the optional-peer esbuild/webpack loaders, and their integration tests) is
deleted in favor of a single lazy `tracer.openfeature` property.
The vendored provider's only remaining external dependency is
`@openfeature/server-sdk`, used solely for `OpenFeatureEventEmitter` and
`ProviderEvents`. Bundling our own copy would give those a different identity
than the customer's, so it's externalized to a small bridge module
(`server-sdk-bridge.js`) that a new `openfeature-server-sdk` instrumentation
fills in from the customer's own `require()`.
`FlaggingProvider#initialize` also unrefs the vendored provider's
initialization timer, which otherwise keeps an idle process (a short script, a
serverless handler) alive for up to `initializationTimeoutMs` while waiting
for configuration to arrive. TODO left to remove this once
`@datadog/openfeature-node-server` unrefs it upstream.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(build): exclude unresolved peer entries from license check
scripts/check_licenses.js treated every non-dev entry in
vendor/package-lock.json as requiring license attribution, including
`peer: true` entries. Those record an unresolved peer dependency range
that npm never actually installs, so nothing is shipped for them. The
official dd-license-attribution tool used in CI already excludes these,
so the local script disagreed with CI and had two extraneous rows
(@openfeature/core, @openfeature/server-sdk) added to satisfy it.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* test(licenses): stop expecting npm peer dependencies to need attribution
The prior fix's comment claimed npm never installs peer entries, which is
false under npm 7+ auto-install-peers - vendor/node_modules physically has
@openfeature/core and @openfeature/server-sdk installed. The real reason
they don't need attribution is that peer dependencies are supplied by the
consumer rather than shipped by this package, matching how the yarn.lock
walk already excludes peerDependencies. The pre-existing vendor-peer test
fixture assumed the opposite and was never validated against real CI
behavior for a peer case, so it broke once the npm-lock scan started
excluding peers too.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(openfeature): implement full ProviderEventEmitter contract in the deferred bridge emitter
@openfeature/core's transferListeners always calls oldProvider.events?.removeHandler(...)
on every subsequent OpenFeature.setProvider() call for a domain, regardless of whether the
app registered any handlers itself. The deferred emitter only implemented addHandler/emit,
so replacing the Datadog OpenFeature provider with another provider at runtime threw
"oldProvider.events.removeHandler is not a function", crashing the customer's app.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(openfeature): address review feedback on tests and SSI scope
- Fix test:openfeature script so the instrumentation spec actually runs:
mocha treats a brace-only glob segment as a literal filename, so add
a wildcard segment that both mocha and verify-exercised-tests resolve.
- Add real esbuild/webpack black-box tests that bundle
@openfeature/server-sdk (not marked external) and assert dd-trace's
bundler-instrumentation mechanism still bridges the real event
emitter into the vendored provider.
- Correct comments in proxy.js and the dd-trace-api plugin: SSI itself
is fixed by this PR's vendoring; the only remaining gap is that the
dd-trace-api shim has no openfeature handoff.
Generated with Claude Code.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* feat(openfeature): drop the server-sdk event-emitter bridge
@datadog/openfeature-node-server 2.1.0 ships its own ProviderEventEmitter
and no longer depends on @openfeature/server-sdk at all (neither as a
dependency nor a peer), so the identity-preserving bridge this PR
introduced is no longer needed:
- Bump @datadog/openfeature-node-server to 2.1.0 everywhere it's pinned
(vendor, root devDependencies, plugin versions matrix) and rebuild
vendor/dist.
- Remove the @openfeature/server-sdk external redirect from
vendor/rspack.config.js -- the vendored provider no longer references
that package at all.
- Delete server-sdk-bridge.js, the openfeature-server-sdk require-hook
instrumentation, and their specs.
- Remove the now-obsolete esbuild/webpack black-box tests that verified
the bridge survived bundling -- there's no bridge left to verify.
- Update file-tracing.spec.js's expected traced files and loaded-modules
list to match.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(openfeature): update stale yarn.lock entry for openfeature-node-server
root package.json's devDependency was bumped to 2.1.0 but yarn.lock still
pinned 2.0.2, which made bun's yarn.lock-migration fail to resolve the
package in plugin test CI.
---------
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>1 parent 324b6cd commit e570f76
37 files changed
Lines changed: 190 additions & 1015 deletions
File tree
- integration-tests
- esbuild
- webpack
- packages
- datadog-esbuild
- test
- datadog-instrumentations
- src/helpers
- test/helpers
- datadog-plugin-dd-trace-api/src
- datadog-webpack
- src
- test
- dd-trace
- src
- noop
- openfeature
- test
- openfeature
- scripts
- vendor
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | 96 | | |
114 | 97 | | |
115 | 98 | | |
| |||
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | 98 | | |
105 | 99 | | |
106 | 100 | | |
| |||
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | 61 | | |
66 | 62 | | |
67 | 63 | | |
| |||
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
| 3 | + | |
| 4 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
187 | | - | |
188 | 187 | | |
189 | 188 | | |
190 | 189 | | |
| |||
197 | 196 | | |
198 | 197 | | |
199 | 198 | | |
| 199 | + | |
200 | 200 | | |
201 | 201 | | |
202 | 202 | | |
| |||
0 commit comments