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

Add Rule::Other to cover newly defined flags. #682 #685

Merged
merged 5 commits into from Sep 28, 2022
Merged

Add Rule::Other to cover newly defined flags. #682 #685

merged 5 commits into from Sep 28, 2022

Conversation

garyhai
Copy link
Contributor

@garyhai garyhai commented Sep 20, 2022

Fix bug of unhandled newly defined flags when call acl_getuser.

@djc
Copy link
Contributor

djc commented Sep 20, 2022

Thanks for helping out!

This technically still breaks compatibility, since it adds a variant on an enum that is not marked as non-exhaustive. That's fine, though, since the main branch already broke compatibility. Given that this is the case, I think it would make sense to also add variants for any newly defined flags that we know about at this point.

@garyhai
Copy link
Contributor Author

garyhai commented Sep 20, 2022

This technically still breaks compatibility, since it adds a variant on an enum that is not marked as non-exhaustive. That's fine, though, since the main branch already broke compatibility. Given that this is the case, I think it would make sense to also add variants for any newly defined flags that we know about at this point.

Instead of causing compatibility issues every time a new flag is added, Rule::Other is used as a transitional solution to ease compatibility. Rule may enumerate explicitly a list of commonly used flags.

redis/src/acl.rs Outdated Show resolved Hide resolved
redis/src/acl.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@djc djc left a comment

Choose a reason for hiding this comment

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

This looks good to me. @jaymell any thoughts?

@jaymell
Copy link
Contributor

jaymell commented Sep 26, 2022

I can be persuaded here, but I'm not thrilled with the change. The core issue, of course, is the existing API has not left us with great options. But I wonder if, given that we're going to make a backward-incompatible change here, if we should consider marking the enum as non-exhaustive and adding in the new variants as appropriate?

@garyhai
Copy link
Contributor Author

garyhai commented Sep 27, 2022

I can be persuaded here, but I'm not thrilled with the change. The core issue, of course, is the existing API has not left us with great options. But I wonder if, given that we're going to make a backward-incompatible change here, if we should consider marking the enum as non-exhaustive and adding in the new variants as appropriate?

The non-exhaustion structure has too many limitations and imposes too much mental burden. Rule::Other is just for exhaustion and ergonomics. I suggest putting this break change into the next non-compatibility release.

@jaymell jaymell linked an issue Sep 28, 2022 that may be closed by this pull request
@jaymell
Copy link
Contributor

jaymell commented Sep 28, 2022

Ok, merging this. Thanks for the contribution.

@jaymell jaymell merged commit c14b73f into redis-rs:main Sep 28, 2022
nonirosenfeldredis pushed a commit to nonirosenfeldredis/redis-rs that referenced this pull request Feb 13, 2023
)

Fix bug of unhandled newly defined flags when call acl_getuser.
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.

AclInfo: Expect a valid ACL flag
3 participants