-
Notifications
You must be signed in to change notification settings - Fork 8
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
fix: Only replace projects covered by token #466
fix: Only replace projects covered by token #466
Conversation
Previously, if the update was empty, we assumed we needed to replace all stored features. This is not the case. We only need to remove the projects that are connected to the token we're using for the merge. In addition, debug output on `/internal-backstage/tokens` now includes how many features was received in the update
}) | ||
.cloned() | ||
.collect(); | ||
to_keep.extend(updated.iter().cloned()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm assuming that, in case updated
is empty, this will act as:
to_keep.extend([])
effectively returning the existing to_keep
without any changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup, to_keep.extend will keep what's in to_keep, but add from updated, and since we've already removed all toggles from to_keep that matches one of the projects this token has access to, we won't have to worry about duplicates.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I think this looks good
Previously, if the update was empty, we assumed we needed to replace all stored features. This is not the case. We only need to remove the projects that are connected to the token we're using for the merge.
In addition, debug output on
/internal-backstage/tokens
now includes how many features was received in the update