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

refactor: use intersect to evaluate MiskCaller#hasCapability #3380

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tklovett
Copy link
Collaborator

@tklovett tklovett commented Nov 13, 2024

Description

This uses the Kotlin built-in Collections#intersect to replace capabilities.any { allowedCapabilities.contains(it) } with capabilities.intersect(allowedCapabilities).isNotEmpty(). To my eyes, this form is easier to grok. I wouldn't be surprised if the intersect implementation is more performant, but the size of capabilities and allowedCapabilities is typically < 1000, so its not that important.

This is a backwards compatible, internal change.

Testing Strategy

New unit tests are introduced.

Checklist

  • I have reviewed this PR with relevant experts and/or impacted teams.
  • I have added tests to have confidence my changes work as expected.
  • I have a rollout plan that minimizes risks and includes monitoring for potential issues.

Thank you for contributing to Misk! 🎉

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.

1 participant