-
Notifications
You must be signed in to change notification settings - Fork 269
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
Support for UTD error codes in [Sync]TimelineEvent
#4070
Conversation
455bbd4
to
c737e86
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4070 +/- ##
==========================================
- Coverage 84.84% 84.80% -0.04%
==========================================
Files 269 269
Lines 28800 28827 +27
==========================================
+ Hits 24434 24446 +12
- Misses 4366 4381 +15 ☔ View full report in Codecov by Sentry. |
bcd57e8
to
ab28964
Compare
03d4148
to
8fa3bf9
Compare
f702bc9
to
bad2be9
Compare
[Sync]TimelineEvent
06eff7f
to
d00c1a2
Compare
[Sync]TimelineEvent
[Sync]TimelineEvent
0997324
to
d838ed5
Compare
When `decrypt_sync_room_event` fails to decrypt an event, return the UTD as a `SyncTimelineEvent` instead of an Error.
d838ed5
to
63b94a3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, looks good to me 👍
// key; retry in a few. | ||
wait *= 2; | ||
} else { | ||
trace!("Event could not be decrypted, but waiting longer is unlikely to help: {:?}", utd_info.reason); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels useful on the nse level, should we maybe promote it to at least info?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, the failure will already be logged at warning in the crypto layer, so it's not immediately obvious that logging it again is right.
I'll bump this one to debug as a compromise for now.
matrix_sdk::deserialized_responses::TimelineEventKind::UnableToDecrypt { | ||
utd_info, .. | ||
} => { | ||
trace!( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe here too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, the actual error will be logged at warning, and in this case it's just replicating the previous behaviour (note the trace!("Encryption sync failed to decrypt the event: {err}");
just below).
I can change this if you feel strongly but it's not obvious to me that we should.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No no, that's quite okay, I didn't check the lower levels to see if we print it anywhere else.
When `decrypt_room_event` fails to decrypt an event, return the UTD as a `TimelineEvent` instead of an Error.
Make the tests behave the same way as the network code, by returning UTDs as `TimelineEventKind::UnableToDecrypt` instead of `TimelineEventKind::PlainText`.
89bd8c1
to
1cc4629
Compare
This PR takes the
TimelineEventKind
that was added in #4082, and adds a third enum variant which is specific to unable-to-decrypt events. We update the two methods which are responsible for decrypting encrypted events that have been received from the network (decrypt_sync_room_event
anddecrypt_room_event
), and make them return a[Sync]TimelineEvent
of the relevant kind instead of a megolm error.Since pretty much everything downstream accesses UTD events via
TimelineEventKind::raw()
, we don't have to change much else to keep things working.Part of #4048.