Skip to content

fix: Call identify hooks during init.#331

Merged
beekld merged 7 commits intomainfrom
beeklimt/SDK-2048
Mar 23, 2026
Merged

fix: Call identify hooks during init.#331
beekld merged 7 commits intomainfrom
beeklimt/SDK-2048

Conversation

@beekld
Copy link
Contributor

@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
Behavior change: beforeIdentify/afterIdentify hooks now run implicitly during LDClient.init, which could affect apps/plugins that assume hooks only fire on explicit identify calls. The change touches initialization flow across multi-environment instances but is covered by updated and new instrumentation tests.

Overview
Identify hooks now run during LDClient.init. During startup, each environment instance invokes the identify hook series (beforeIdentify via hookRunner.identify, followed by afterIdentify with COMPLETED/ERROR based on startup outcome).

Tests were updated to account for the new implicit identify on init, and a new plugin test ensures identify hooks fire once per configured environment (primary + secondary) and again for explicit identify calls.

Written by Cursor Bugbot for commit c02c568. 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
Copy link
Contributor

@tanderson-ld tanderson-ld left a comment

Choose a reason for hiding this comment

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

The commit for updating to identify per instance did not contain any unit test changes. Consider seeing if it is trivial to test for the multi instance case where each instance gets its identify hook invoked. If it is not trivial it is not the end of the world to add.

@beekld
Copy link
Contributor Author

beekld commented Mar 23, 2026

The commit for updating to identify per instance did not contain any unit test changes. Consider seeing if it is trivial to test for the multi instance case where each instance gets its identify hook invoked. If it is not trivial it is not the end of the world to add.

Good idea, added a new test for that.

@beekld beekld merged commit a09cb57 into main Mar 23, 2026
6 checks passed
@beekld beekld deleted the beeklimt/SDK-2048 branch March 23, 2026 20:42
tanderson-ld pushed a commit that referenced this pull request Mar 23, 2026
🤖 I have created a release *beep* *boop*
---


##
[5.11.1](5.11.0...5.11.1)
(2026-03-23)


### Bug Fixes

* Call identify hooks during init.
([#331](#331))
([a09cb57](a09cb57))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Low risk: only release/version metadata changes (`gradle.properties`,
release manifest, and `CHANGELOG.md`) with no functional code
modifications.
> 
> **Overview**
> Publishes release `5.11.1` by bumping the version in
`gradle.properties` and `.release-please-manifest.json`.
> 
> Updates `CHANGELOG.md` with the `5.11.1` entry noting the bug fix
*“Call identify hooks during init”*.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
70604fc. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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