Skip to content

fix: Call identify hooks during init.#331

Open
beekld wants to merge 5 commits intomainfrom
beeklimt/SDK-2048
Open

fix: Call identify hooks during init.#331
beekld wants to merge 5 commits intomainfrom
beeklimt/SDK-2048

Conversation

@beekld
Copy link

@beekld beekld commented Mar 19, 2026

Requirements

  • I have added test coverage for new or changed functionality
  • I have followed the repository's pull request submission guidelines
  • I have validated my changes against all supported platform versions

Related issues

N/A

Describe the solution you've provided

Before this change, beforeIdentify and afterIdentify were only called when identify was called. After this change, they are also called as part of init.

Describe alternatives you've considered

None.

Additional context

I don't think this would be considered a breaking change, but I wouldn't mind a second opinion. The change in behavior is observable by the user, but the new behavior is what was originally intended. So I would consider this a bugfix, and would not expect customers to need to make any changes to their code to deal with the change.


Note

Medium Risk
Changes initialization behavior to run beforeIdentify/afterIdentify hooks during LDClient.init, which is user-observable and could affect hook implementations that assume identifies only occur on explicit calls. Logic is straightforward but touches the core startup path and error handling.

Overview
Calls identify hooks during initialization. LDClient.init now starts an implicit identify series via hookRunner.identify(modifiedContext, null) and ensures afterIdentify is invoked with COMPLETED or ERROR when each environment finishes (via a new CompleteWhenCounterZero callback).

Updates tests to reflect the new implicit identify. Hook/plugin instrumentation tests now expect an extra identify hook call from init (and adjust assertions/indexing accordingly).

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

@beekld beekld marked this pull request as ready for review March 19, 2026 19:34
@beekld beekld requested a review from a team as a code owner March 19, 2026 19:34
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 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.

Copy link
Member

@kinyoklion kinyoklion left a comment

Choose a reason for hiding this comment

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

I also agree this is non-breaking. It was the intended behavior, also the primary consumer of this is also us. For our observability plugins.

@kinyoklion kinyoklion self-requested a review March 20, 2026 16:30
@beekld beekld requested a review from tanderson-ld March 20, 2026 22:11
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.

3 participants