Added 'profile_updated' to contact_info & member to version profile info#54
Merged
7 commits merged intosession-foundation:devfrom Jul 28, 2025
Merged
Conversation
Member
|
Pushed a change here to store the timestamp in a type-safe std::chrono::sys_seconds. (#58 extends this to existing timestamps, but the commits in this PR applies it first to this new value). (Edit: also rebased on dev and resolved some minor formatting merge conflicts) |
76d2aef to
c4c5912
Compare
jagerman
approved these changes
Jul 28, 2025
This uses std::chrono::sys_seconds for the new profile_updated timestamp field, so that we can avoid the unfortunate bug that happened in earlier releases where some clients violated the documented restrictions and passed milliseconds or microseconds: sys_seconds is absolutely unambiguous as to what it holds and makes such an error virtually impossible. - Adds `session::to_sys_seconds(int)` that can get a proper sys_seconds from a maybe-s, ms, or µs value by guessing based on the magnitude. - Add methods for getting/setting sys_seconds timestamps from/into configs.
There are a lot of internal calls such as `maybe_int(c,
"key").value_or(0)` and `maybe_string(c, "key").value_or("")`. This
makes it them slightly less cumbersome by adding `int_or_0` and
`string_or_empty` functions that handle the fallback-to-0/empty
automatically.
c4c5912 to
c20e012
Compare
1c16029
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There is currently a bug in Session where profile information can be overwritten with stale information, this is due to profile information contained within a message not containing any version information - a single scenario which results in this bug is:
In the above scenario Bob will have downloaded and processed all 1-to-1 messages before receiving the group messages, once the group messages are processed their profile data will incorrectly overwrite the newer information that was attached to the 1-to-1 messages
The solution for this is to include a
profile_updatedtimestamp alongside the profile information when sending a message - the client can then compare this against their cached information in order to determine whether they should update the cacheSince
libSessionstores profile information for contacts and group members it also needs to track this value which is the purpose of this PR