Skip to content

Commit 3bd329e

Browse files
authored
Merge branch 'main' into devin/1773165219-sdk-2009-server-testhook-migrations
2 parents 2540561 + cd4b119 commit 3bd329e

36 files changed

Lines changed: 435 additions & 101 deletions

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Package-level lint handles this via packages/sdk/react/.eslintrc.cjs overrides.
2+
packages/sdk/react/contract-tests/

.github/workflows/browser.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ jobs:
106106
sleep 5 # Give the browser time to initialize and connect via WebSocket
107107
108108
- name: Run contract tests
109-
uses: launchdarkly/gh-actions/actions/contract-tests@5adb11fd6953e1bc35d9cf1fc1b4374c464e3a8b
109+
uses: launchdarkly/gh-actions/actions/contract-tests@1a3dc56945c8e87bc952119b055f9481b4d642b0
110110
with:
111111
test_service_port: 8000
112112
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/electron.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ jobs:
6666
done
6767
6868
- name: Run contract tests
69-
uses: launchdarkly/gh-actions/actions/contract-tests@5adb11fd6953e1bc35d9cf1fc1b4374c464e3a8b
69+
uses: launchdarkly/gh-actions/actions/contract-tests@1a3dc56945c8e87bc952119b055f9481b4d642b0
7070
with:
7171
test_service_port: 8000
7272
token: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: sdk/react nightly
2+
3+
on:
4+
schedule:
5+
- cron: '0 0 * * *'
6+
7+
jobs:
8+
run-example:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
id-token: write
12+
steps:
13+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
14+
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
15+
with:
16+
node-version: 24
17+
- uses: ./actions/run-example
18+
with:
19+
workspace_name: '@internal/react-sdk-example-client-only'
20+
aws_assume_role: ${{ vars.AWS_ROLE_ARN }}
21+
before_test: 'yarn workspace @internal/react-sdk-example-client-only playwright install --with-deps chromium'

.github/workflows/react.yaml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ jobs:
7171
done
7272
sleep 5
7373
- name: Run contract tests
74-
uses: launchdarkly/gh-actions/actions/contract-tests@5adb11fd6953e1bc35d9cf1fc1b4374c464e3a8b
74+
uses: launchdarkly/gh-actions/actions/contract-tests@1a3dc56945c8e87bc952119b055f9481b4d642b0
7575
with:
7676
test_service_port: 8000
7777
token: ${{ secrets.GITHUB_TOKEN }}
@@ -82,3 +82,20 @@ jobs:
8282
[ -f /tmp/browser.pid ] && kill $(cat /tmp/browser.pid) || true
8383
[ -f /tmp/entity.pid ] && kill $(cat /tmp/entity.pid) || true
8484
[ -f /tmp/adapter.pid ] && kill $(cat /tmp/adapter.pid) || true
85+
86+
run-example:
87+
runs-on: ubuntu-latest
88+
permissions:
89+
id-token: write
90+
steps:
91+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
92+
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
93+
with:
94+
node-version: 24
95+
- uses: ./actions/run-example
96+
with:
97+
workspace_name: '@internal/react-sdk-example-client-only'
98+
aws_assume_role: ${{ vars.AWS_ROLE_ARN }}
99+
before_test: 'yarn workspace @internal/react-sdk-example-client-only playwright install --with-deps chromium'
100+
101+
# TODO: Add contract tests

.github/workflows/shopify-oxygen.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
run: yarn workspace @launchdarkly/shopify-oxygen-contract-tests build
3535
- name: Launch the test service in the background
3636
run: yarn workspace @launchdarkly/shopify-oxygen-contract-tests start &> /dev/null &
37-
- uses: launchdarkly/gh-actions/actions/contract-tests@5adb11fd6953e1bc35d9cf1fc1b4374c464e3a8b
37+
- uses: launchdarkly/gh-actions/actions/contract-tests@1a3dc56945c8e87bc952119b055f9481b4d642b0
3838
with:
3939
test_service_port: 8000
4040
token: ${{ secrets.GITHUB_TOKEN }}

actions/run-example/action.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Composite action for running an example app e2e test.
2+
# Note: id-token: write permission must be declared on the calling job.
3+
name: Run Example App
4+
inputs:
5+
workspace_name:
6+
description: 'Yarn workspace name of the example app, e.g. @internal/react-sdk-example-client-only'
7+
required: true
8+
aws_assume_role:
9+
description: 'AWS OIDC role ARN used to fetch secrets from SSM'
10+
required: true
11+
before_test:
12+
description: 'Shell commands to run before the e2e test step (e.g. install Playwright browsers)'
13+
default: ''
14+
runs:
15+
using: composite
16+
steps:
17+
- name: Install dependencies
18+
shell: bash
19+
run: yarn workspaces focus ${{ inputs.workspace_name }}
20+
21+
- uses: launchdarkly/gh-actions/actions/release-secrets@1a3dc56945c8e87bc952119b055f9481b4d642b0
22+
name: 'Get the client-side SDK key'
23+
with:
24+
aws_assume_role: ${{ inputs.aws_assume_role }}
25+
ssm_parameter_pairs: '/sdk/common/hello-apps/client-key = LAUNCHDARKLY_CLIENT_SIDE_ID'
26+
27+
- uses: launchdarkly/gh-actions/actions/release-secrets@1a3dc56945c8e87bc952119b055f9481b4d642b0
28+
name: 'Get the test feature flag key'
29+
with:
30+
aws_assume_role: ${{ inputs.aws_assume_role }}
31+
ssm_parameter_pairs: '/sdk/common/hello-apps/boolean-flag-key = LAUNCHDARKLY_FLAG_KEY'
32+
33+
- name: Build SDK dependencies
34+
shell: bash
35+
run: yarn workspaces foreach -pR --topological-dev --from '${{ inputs.workspace_name }}' run build
36+
37+
- name: Before test hook
38+
shell: bash
39+
if: ${{ inputs.before_test != '' }}
40+
run: ${{ inputs.before_test }}
41+
42+
- name: Run e2e tests
43+
shell: bash
44+
run: yarn workspace ${{ inputs.workspace_name }} test

packages/sdk/browser/__tests__/options.test.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,19 @@ it('does not override common config flushInterval if it is set', () => {
9090
const result = filterToBaseOptionsWithDefaults(opts);
9191
expect(result.flushInterval).toEqual(15);
9292
});
93+
94+
it('passes dataSystem through to base options without stripping', () => {
95+
const opts = {
96+
dataSystem: { initialConnectionMode: 'polling' },
97+
} as any;
98+
const result = filterToBaseOptionsWithDefaults(opts);
99+
expect((result as any).dataSystem).toEqual({ initialConnectionMode: 'polling' });
100+
});
101+
102+
it('passes an empty dataSystem through to base options', () => {
103+
const opts = {
104+
dataSystem: {},
105+
} as any;
106+
const result = filterToBaseOptionsWithDefaults(opts);
107+
expect((result as any).dataSystem).toEqual({});
108+
});

packages/sdk/browser/src/BrowserClient.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {
22
AutoEnvAttributes,
33
BasicLogger,
4+
BROWSER_DATA_SYSTEM_DEFAULTS,
45
browserFdv1Endpoints,
56
Configuration,
67
FlagManager,
@@ -110,6 +111,7 @@ class BrowserClientImpl extends LDClientImpl {
110111
includeAuthorizationHeader: false,
111112
highTimeoutThreshold: 5,
112113
userAgentHeaderName: 'x-launchdarkly-user-agent',
114+
dataSystemDefaults: BROWSER_DATA_SYSTEM_DEFAULTS,
113115
trackEventModifier: (event: internal.InputCustomEvent) =>
114116
new internal.InputCustomEvent(
115117
event.context,

packages/sdk/react-native/src/ReactNativeLDClient.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
LDEmitter,
1212
LDHeaders,
1313
LDPluginEnvironmentMetadata,
14+
MOBILE_DATA_SYSTEM_DEFAULTS,
1415
mobileFdv1Endpoints,
1516
} from '@launchdarkly/js-client-sdk-common';
1617

@@ -65,6 +66,7 @@ export default class ReactNativeLDClient extends LDClientImpl {
6566
getImplementationHooks: (_environmentMetadata: LDPluginEnvironmentMetadata) =>
6667
internal.safeGetHooks(logger, _environmentMetadata, validatedRnOptions.plugins),
6768
credentialType: 'mobileKey',
69+
dataSystemDefaults: MOBILE_DATA_SYSTEM_DEFAULTS,
6870
};
6971

7072
const platform = createPlatform(logger, options, validatedRnOptions.storage);

0 commit comments

Comments
 (0)