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

Implement Experiments #578

Open
kozabrada123 opened this issue Nov 21, 2024 · 0 comments
Open

Implement Experiments #578

kozabrada123 opened this issue Nov 21, 2024 · 0 comments
Labels
Difficulty: Medium Priority: Low Type: Enhancement Enhances an existing feature or behaviour.

Comments

@kozabrada123
Copy link
Member

Implement / parse guild and user experiments, specifically in the ready payload

See:

    /// User experiment rollouts for the user
    ///
    /// TODO: Make User Experiments into own struct
    // Note: this is a pain to parse! We need a way to parse arrays into structs via the index of
    // their feilds
    //
    // ex: [4130837190, 0, 10, -1, 0, 1932, 0, 0]
    // needs to be parsed into a struct with fields corresponding to the first, second.. value in
    // the array
    pub experiments: Vec<serde_json::value::Value>,

A custom serde Deserialize implementation is likely needed

@kozabrada123 kozabrada123 added Priority: Low Type: Enhancement Enhances an existing feature or behaviour. Difficulty: Medium labels Nov 21, 2024
kozabrada123 added a commit that referenced this issue Nov 21, 2024
See also #578 on why we aren't currently juts implementing them as types
kozabrada123 added a commit that referenced this issue Nov 21, 2024
## Description:

- Discord is messing with their api again, read states are a mystery
- Refactored the gateway to fully use the `Opcode` enum instead of constants (4ed68ce)
- Added Last Messages request and response (4ed68ce)
- Fixed a deserialization error related to `presences` in `GuildMembersChunk` being an array, not a single value (4baecf9)
- Fixed a deserialization error with deserializing `activities` in `PresenceUpdate` as an empty array when they are sent as `null` (1b20102)
- Add type `OneOrMoreSnowflakes`, allow `GatewayRequestGuildMembers` to request multiple guild and user ids (644d3be, 85e922b)
- Updated `LazyRequest` (op 14) to use the `Snowflake` type for ids instead of just `String` (61ac7d1)
- Fixed a deserialization error on discord.com related to experiments (they are not implemented yet, see #578) (7feb571)
- Fixed a deserialization error on discord.com related to `last_viewed` in `ReadState` being a version / counter, not a `DateTime` (fb94afa)

## Commits:

* fix: temporarily fix READY on Spacebar

Spacebar servers have mention_count in ReadStateEntry as nullable, as well as not having the flags field

This should probably be investigated further

Reported by greysilly7 on the polyphony discord

* fix: on DDC the user field in Relationship is not send in READY anymore

* fix: for some reason presences wasn't an array??

* fix: deserialize activities: null as empty array

* feat: add OneOrMoreSnowflakes type

Adds a public type which allows serializing one snowflake or an array of snowflakes.

Useful for e.g. request guild members, where we can request either for one user or for multiple

* feat: update RequestGuildMembers, allow multiple snowflakes

Updates the RequsetGuildMembers gateway event, allows to query multiple user_ids and guild_ids using OneOrMoreSnowflakes type, update its documentation

* fix?: add Default to OneOrMoreSnowflakes, GatewayRequestGuildMembers

* feat: add gateway last messages, refactor gateway to use Opcode enum

* fix: the string in lazy request is a snowflake

* fix: deserialization error related to experiments on Discord.com

See also #578 on why we aren't currently juts implementing them as types

* fix?: last_viewed is a counter, not a datetime

thanks to MaddyUnderStars; this explanation seems to make sense considering we only need to know if we are ahead / behind the version, not when exactly it was accessed
kozabrada123 added a commit that referenced this issue Nov 24, 2024
Release tracker for v0.18.0 of chorus, set to release on November 24th, 2024.

## Public API changes
- #570: Various entity public api changes
- 644d3be, 85e922b: Add type `OneOrMoreSnowflakes`, allow `GatewayRequestGuildMembers` to request multiple guild and user ids
- f65b9c1: Differentiate `PresenceUpdate` and `GatewayPresenceUpdate`
- 0e5fd86: Temporarily fix `PresenceUpdate` for Spacebar Client by making `user` optional
- 61ac7d1: Updated `LazyRequest` (op 14) to use the `Snowflake` type for ids instead of just `String`

## Additions
- #564: MFA implementation, by @xystrive and @kozabrada123 
- 4ed68ce: Added [Last Messages request](https://docs.discord.sex/topics/gateway-events#request-last-messages) and [response](https://docs.discord.sex/topics/gateway-events#last-messages)
- b23fb68: Add `ReadState` to `GatewayReady`
- #571: Gateway Opcode enum
- #573: Gateway Disconnect Opcode enums

## Bugfixes

- #565: Fix sqlx En-/Decoding of `PremiumType`
- 7460d3f: Fix `GatewayIdentifyConnectionProps` for Spacebar Client by deriving default on all fields, since the client does not send it
-  3d9460f: Derive Default for `MessageReferenceType`, assume default reference_type if none is provided
- 4baecf9: Fixed a deserialization error related to `presences` in `GuildMembersChunk` being an array, not a single value
- 1b20102: Fixed a deserialization error with deserializing `activities` in `PresenceUpdate` as an empty array when they are sent as `null`
- 7feb571: Fixed a deserialization error on discord.com related to experiments (they are not implemented yet, see #578)
- fb94afa: Fixed a deserialization error on discord.com related to `last_viewed` in `ReadState` being a version / counter, not a `DateTime`

## Internal changes
- 40754c5: bump sqlx-pg-uint to v0.8.0
- #575: Refactor of gateway close code handling
- 4ed68ce: Refactored the gateway to fully use the `Opcode` enum instead of constants
- #579

---------

Co-authored-by: bitfl0wer <florian@pro-weber.com>
Co-authored-by: Flori <39242991+bitfl0wer@users.noreply.github.com>
Co-authored-by: xystrive <xys@xystrive.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Difficulty: Medium Priority: Low Type: Enhancement Enhances an existing feature or behaviour.
Projects
None yet
Development

No branches or pull requests

1 participant