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!: Support transient identities and traits #133

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

khvn26
Copy link
Member

@khvn26 khvn26 commented Jul 24, 2024

Closes #132.

client.go Outdated
Comment on lines 111 to 113
type GetIdentityFlagsOpts struct {
Transient bool `json:"transient,omitempty"`
}
Copy link
Member Author

Choose a reason for hiding this comment

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

@gagantrivedi Keen to know if this approach is redundant. Maybe we could just go with a transient bool argument to respective interfaces.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, I'd prefer the latter approach

Copy link
Member Author

Choose a reason for hiding this comment

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

Having implemented the bool argument, I don't quite like not being able to provide nil as the value. Since Golang doesn't support optional args, I feel we're forcing the majority of users to make the decision they don't need to make.

Copy link
Member

Choose a reason for hiding this comment

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

I think a bool pointer should be able to achieve that?

Copy link
Member Author

Choose a reason for hiding this comment

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

It should, in theory, but then there's no way to provide a pointer to a constant (that I know of, at least).

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm... yep, ok, that's a good point. Perhaps, for now, we should add that method and mark getEnvironmentFlags and getIdentityFlags as deprecated? To use transient identities, you will need to move to use the getFlags method.

Choose a reason for hiding this comment

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

I also like implementing the OF interface with an evaluation context that can contain the identity. Actually, an immediate benefit of doing that is that we could optionally send the environment or another environment key in this call providing an easy way to "switch context" I guess, but that's just an example and another discussion.

Copy link
Member

@kyle-ssg kyle-ssg Jul 29, 2024

Choose a reason for hiding this comment

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

Annoyingly I don't think it'll be as straight forward on the client-side with OF. In JS there's a single OF context. I wonder if this could be achieved using their concept of domains,

const domainScopedClient = OpenFeature.getClient("my-domain");
domainScopedClient.setContext(context1)

Copy link
Member Author

Choose a reason for hiding this comment

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

@kyle-ssg Domain-specific contexts look like the exact solution for this.

@khvn26 khvn26 force-pushed the feat/transient-identities-and-traits branch from ec66647 to 7435704 Compare August 2, 2024 16:56
@khvn26 khvn26 changed the title feat: Support transient identities and traits feat!: Support transient identities and traits Aug 2, 2024
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.

Support transient identities and traits
5 participants