WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Conversation

@kaylendog
Copy link
Contributor

Issue: #5109

  • Public API changes documented in changelogs (optional)

@kaylendog kaylendog requested review from a team as code owners December 10, 2025 12:23
@kaylendog kaylendog requested review from Hywan and poljar and removed request for a team December 10, 2025 12:23
@kaylendog kaylendog marked this pull request as draft December 10, 2025 12:23
@kaylendog kaylendog removed request for Hywan and poljar December 10, 2025 12:23
@codspeed-hq
Copy link

codspeed-hq bot commented Dec 10, 2025

CodSpeed Performance Report

Merging #5943 will not alter performance

Comparing kaylendog/history_sharing/store_history_sender_details (f7c6e5f) with main (2522a36)

Summary

✅ 50 untouched

@codecov
Copy link

codecov bot commented Dec 10, 2025

Codecov Report

❌ Patch coverage is 92.68293% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.51%. Comparing base (2522a36) to head (f7c6e5f).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
crates/matrix-sdk-crypto/src/store/mod.rs 88.23% 0 Missing and 2 partials ⚠️
...atrix-sdk-crypto/src/olm/group_sessions/inbound.rs 91.66% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5943   +/-   ##
=======================================
  Coverage   88.51%   88.51%           
=======================================
  Files         363      363           
  Lines      103432   103466   +34     
  Branches   103432   103466   +34     
=======================================
+ Hits        91548    91581   +33     
  Misses       7531     7531           
- Partials     4353     4354    +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kaylendog kaylendog force-pushed the kaylendog/history_sharing/store_history_sender_details branch 3 times, most recently from c322d5d to ceb0c71 Compare December 10, 2025 14:53
@kaylendog kaylendog marked this pull request as ready for review December 10, 2025 15:04
@kaylendog kaylendog force-pushed the kaylendog/history_sharing/store_history_sender_details branch from ceb0c71 to a61c06d Compare December 10, 2025 17:08
@kaylendog kaylendog force-pushed the kaylendog/history_sharing/store_history_sender_details branch from a61c06d to f7c6e5f Compare December 11, 2025 09:53
@kaylendog kaylendog requested review from poljar and richvdh and removed request for richvdh December 11, 2025 17:03
Copy link
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few comments and thoughts.

There doesn't seem to be much in the way of tests that forwarder_data gets set correctly. I know that integration tests are coming later, but can we update test_receive_room_key_bundle?

Comment on lines +78 to +79
/// * `sender_data` - If the sessions were received as part of an MSC4268
/// key bundle, the information about the user who sent us the bundle.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this appears to be referring to a non-existent argument

Comment on lines -1709 to +1732
if matches!(
&sender_data,
// The sender's device must be either `SenderData::SenderUnverified` (i.e.,
// TOFU-trusted) or `SenderData::SenderVerified` (i.e., fully verified
// via user verification and cross-signing).
let sender_data = match sender_data {
SenderData::UnknownDevice { .. }
| SenderData::VerificationViolation(_)
| SenderData::DeviceInfo { .. }
) {
warn!(
"Not accepting a historic room key bundle due to insufficient trust in the sender"
);
return Ok(());
}
| SenderData::VerificationViolation(_)
| SenderData::DeviceInfo { .. } => {
warn!(
"Not accepting a historic room key bundle due to insufficient trust in the sender"
);
return Ok(());
}
SenderData::SenderUnverified(_) | SenderData::SenderVerified(_) => sender_data,
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now that we pass the whole SenderData into import_room_key_bundle_sessions, I don't think the match statement is an improvement over the old matches! macro. Maybe keep the comment though.

Comment on lines +291 to +292
/// * `sender_data` - If the sessions were received as part of an MSC4268
/// key bundle, the information about the user who sent us the bundle.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another non-existent argument

/// store.
pub received_room_key_bundles: Vec<StoredRoomKeyBundleData>,

pub sender_data: BTreeMap<OwnedRoomId, BTreeMap<String, KnownSenderData>>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this needs documentation at the very least, but I don't understand why it is needed and how it relates to inbound_group_sessions

&self,
room_keys: Vec<T>,
from_backup_version: Option<&str>,
sender_data: Option<&SenderData>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

given that this ends up as the forwarder_data rather than the sender_data, it should probably be named accordingly ... and that change could do with chasing up the call stack.

&self,
keys: Vec<ExportedRoomKey>,
from_backup_version: Option<&str>,
sender_data: Option<&SenderData>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since this is unused (and afaik we have no intention to use it), I'd suggest getting rid of it.

&self,
exported_keys: Vec<ExportedRoomKey>,
from_backup_version: Option<&str>,
sender_data: Option<&SenderData>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs doc.

let mut keys = BTreeMap::new();

for (i, key) in room_keys.into_iter().enumerate() {
match key.try_into() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Low-confidence comment:

It feels like, ideally, we ought to be setting the InboundGroupSession::forwarder_data at the point we convert from HistoricRoomKey: it's not really meaningful to convert from HistoricRoomKey to InboundGroupSession without a forwarder_data.

In other words, we should replace InboundGroupSession::try_from(&HistoricRoomKey) with some other method that also takes a &SenderData.

On the flip side, import_sessions_impl is used for ExportedRoomKey as well as HistoricRoomKey, so this change would probably mean pushing the try_into call, and hence the error handling up the stack. It might give us more code and less clarity.

WDYT?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants