Improve handling of unknown fields in storage service. Found a lovely bug today where unmuting chats on mobile didn't sync to my linked devices. Turns out this was a result of the unknown field merging. 1. When a proto has unknown fields, we store the entire proto in a column in our database. 2. After building a proto that we want to write remotely, we merge the saved proto with unknown fields into constructed proto. Most of the time this is fine. 3. _However_, if one of the values you're trying to set happens to be the same as the default value for the given data type (e.g. setting a long like mutedUntil = 0), then when the protos merge, it treats that field as unset and can override it with the field from the proto with unknown fields. 4. Because we currently have unknown fields in every GV2 record, we could never unmute a GV2 group :( This changes the order of things so that unknown fields are the first thing applied in the record builder. I did this by requiring them in the builder constructors. That way start off with the unknown fields and then can manually set whatever you want, and it'll be guaranteed to override it. |
||
---|---|---|
.. | ||
src | ||
.gitignore | ||
build.gradle |