Skip to content

Commit 83a7b06

Browse files
joker23claude
andauthored
chore: Port openfeature-node-server provider implementation, tests, and CI (#1394)
## Summary Final code slice of the openfeature-node-server lateral move (SDK-2213). Lands the actual provider behavior on top of the inert scaffold from SDK-2216 (PR #1356), wires CI gates around it, and ports the upstream test suite. This combines the previously-planned CI and impl/tests slices per replan on 2026-05-08 -- the work was tightly coupled enough that splitting added review overhead without much value. - \`src/LaunchDarklyProvider.ts\` -- ports the upstream provider (~42 lines). Extends \`BaseOpenFeatureProvider\` from \`@launchdarkly/openfeature-js-server-common\`, wires Node SDK \`update\` events to OpenFeature \`ConfigurationChanged\` events, sets \`wrapperName\` / \`wrapperVersion\` for telemetry. Logger is passed through to the base; the base wraps with \`createSafeLogger\`, so no double-wrap. - \`src/index.ts\` -- replaces the slice-2 stub with the real export. - \`__tests__/LaunchDarklyProvider.test.ts\` (413 lines) + \`TestLogger.ts\` -- full upstream test port. Provides end-to-end coverage by wiring \`OpenFeature.setProviderAndWait(ldProvider)\` against \`LaunchDarklyProvider\` whose \`LDClient\` uses \`integrations.TestData\` as the data source. Removes the slice-2 placeholder \`scaffold.test.ts\`. - \`.github/workflows/openfeature-node-server.yaml\` -- new CI workflow mirroring \`akamai-base.yml\` via the shared \`actions/ci\` step. - \`.github/workflows/release-please.yml\` -- adds the workspace_path option, the \`package-sdk-openfeature-node-server-released\` output, and a disabled \`release-openfeature-node-server\` job (\`if: false\` until post-GA). - \`.github/workflows/manual-publish-docs.yml\` -- adds the new workspace path. Resolves SDK-2325. Supersedes SDK-2217. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > New flag-evaluation and event-tracking surface on the server path, but behavior is largely delegated to existing shared provider logic and covered by extensive tests; automated release remains off (`if: false`). > > **Overview** > Replaces the `openfeature-node-server` scaffold with a real **LaunchDarkly OpenFeature provider** for Node: `LaunchDarklyProvider` extends shared `BaseOpenFeatureProvider`, initializes the Node server SDK with wrapper telemetry, and maps SDK `update` events to OpenFeature `ConfigurationChanged`. The public API now exports `LaunchDarklyProvider` instead of an empty stub. > > Adds a **ported Jest suite** (init/auth failure, flag-change events, typed evaluations, LD→OpenFeature error mapping, context logging, and `track` forwarding) plus a small `TestLogger`, and removes the placeholder scaffold test. **CI/release wiring** adds a dedicated workflow (Node 20/22 via shared `actions/ci`), registers the package in manual docs publish and release-please (including bumping `wrapperVersion` in `LaunchDarklyProvider.ts`), and introduces a **disabled** `release-openfeature-node-server` job until post-GA. TypeDoc config is added for the package. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 33f3fc8. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 891ffe2 commit 83a7b06

10 files changed

Lines changed: 546 additions & 8 deletions

File tree

.github/workflows/manual-publish-docs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ on:
2626
- packages/sdk/shopify-oxygen
2727
- packages/sdk/electron
2828
- packages/sdk/react
29+
- packages/sdk/openfeature-node-server
2930
name: Publish Documentation
3031
jobs:
3132
build-publish:
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: sdk/openfeature-node-server
2+
3+
on:
4+
push:
5+
branches: [main, 'feat/**']
6+
paths-ignore:
7+
- '**.md' #Do not need to run CI for markdown changes.
8+
pull_request:
9+
branches: [main, 'feat/**']
10+
paths-ignore:
11+
- '**.md'
12+
13+
jobs:
14+
build-test-openfeature-node-server:
15+
runs-on: ubuntu-latest
16+
17+
strategy:
18+
matrix:
19+
# Node versions to run on.
20+
version: [20, 22]
21+
22+
steps:
23+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
24+
- uses: ./actions/setup-yarn
25+
with:
26+
node-version: ${{ matrix.version }}
27+
registry-url: 'https://registry.npmjs.org'
28+
- id: shared
29+
name: Shared CI Steps
30+
uses: ./actions/ci
31+
with:
32+
workspace_name: '@launchdarkly/openfeature-node-server'
33+
workspace_path: packages/sdk/openfeature-node-server
34+
# TODO: Add contract tests

.github/workflows/release-please.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ on:
6262
- packages/sdk/shopify-oxygen
6363
- packages/sdk/electron
6464
- packages/sdk/react
65+
- packages/sdk/openfeature-node-server
6566
prerelease:
6667
description: 'Is this a prerelease. If so, then the latest tag will not be updated in npm.'
6768
type: boolean
@@ -105,6 +106,7 @@ jobs:
105106
package-sdk-shopify-oxygen-released: ${{ steps.release.outputs['packages/sdk/shopify-oxygen--release_created'] }}
106107
package-sdk-electron-released: ${{ steps.release.outputs['packages/sdk/electron--release_created'] }}
107108
package-sdk-react-released: ${{ steps.release.outputs['packages/sdk/react--release_created'] }}
109+
package-sdk-openfeature-node-server-released: ${{ steps.release.outputs['packages/sdk/openfeature-node-server--release_created'] }}
108110
steps:
109111
- uses: googleapis/release-please-action@45996ed1f6d02564a971a2fa1b5860e934307cf7 # v5.0
110112
id: release
@@ -519,6 +521,24 @@ jobs:
519521
workspace_path: packages/sdk/react
520522
aws_assume_role: ${{ vars.AWS_ROLE_ARN }}
521523

524+
release-openfeature-node-server:
525+
runs-on: ubuntu-latest
526+
needs: ['release-please', 'release-server-node']
527+
permissions:
528+
id-token: write
529+
contents: write
530+
# if: ${{ always() && !failure() && !cancelled() && needs.release-please.outputs.package-sdk-openfeature-node-server-released == 'true'}}
531+
# TODO: Uncomment this when the package is ready to be released.
532+
if: false
533+
steps:
534+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
535+
- id: release-openfeature-node-server
536+
name: Full release of packages/sdk/openfeature-node-server
537+
uses: ./actions/full-release
538+
with:
539+
workspace_path: packages/sdk/openfeature-node-server
540+
aws_assume_role: ${{ vars.AWS_ROLE_ARN }}
541+
522542
manual-publish:
523543
runs-on: ubuntu-latest
524544
if: github.event_name == 'workflow_dispatch'

0 commit comments

Comments
 (0)