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

Implemented guild experiments #389

Draft
wants to merge 6 commits into
base: legacy
Choose a base branch
from

Conversation

BanTheNons
Copy link
Contributor

No description provided.

commit e587b8f81f366b175a042ef1eb96e44bc8807570
Author: BuildTools <[email protected]>
Date:   Tue Sep 21 19:19:57 2021 +0300

    Create guild_experiments.example.json

commit 9cb03c85618d62e3501146e96539e2c0c79416a3
Author: BuildTools <[email protected]>
Date:   Tue Sep 21 22:32:07 2021 +0300

    Update Identify.ts

commit 3b0e0bb116841c460f41b7429a59a577f61e3863
Author: BanTheNons <[email protected]>
Date:   Tue Sep 21 16:56:14 2021 +0300

    implemented guild experiments

commit 489af5182d8c69f46b468f010480c88565fbb42f
Author: BuildTools <[email protected]>
Date:   Tue Sep 21 22:26:53 2021 +0300

    Update .gitignore
@DiegoMagdaleno
Copy link
Contributor

Maybe we should wait for FOSScord to have proper support to handle some of this experiments?

@@ -0,0 +1,4 @@
{
"experiments": {"fingerprint": "889800254663311382.rgUouuEkLbQi0SGiEMClnfgNZic", "assignments": [[4047587481, 0, 0, -1, 0], [1865079242, 0, 1, -1, 0], [3816091942, 3, 0, -1, 0], [4130837190, 0, 10, -1, 0], [1861568052, 0, 1, -1, 0], [1578940118, 1, 1, -1, 0], [1571676964, 0, 1, -1, 2], [1658164312, 2, 1, -1, 0], [98883956, 1, 1, -1, 0], [3114091169, 0, 1, -1, 0], [2570684145, 4, 1, -1, 2], [4007615411, 0, 1, -1, 0], [852550504, 3, 1, -1, 0], [4168223991, 0, 1, -1, 0], [478613943, 2, 1, -1, 1], [284670956, 0, 1, -1, 0], [2099185390, 0, 1, -1, 0], [1202202685, 0, 1, -1, 0], [3633864632, 0, 1, -1, 0], [3103053065, 0, 1, -1, 0], [820624960, 0, 1, -1, 0], [2599708267, 0, 1, -1, 0], [2885186814, 0, 1, -1, 0], [221503477, 0, 1, -1, 0], [1054317075, 0, 1, -1, 3], [683872522, 0, 1, -1, 1], [1739278764, 0, 2, -1, 0], [2855249023, 0, 1, -1, 0], [3721841948, 0, 1, -1, 0], [1365487849, 6, 1, -1, 0], [955229746, 0, 1, -1, 0], [3128009767, 0, 10, -1, 0], [441885003, 0, 1, -1, 0], [3433971238, 0, 1, -1, 2], [1038765354, 3, 1, -1, 0], [2973729510, 2, 1, -1, 0], [3884442008, 0, 1, -1, 0], [978673395, 1, 1, -1, 0], [4050927174, 0, 1, -1, 0], [1260103069, 0, 1, -1, 0], [4168894280, 0, 1, -1, 0], [2003494159, 1, 1, -1, 0], [2458926251, 1, 6, -1, 2], [4027800, 1, 6, -1, 3], [51193042, 0, 1, -1, 0], [2063302207, 1, 6, -1, 4], [2634540382, 3, 1, -1, 0], [886364171, 0, 1, -1, 0], [427713714, 0, 1, -1, 0], [3388129398, 0, 1, -1, 0], [446728522, 0, 1, -1, 0], [3305874255, 0, 1, -1, 0], [3316720711, 0, 1, -1, 0], [1126477623, 0, 1, -1, 0], [2617218444, 4, 1, -1, 2], [3615263239, 0, 1, -1, 0], [3035674767, 0, 1, -1, 0], [261678880, 0, 1, -1, 0], [144783748, 0, 1, -1, 0], [2898830675, 0, 1, -1, 0], [2311413706, 0, 1, -1, 0], [1304635016, 0, 1, -1, 0], [3840356350, 4, 1, -1, 0], [1047093347, 0, 1, -1, 2], [3354177721, 0, 1, -1, 0], [3643362751, 0, 1, -1, 0], [698017395, 0, 1, -1, 0], [902020832, 3, 3, -1, 1], [2165627712, 2, 1, -1, 0], [3346844407, 0, 1, -1, 0], [3753034466, 1, 2, -1, 0], [881221695, 1, 1, -1, 0], [2144100145, 0, 1, -1, 0], [3749399219, 0, 0, -1, 0], [55060776, 1, 2, -1, 0], [3125584553, 1, 1, -1, 0], [2906015343, 2, 0, -1, 0], [219203323, 1, 1, -1, 0], [2854861606, 0, 1, -1, 1], [3884403666, 1, 1, -1, 0], [1041569008, 0, 1, -1, 0], [2780619238, 1, 1, -1, 0], [2839301427, 1, 1, -1, 0], [2481496956, 0, 1, -1, 0], [1305004983, 0, 1, -1, 0], [126562871, 2, 2, -1, 0], [3296195750, 0, 0, -1, 0]]},
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this the only way to do it?.

It doesn't look very readable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It just sends the list of all experiments. It's definitely not readable, and we'll have to blame discord for that.

api/src/routes/experiments.ts Outdated Show resolved Hide resolved
api/src/routes/experiments.ts Show resolved Hide resolved
Copy link
Contributor

@DiegoMagdaleno DiegoMagdaleno left a comment

Choose a reason for hiding this comment

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

Just some issues with the code style, once those are fixed, it is good to go.

@erkinalp
Copy link
Contributor

erkinalp commented Sep 22, 2021

Maybe we should wait for FOSScord to have proper support to handle some of this experiments?

Something like /policies/features/guilds/:id, so that the server operator could configure features per guild?

@BanTheNons
Copy link
Contributor Author

Something like /policies/features/guilds/:id, so that the server operator could configure features per guild?

Guild IDs can be added as overrides in the guild_experiments.json file, if you could only enable experiments per guild you wouldn't be able to set rollouts for it.

You can just rename guild_experments.example.json and you should be good to go.
DiegoMagdaleno
DiegoMagdaleno previously approved these changes Sep 28, 2021
Copy link
Member

@SamuelScheit SamuelScheit left a comment

Choose a reason for hiding this comment

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

We shouldn't save the experiment overrides in a file, as it would create inconsistency between the gateway and api and between multiple deployments.
Instead we should save them in the database as a simple JSON string (for now).

@erkinalp erkinalp added the Enhancement New feature or request label Oct 2, 2021
Comment on lines +77 to +142
switch(filter[0]){
case 1604612045: //guild_has_feature
parse = {
type: "guild_has_feature"
}
filter[1].forEach(function(filterData){
if(filterData[0] == 1183251248){ //guild_features
parse.guild_features = filterData[1]
} else {
console.log('[EXPERIMENT] Expected guild_features, got ' + filterData)
}
})
parsedFilters.push(parse)
break;
case 3013771838: //guild_ids
parse = {
type: "guild_ids"
}
filter[1].forEach(function(filterData){
if(filterData[0] == 3013771838){ //guild_ids
parse.ids = filterData[1]
} else {
console.log('[EXPERIMENT] Expected guild_ids, got ' + filterData)
}
})
parsedFilters.push(parse)
break;
case 2404720969: //guild_id_range
parse = {
type: "guild_id_range"
}
filter[1].forEach(function(filterData){
if(filterData[0] == 3399957344){ //min_id
parse.min_id = filterData[1]
} else if(filterData[0] == 1238858341){ //max_id
parse.max_id = filterData[1]
} else {
console.log('[EXPERIMENT] Expected min_id or max_id, got ' + filterData)
}
})
parsedFilters.push(parse)
break;
case 2918402255: //guild_member_count_range
parse = {
type: "guild_member_count_range"
}
filter[1].forEach(function(filterData){
if(filterData[0] == 3399957344){ //min_id
parse.min_id = filterData[1]
} else if(filterData[0] == 1238858341){ //max_id
parse.max_id = filterData[1]
} else {
console.log('[EXPERIMENT] Expected min_id or max_id, got ' + filterData)
}
})
parsedFilters.push(parse)
break;
default:
parsedFilters.push({
type: "unknown_filter",
hash: filter[0],
data: filter[1]
})
break;
}
})
Copy link
Contributor

@erkinalp erkinalp Oct 14, 2021

Choose a reason for hiding this comment

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

TODO: implement filter selection as a snowflake-indexed vtable (an object with snowflakes as keys, and filter functions as values)

Comment on lines -76 to +1
]
[[4047587481, 0, 0, -1, 0], [1865079242, 0, 1, -1, 0], [3816091942, 3, 0, -1, 0], [4130837190, 0, 10, -1, 0], [1861568052, 0, 1, -1, 0], [1578940118, 1, 1, -1, 0], [1571676964, 0, 1, -1, 2], [1658164312, 2, 1, -1, 0], [98883956, 1, 1, -1, 0], [3114091169, 0, 1, -1, 0], [2570684145, 4, 1, -1, 2], [4007615411, 0, 1, -1, 0], [852550504, 3, 1, -1, 0], [4168223991, 0, 1, -1, 0], [478613943, 2, 1, -1, 1], [284670956, 0, 1, -1, 0], [2099185390, 0, 1, -1, 0], [1202202685, 0, 1, -1, 0], [3633864632, 0, 1, -1, 0], [3103053065, 0, 1, -1, 0], [820624960, 0, 1, -1, 0], [2599708267, 0, 1, -1, 0], [2885186814, 0, 1, -1, 0], [221503477, 0, 1, -1, 0], [1054317075, 0, 1, -1, 3], [683872522, 0, 1, -1, 1], [1739278764, 0, 2, -1, 0], [2855249023, 0, 1, -1, 0], [3721841948, 0, 1, -1, 0], [1365487849, 6, 1, -1, 0], [955229746, 0, 1, -1, 0], [3128009767, 0, 10, -1, 0], [441885003, 0, 1, -1, 0], [3433971238, 0, 1, -1, 2], [1038765354, 3, 1, -1, 0], [2973729510, 2, 1, -1, 0], [3884442008, 0, 1, -1, 0], [978673395, 1, 1, -1, 0], [4050927174, 0, 1, -1, 0], [1260103069, 0, 1, -1, 0], [4168894280, 0, 1, -1, 0], [2003494159, 1, 1, -1, 0], [2458926251, 1, 6, -1, 2], [4027800, 1, 6, -1, 3], [51193042, 0, 1, -1, 0], [2063302207, 1, 6, -1, 4], [2634540382, 3, 1, -1, 0], [886364171, 0, 1, -1, 0], [427713714, 0, 1, -1, 0], [3388129398, 0, 1, -1, 0], [446728522, 0, 1, -1, 0], [3305874255, 0, 1, -1, 0], [3316720711, 0, 1, -1, 0], [1126477623, 0, 1, -1, 0], [2617218444, 4, 1, -1, 2], [3615263239, 0, 1, -1, 0], [3035674767, 0, 1, -1, 0], [261678880, 0, 1, -1, 0], [144783748, 0, 1, -1, 0], [2898830675, 0, 1, -1, 0], [2311413706, 0, 1, -1, 0], [1304635016, 0, 1, -1, 0], [3840356350, 4, 1, -1, 0], [1047093347, 0, 1, -1, 2], [3354177721, 0, 1, -1, 0], [3643362751, 0, 1, -1, 0], [698017395, 0, 1, -1, 0], [902020832, 3, 3, -1, 1], [2165627712, 2, 1, -1, 0], [3346844407, 0, 1, -1, 0], [3753034466, 1, 2, -1, 0], [881221695, 1, 1, -1, 0], [2144100145, 0, 1, -1, 0], [3749399219, 0, 0, -1, 0], [55060776, 1, 2, -1, 0], [3125584553, 1, 1, -1, 0], [2906015343, 2, 0, -1, 0], [219203323, 1, 1, -1, 0], [2854861606, 0, 1, -1, 1], [3884403666, 1, 1, -1, 0], [1041569008, 0, 1, -1, 0], [2780619238, 1, 1, -1, 0], [2839301427, 1, 1, -1, 0], [2481496956, 0, 1, -1, 0], [1305004983, 0, 1, -1, 0], [126562871, 2, 2, -1, 0], [3296195750, 0, 0, -1, 0]]
Copy link
Contributor

Choose a reason for hiding this comment

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

TODO: Fetch experiments from instance DB

@SamuelScheit SamuelScheit marked this pull request as draft October 14, 2021 22:40
@SamuelScheit SamuelScheit added this to the Discord Core milestone Oct 16, 2021
@erkinalp erkinalp removed the request for review from SamuelScheit December 22, 2021 20:13
@erkinalp erkinalp self-requested a review January 25, 2022 20:44
Copy link
Contributor

@erkinalp erkinalp left a comment

Choose a reason for hiding this comment

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

Rebase against updated dependencies

@erkinalp erkinalp removed the request for review from DiegoMagdaleno March 20, 2022 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request Needs rebase Attempt to merge into master
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants