Skip to content

feat: common identify now reports identify status#1289

Draft
joker23 wants to merge 7 commits intomainfrom
skz/sdk-1657/consolidate-client-identify
Draft

feat: common identify now reports identify status#1289
joker23 wants to merge 7 commits intomainfrom
skz/sdk-1657/consolidate-client-identify

Conversation

@joker23
Copy link
Copy Markdown
Contributor

@joker23 joker23 commented Apr 17, 2026

This PR will consolidate the identify implementation in the sdk common level.

sdk-2078
sdk-2081
sdk-2082

The change here is that identify will always return a promise that resolves to a result. This pattern allows for better identify status tracking.

A few caveats:

  • we will continue having react native conform to the old identify function signiture
  • we have another work item to assess removing the proxy implementation that browser and electron sdk uses to compat the identify function

Note

Medium Risk
Changes the public identify() contract across the shared client and browser/electron SDKs from throwing/void to returning LDIdentifyResult, requiring downstream callers to handle {status} outcomes; behavior differences (timeouts/errors no longer reject) could break assumptions.

Overview
Unifies identify() to always return an LDIdentifyResult (completed/error/timeout/shed) and guarantees the Promise does not reject, removing the separate identifyResult() API and updating the shared LDClient type accordingly.

Browser and Electron clients are updated to call/forward the new identify() (including IPC handlers and PIMPL facades) while still defaulting sheddable: true in their overrides; related tests are rewritten to assert returned status objects instead of promise rejections.

React Native preserves backward compatibility by exporting an RN-specific LDClient type with identify(): Promise<void> semantics and overriding ReactNativeLDClient.identify() to throw on error/timeout (and explicitly disallowing start()).

Reviewed by Cursor Bugbot for commit b88b805. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions
Copy link
Copy Markdown
Contributor

@launchdarkly/js-sdk-common size report
This is the brotli compressed size of the ESM build.
Compressed size: 25623 bytes
Compressed size limit: 29000
Uncompressed size: 125843 bytes

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 17, 2026

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 17, 2026

@launchdarkly/js-client-sdk size report
This is the brotli compressed size of the ESM build.
Compressed size: 31669 bytes
Compressed size limit: 34000
Uncompressed size: 112804 bytes

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 17, 2026

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

@joker23 joker23 changed the title skz/sdk 1657/consolidate client identify feat: common identify now reports identify status Apr 17, 2026
override async identify(
context: LDContext,
identifyOptions?: LDIdentifyOptions,
): Promise<LDIdentifyResult> {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think should be okay because I don't think anyone is checking for void returns?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It doesn't make me particularly comfortable to actually be returning something.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yea, I don't think we could really do this step comfortably until we major version RN... which is fine... I'll move this back to draft or close, otherwise the changes seem fairly trivial.

@joker23
Copy link
Copy Markdown
Contributor Author

joker23 commented Apr 17, 2026

@cursor review

cursor[bot]

This comment was marked as resolved.

@joker23
Copy link
Copy Markdown
Contributor Author

joker23 commented Apr 17, 2026

@cursor review

Copy link
Copy Markdown

@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.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 5e0b4cb. Configure here.

@joker23
Copy link
Copy Markdown
Contributor Author

joker23 commented Apr 20, 2026

@cursor review

cursor[bot]

This comment was marked as resolved.

@joker23
Copy link
Copy Markdown
Contributor Author

joker23 commented Apr 21, 2026

@cursor review

Copy link
Copy Markdown

@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 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit b88b805. Configure here.

this.logger.error(timeoutError.message);
throw timeoutError;
}
return result;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

RN identify rejects despite interface promising no rejection

Medium Severity

ReactNativeLDClient.identify() throws on error and timeout statuses, but the base LDClient interface now explicitly documents that "The promise returned from this method will not be rejected." The RN constructor passes this directly to internal.safeRegisterPlugins, so plugins receive a client whose identify can reject — violating the contract they rely on. A plugin calling identify without a try-catch (reasonable given the new contract) risks unhandled promise rejections in the React Native SDK specifically.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit b88b805. Configure here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is intentional

@joker23 joker23 marked this pull request as ready for review April 21, 2026 21:08
@joker23 joker23 requested a review from a team as a code owner April 21, 2026 21:08
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 4 additional findings.

Open in Devin Review

@joker23 joker23 marked this pull request as draft April 22, 2026 14:43
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