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: evaluate list of self supported protocols on team protocols update #15888

Merged
merged 9 commits into from
Sep 27, 2023

Conversation

PatrykBuniX
Copy link
Contributor

Description

Every time team (or backend) admin changes the list of supported protocols (in feature config) we want to also re-evaluate the list of self user's supported protocols. This PR adds this functionality. Every time we receive feature config update, and see that "mls" was the feature that had been updated, we compare the local list of current supported protocols stored locally in team config with the list received in "mls" feature config update. If supported protocols were changed, we re-evaluate the list of self supported protocols and update it on backend.

Checklist

  • PR has been self reviewed by the author;
  • Hard-to-understand areas of the code have been commented;
  • If it is a core feature, unit tests have been added;

@codecov
Copy link

codecov bot commented Sep 25, 2023

Codecov Report

Merging #15888 (7ea3ed1) into dev (77e81f7) will decrease coverage by 0.01%.
Report is 5 commits behind head on dev.
The diff coverage is 38.88%.

❗ Current head 7ea3ed1 differs from pull request most recent head 4bd40f6. Consider uploading reports for the commit 4bd40f6 to get more accurate results

@@            Coverage Diff             @@
##              dev   #15888      +/-   ##
==========================================
- Coverage   44.51%   44.50%   -0.01%     
==========================================
  Files         673      674       +1     
  Lines       22735    22755      +20     
  Branches     5170     5175       +5     
==========================================
+ Hits        10120    10127       +7     
- Misses      11321    11334      +13     
  Partials     1294     1294              

@PatrykBuniX PatrykBuniX marked this pull request as ready for review September 25, 2023 14:31
// When we receive a `feature-config.update` event, we will refetch the entire feature config
await this.updateFeatureConfig();
const {prevFeatureList} = await this.updateFeatureConfig();
this.emit('featureUpdated', {event, prevFeatureList});
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: maybe we could just send the previous value rather than the entire feature config, WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, I tried to do it but didn't manage to achieve it type-wise. When accessing prevFeatureList[event.name] at this point, the type will not be properly narrowed down to e.g. FeatureMLS (we don't know what's event.name at compile time, it's FEATURE_KEY type)

Event data is nicely tied to its name.
Screenshot 2023-09-27 at 11 25 17

But we cannot tie specific feature to it by FEATURE_KEY at this point. It's still union of different features.
Screenshot 2023-09-27 at 11 27 59

Maybe it's possible but i cannot find a way? Any ideas?

Copy link
Contributor

Choose a reason for hiding this comment

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

ah nevermind we can probably change that later, no biggies here 👌

Copy link
Contributor

@atomrc atomrc left a comment

Choose a reason for hiding this comment

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

question: Will this work when the entire feature list is updated (that happens, for example, once every 24h)?
We might need to account for this as well

@PatrykBuniX
Copy link
Contributor Author

PatrykBuniX commented Sep 27, 2023

question: Will this work when the entire feature list is updated (that happens, for example, once every 24h)? We might need to account for this as well

@atomrc
How about emitting the event inside updateFeatureConfig method instead? This one is called in case of 24h timer as well.

EDIT: Nevermind, we don't have access to event there, I will just handle this case separately.

@PatrykBuniX PatrykBuniX merged commit e0ffc4e into dev Sep 27, 2023
12 checks passed
@PatrykBuniX PatrykBuniX deleted the feat/evaluate-self-protocols-on-team-config-update branch September 27, 2023 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants