Add server-side revalidation of total score matching active mods#379
Conversation
…sion of multiplier calculator The fix is somewhat dicey, but as per inline commentary, my hope is that it being dicey is not relevant anymore, because we won't need this command again.
|
Self-check done, seems to be working as intended as far as my testing goes (tested with old and new lazer client, have not tested score imports, have not tested ddog metrics). |
| try | ||
| { | ||
| p.ApplyToUserStats(score, userStats, conn, transaction, postTransactionActions); | ||
| p.ApplyToUserStats(score, userStats, conn, transaction, postTransactionActions, DogStatsd); |
There was a problem hiding this comment.
Kinda ugly ain't it. Considered adding to interface and passing on start, but not much better.
There was a problem hiding this comment.
I almost introduced a context holder object to pass around to these processors instead of spamming further parameters but it would be even more of a disaster on diff size than this already is.
There was a problem hiding this comment.
Yeah, context would be the other direction. Or just making the DogStatsd field static..
There was a problem hiding this comment.
Or just making the
DogStatsdfield static..
That would require a PR in another project and a NuGet package bump after 🙈
Legitimately spent like half an hour mulling over the least worst method to do this.
|
Intentionally not merging just yet. |
This PR adds a processor that checks whether for incoming scores
data->'$.total_score_without_mods'matchestotal_scoreas defined by the latest score multiplier calculator. This allows an instant cutoff rollout of the new multipliers for all incoming scores without needing to wait on client rollouts.total_scoredoes not matchtotal_score_without_mods,total_scoreis rewritten based ontotal_score_without_modsand the active mods for the score.total_score_without_modsis missing, the score is marked unranked. Production was checked for this, and there have been no incoming legitimate scores withouttotal_score_without_modsfor more than a year now.Of particular note, this processor must run before everything else, because of data dependencies. Other processors read and do things with
total_score, such as add it to profile ranked score, or check it for medal purposes, and so on.The processor is instrumented with a Datadog counter of scores it rewrote. For this counter I had to commit 19c343d because otherwise it's kind of not possible to log things with the correct Datadog prefix.