Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Identity overrides in local evaluation mode #142

Merged
merged 5 commits into from
Mar 12, 2024

Conversation

khvn26
Copy link
Member

@khvn26 khvn26 commented Jan 19, 2024

Contributes to Flagsmith/flagsmith#3132.

  • Store environment-supplied identity overrides
  • Use stored identity overrides in local evaluation mode
  • Remove integration configurations from EnvironmentModel
  • Change IdentityModel.identity_features type from Set to List to fix equality checks for identities. It seems that using a HashSet there initially was a mistake, as the FeatureStateModel class did not have hashCode implemented because equals was overridden (at least, I didn't observe the hashCode definition after delomboking in IDEA). Moreover, defining FeatureStateModel.hashCode is tricky as its collections need different deduplication in different contexts.

- Store environment-supplied identity overrides
- Use stored identity overrides in local evaluation mode
- Remove integration configurations from `EnvironmentModel`
@khvn26 khvn26 requested review from a team and novakzaballa and removed request for a team January 22, 2024 13:29
Comment on lines 63 to 69
if (identityOverrides != null) {
Map<String, IdentityModel> identityOverridesByIdentifier = new HashMap<>();
for (IdentityModel identity : identityOverrides) {
identityOverridesByIdentifier.put(identity.getIdentifier(), identity);
}
this.identityOverridesByIdentifier = identityOverridesByIdentifier;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Similar comment here to the one I added to the node.js repo here: Flagsmith/flagsmith-nodejs-client#143 (comment)

Copy link
Member Author

Choose a reason for hiding this comment

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

See response.

Copy link
Contributor

Choose a reason for hiding this comment

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

As per discussion in Node.js client, let's update the name of this variable here too.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

@khvn26 khvn26 merged commit db55ef5 into main Mar 12, 2024
7 checks passed
@khvn26 khvn26 deleted the feat/local-eval-identity-overrides branch March 12, 2024 16:01
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.

None yet

2 participants