Skip to content

Conversation

@joker23
Copy link
Contributor

@joker23 joker23 commented Jan 30, 2026

Note

Low Risk
Test-only configuration adaptation; low blast radius, with main risk being masking real config-shape issues if relied on beyond contract tests.

Overview
Contract tests client initialization now adapts dataSystem.synchronizers by converting an incoming array into the expected { primary, secondary } shape before building the SDK config.

This is explicitly marked as a temporary workaround (SDK-1798) and only affects how newSdkClientEntity passes configuration into makeSdkConfig during ld.init.

Written by Cursor Bugbot for commit 41edc61. This will update automatically on new commits. Configure here.

@joker23 joker23 requested a review from a team as a code owner January 30, 2026 20:40
@joker23 joker23 requested a review from tanderson-ld January 30, 2026 20:41
@github-actions
Copy link
Contributor

@launchdarkly/js-sdk-common size report
This is the brotli compressed size of the ESM build.
Compressed size: 25394 bytes
Compressed size limit: 26000
Uncompressed size: 124693 bytes

@github-actions
Copy link
Contributor

@launchdarkly/js-client-sdk-common size report
This is the brotli compressed size of the ESM build.
Compressed size: 18984 bytes
Compressed size limit: 20000
Uncompressed size: 98086 bytes

@github-actions
Copy link
Contributor

@launchdarkly/js-client-sdk size report
This is the brotli compressed size of the ESM build.
Compressed size: 23264 bytes
Compressed size limit: 25000
Uncompressed size: 80869 bytes

@github-actions
Copy link
Contributor

@launchdarkly/browser size report
This is the brotli compressed size of the ESM build.
Compressed size: 171249 bytes
Compressed size limit: 200000
Uncompressed size: 797978 bytes

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

adaptedConfigs.dataSystem.synchronizers = {
primary: options.configuration.dataSystem.synchronizers?.[0],
secondary: options.configuration.dataSystem.synchronizers?.[1],
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing null check causes crash when dataSystem undefined

High Severity

The code accesses adaptedConfigs.dataSystem.synchronizers without checking if dataSystem exists first. Since dataSystem is an optional property in SdkConfigOptions, this throws a TypeError when options.configuration.dataSystem is undefined. The makeSdkConfig function properly checks if (options.dataSystem) before accessing it, but this workaround code doesn't perform the same validation, creating an inconsistency that causes runtime crashes.

Fix in Cursor Fix in Web

adaptedConfigs.dataSystem.synchronizers = {
primary: options.configuration.dataSystem.synchronizers?.[0],
secondary: options.configuration.dataSystem.synchronizers?.[1],
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shallow copy causes unintended input mutation

Medium Severity

The shallow copy of options.configuration means adaptedConfigs.dataSystem still references the original object. When the code assigns adaptedConfigs.dataSystem.synchronizers to a new object structure, it mutates the original options.configuration.dataSystem.synchronizers, changing it from an array to an object. This unexpected side effect modifies the caller's input data, violating the principle that functions shouldn't mutate their parameters unless explicitly intended.

Fix in Cursor Fix in Web

@joker23 joker23 closed this Jan 30, 2026
@joker23 joker23 removed the request for review from tanderson-ld January 30, 2026 20:52
@joker23
Copy link
Contributor Author

joker23 commented Jan 30, 2026

Please ignore - I thought I could do a quick workaround...

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