Repository navigation
A missed call shows at the time of the call, not when Hush got its message - #274
Merged
Merged
Conversation
An offer that waited on the server while Hush was closed reached RingRTC expired and was recorded as missed at the time Hush handled it, so a call from days ago showed under Today. The envelope's send time (the sender's clock, as messages use) now travels with the offer: the call thread keeps it by call id until RingRTC's first state for the call, and a rejected offer's missed call takes it. A held-back call from a chat not accepted is recorded, and its request listed, at that time too. Calls that ring while Hush runs are still recorded when they end.
The sender chooses an envelope's timestamp: zero or negative hid a held-back request and its missed call, and one in the future pinned the request on top. Clamped as key changes are. Review fixes too: the call router is tested end to end, an offer time that is missing is logged, the engine test reports engine errors, and comments say what the code does.
Owner
Author
Review (
|
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.
What changed
A missed call is now recorded at the time its offer was sent, not when Hush handled it. Before, a call that waited on the server while Hush was closed showed up as "Missed voice call" under Today, even if the call was days ago.
IncomingEnvelopekeeps the envelope's send time (client_timestamp, the sender's clock), clamped to the minute before the server had it (call_sent_at, askey_checkalready does for key changes). Messages use the same clock (sent_atis the sender's timestamp), and the timeline places events among messages by comparingatwithsent_at, so the missed call now sits on the right day and in the right spot.Shared.offers) before handing the offer to RingRTC, and drops it at RingRTC's first state for that call. When RingRTC rejects the offer (expired after 60 s, busy, glare), the missed call gets that time. ResettingShared(a call starting or ending) keeps the map, because other offers in the same batch may still be on their way.CallOutput::ChatEventnow carries its ownat. The core actor no longer stamps it withUtc::now()when it writes the event.hold_back_unaccepted_call(calls from message requests or strangers, which never ring) gets the envelope's time. It records the missed call at that time and lists the request at that time too.Choices
server_timestamp. The sender chooses that value, so it is clamped to [server − 60 s, server]. A missing or negative one would otherwise put the event before the epoch (hidden, since the apps load events from 0) and hide a held-back request (last_message_atstays 0). A future one would pin the request to the top. An honest sender's time passes unchanged. RingRTC's expiry check still uses the server-based age, as before.now − age, the offer's time. It records a call that rang from its first ring, though, so a long connected call shows at its start in Signal and at its end in Hush. That is a different question from this bug, so I left it alone (see below).refresh_summarycounts only messages and decryption failures, and this PR doesn't change that. The only place the time affects the list is a stranger's held-back call, which lists the request throughlist_chat. That now happens at the offer's time, the same way a late message lists at itssent_at. An old offer puts the request in its place by time instead of at the top. It stays visible, sincelast_message_at > 0.How it was tested
Test first. The new tests ran against the plumbing with the old behaviour (every event stamped "now"), and all five failed with the event at "now" instead of the offer's time:
calls::actor::tests::an_offer_delivered_late_is_missed_when_it_was_sent: goes through the real call thread and RingRTC. An offer a day old is rejected as expired and its missed call is at the offer's time.calls::actor::tests::an_expired_offer_is_a_missed_call(extended): the Bridge uses the stored offer time and then drops it.calls::actor::tests::a_rejected_offer_while_busy_is_missed_and_leaves_the_active_call_alone(extended): a busy rejection gets its offer's time.calls::actor::tests::an_offer_keeps_its_time_while_another_call_comes_and_goes(new): an offer's time survives both resets ofShared. Removing eithermem::takemakes it fail. It also pins the choice that a call that rang is recorded when it ends.actor::tests::the_call_router_records_calls_at_their_time(new, from review): the router records a held-back offer at its envelope time and the engine'sChatEventat itsat. It fails when eitherUtc::now()stamp is put back.actor::tests::a_calls_time_is_the_senders_within_reason(new, from review): the clamp. It failed against the unclamped helper.actor::tests::a_held_back_call_is_missed_when_it_was_made(new): a stranger's call from a day ago is missed at that time, and the request is listed at that time, below a chat that was active an hour ago.The existing call tests pass unchanged, including
a_call_from_a_message_request_is_held_back_as_missedanda_call_that_cant_be_checked_doesnt_ring.Gate:
make format && make check(cargo fmt --check, bothcargo clippy --all-targets … -D warnings,cargo test --features hush-desktop/snapshot -q): all pass on the head merged with main (sig-core 546 passed, 4 ignored; desktop 363 passed). There is no UI change, so no snapshots.Not done
list_chat, andrefresh_summaryignores missed calls. This predates the PR; it could be its own issue.Closes #273