14089 Commits

Author SHA1 Message Date
razvp
67b1de613c feat(state-stores): Add StateStore::upsert_thread_subscriptions() method for bulk upsert 2025-12-17 11:03:50 +01:00
Jorge Martín
1af22a70b7 fix(sdk_common): TimelineEvent::from_bundled_latest_event can remove session_id
What's more, this is saved into the event cache and sometimes it overrides another instance of the same event that actually contains the right info. This results in unresolvables UTDs.

This change tries to fetch the session id from the existing event content. It's fixed these kind of UTDs when tested in a real client.
matrix-sdk-ffi/20251217
2025-12-16 16:21:51 +01:00
Damir Jelić
504d15f171 chore: Fix some spelling issues 2025-12-16 15:46:34 +01:00
Damir Jelić
1302afb844 test: Add another test for pinned timelines
This time we're testing the redecryption of pinned events that were not
part of the main timeline, more importantly we never backpaginated
enough for them to be part of the main timeline and thus never got put
into the event cache.

This test expectedly fails for now.
2025-12-16 15:46:34 +01:00
Damir Jelić
028d610397 fix: Only replace UTDs in pinned timeline with decrypted events that have the same event ID 2025-12-16 15:46:34 +01:00
Damir Jelić
7323c79dc2 test: Refactor the pinned timeline integration test a bit
This should allow us in the future to create more such tests with
many more events.
2025-12-16 15:46:34 +01:00
Damir Jelić
16c6b57c9a fix(timeline): Allow focused timelines to replace UTDs with decrypted events 2025-12-16 15:46:34 +01:00
Damir Jelić
329bdaa785 test(timeline): Add a test that pinned events get replaced after they get redecrypted 2025-12-16 15:46:34 +01:00
Ivan Enderlin
e57185a009 fix(sdk): new_local returns an Option.
We can't use `LatestEventValue::None` as an optional value anymore,
since it erases the previous `LatestEventValue`. This patch updates
`LatestEventValueBuilder::new_local` to return an `Option` to handle all
the cases where a local value cannot be computed.
2025-12-16 15:42:37 +01:00
Ivan Enderlin
4e90ceae91 doc: Update the CHANGELOG.mds. 2025-12-16 13:45:00 +01:00
Ivan Enderlin
ccf11ad041 feat(ui): latest_event sorter handles LatestEventValue::LocalHasBeenSent.
This patch changes the semantics of the Room List `latest_event`
sorter by changing “is local” to “is remote like”, to include the new
`LatestEventValue::LocalHasBeenSent` variant.
2025-12-16 13:45:00 +01:00
Ivan Enderlin
631671fb1c fix(sdk): Introduce LatestEventValue::LocalHasBeenSent.
The problem we are trying to solve is the following:

- a local event is being sent,
- the `LatestEventValue` is `LocalIsSending`,
- the local event is finally sent,
- the `LatestEventValue` is still `LocalIsSending` purposely, with the
  hope that an update from the Event Cache will replace it.

But sometimes, this update from the Event Cache comes **before** the
update from the Send Queue. Why is it problem? Because updates from the
Event Cache are ignored until the buffer of local `LatestEventValue`s
aren't empty, which means that if an update from the Event Cache is
received before `RoomSendQueueUpdate::SentEvent`, it is ignored, and the
`LatestEventValue` stays in the `LocalIsSending` state. That's annoying.

The idea is to introduce a new state: `LocalHasBeenSent` which mimics
`Remote`, but for a local event. It clarifies the state of a sent event,
without relying on the Event Cache.
2025-12-16 13:45:00 +01:00
Ivan Enderlin
1480ede8d4 chore(sdk): Format. 2025-12-16 12:33:04 +01:00
Ivan Enderlin
e0b1f471fa doc(sdk): Document the With inner type. 2025-12-16 12:33:04 +01:00
Ivan Enderlin
58d25464c2 doc(sdk): Update CHANGELOG.md. 2025-12-16 12:33:04 +01:00
Ivan Enderlin
277bdce01d chore(sdk): Small refactoring.
This patch simplifies the code after the recent refactorings.

It uses `LatestEventValue::is_none()` to replace a `matches!`, and it
replaces the last use of `new_remote` by `new_remote_with_power_levels`
to finally rename this latter to `new_remote`.
2025-12-16 12:33:04 +01:00
Ivan Enderlin
9cf7719958 test(sdk): Fix a test on slow system. 2025-12-16 12:33:04 +01:00
Ivan Enderlin
46f313ac28 test(sdk): Simplify a test. 2025-12-16 12:33:04 +01:00
Ivan Enderlin
a630904b41 perf(sdk): Do not replace a LatestEventValue::None by itself.
Replacing a `LatestEventValue::None` by a `LatestEventValue::None` is
ignored. It reduces the number of (useless) updates in the system.
2025-12-16 12:33:04 +01:00
Ivan Enderlin
f80140d5ff feat(sdk): Compute LatestEventValue when initialized if None.
The `LatestEventValue` can be `None` (the default value) but the Event
Cache contains enough data to compute a `Remote(_)` one. The system
lazily triggers a `LatestEventQueueUpdate` to achieve that.
2025-12-16 12:33:04 +01:00
Ivan Enderlin
a21079b2ac test(ui): Fix a test!
This `test_room_sorting` test was asserting a bug. With the last patch,
this bug is now fixed, and the test must be fixed too.
2025-12-16 12:33:04 +01:00
Ivan Enderlin
f283a0aadf chore(sdk): Replace an Option<T> by OnceCell<T>. 2025-12-16 12:33:04 +01:00
Ivan Enderlin
248961fe31 feat(sdk): LatestEventValue is restored from RoomInfo.
Previously, `LatestEventValue` was always initialized from the
`RoomEventCache`. Now, it is restored from the `RoomInfo`. First off,
this is something we wanted to do since a long time. Second, it is
more performant. Third, it allows the system to be lazier. Indeed,
it's possible that when a `LatestEvent` is created, its correspond
`RoomEventCache` doesn't exist yet. It happens during a sync when a room
is new: latest events are registered, but their `RoomEventCache` aren't
yet created. By postponing the use of `RoomEventCache`, the system is
lazier and more solid.

Bonus, less methods are async, which simplifes the workflow.
2025-12-16 12:33:04 +01:00
Ivan Enderlin
cdc39b69a1 fix(sdk): Remove latest_events::RoomRegistration.
This patch removes `RoomRegistration` along with the full room
registration mechanism. It's been introduced to remove contention
around the `RegisteredRooms` lock, but it actually creates more async
flows, which makes the `latest_events` logic a bit less predictable.
By removing this room registration mechanism, our hope is to make the
result more predictable and less buggy in appareance. Our real-life
tests have shown that the lock contention isn't problematic, especially
since `RoomLatestEventsReadGuard` and `RoomLatestEventsWriteGuard` have
been introduced.
2025-12-16 12:33:04 +01:00
dependabot[bot]
95dac018e3 chore(deps): bump actions/upload-artifact from 5 to 6
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 5 to 6.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-12-16 11:38:45 +01:00
dependabot[bot]
0e5077dab1 chore(deps): bump bnjbvr/cargo-machete
Bumps [bnjbvr/cargo-machete](https://github.com/bnjbvr/cargo-machete) from 72602674bc341ca927683caddbf578672c352476 to 6229aa757e3e8a028bd97a49e190207e108eefbd.
- [Release notes](https://github.com/bnjbvr/cargo-machete/releases)
- [Changelog](https://github.com/bnjbvr/cargo-machete/blob/main/CHANGELOG.md)
- [Commits](72602674bc...6229aa757e)

---
updated-dependencies:
- dependency-name: bnjbvr/cargo-machete
  dependency-version: 6229aa757e3e8a028bd97a49e190207e108eefbd
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-12-16 11:38:15 +01:00
dependabot[bot]
3b5b0f81c4 chore(deps): bump actions/cache from 4 to 5
Bumps [actions/cache](https://github.com/actions/cache) from 4 to 5.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-12-16 09:17:45 +01:00
dependabot[bot]
a527439eae chore(deps): bump tj-actions/changed-files from 47.0.0 to 47.0.1
Bumps [tj-actions/changed-files](https://github.com/tj-actions/changed-files) from 47.0.0 to 47.0.1.
- [Release notes](https://github.com/tj-actions/changed-files/releases)
- [Changelog](https://github.com/tj-actions/changed-files/blob/main/HISTORY.md)
- [Commits](https://github.com/tj-actions/changed-files/compare/v47.0.0...v47.0.1)

---
updated-dependencies:
- dependency-name: tj-actions/changed-files
  dependency-version: 47.0.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-12-15 17:40:37 +02:00
Damir Jelić
4eb1981779 chore: Remove the dead message-ids feature 2025-12-15 14:43:52 +01:00
Damir Jelić
073f95436f refactor(timeline): Remove the backup_states_task
R2D2 now sends out a report when backups become available, so we can
just listen to that instead.
2025-12-15 14:43:43 +01:00
Damir Jelić
fa1ebbfdb8 feat(r2d2): Send out a report when backups get enabled 2025-12-15 14:43:43 +01:00
Damir Jelić
9bdd2ae977 test: Ensure that the test_enabling_backups_retries_decryption test times out 2025-12-15 14:43:43 +01:00
Damir Jelić
3a63838cdb test: Disable the lease lock tests for the memory store on wasm
This test for one reason or the other sporadically panics with an:
    > RuntimeError: unreachable

Let's disable this test on Wasm for now since the memory store isn't
that relevant anyways, especially not on Wasm.
2025-12-15 13:56:11 +01:00
Damir Jelić
7a1a2202f8 feat(r2d2): Add logs for when the room key stream lags 2025-12-15 11:38:12 +01:00
Damir Jelić
ce65317ab8 chore: Fix an incorrect warning due to the zeroize macro 2025-12-11 19:27:45 +01:00
Damir Jelić
cd988e53f8 doc(encryption): Add a link to MSC4287 2025-12-11 19:27:45 +01:00
Jonas Platte
ad58607013 Fix new clippy lints 2025-12-11 16:18:42 +01:00
Jonas Platte
eae3006f8d Reformat matrix-sdk-sqlite 2025-12-11 16:18:42 +01:00
Jonas Platte
024fd99e71 Upgrade matrix-sdk-sqlite to Rust edition 2024 2025-12-11 16:18:42 +01:00
Damir Jelić
4d3125e58e fix(common): Fix the debug implementation of TimelineEventKind 2025-12-11 16:09:52 +01:00
Damir Jelić
17a4888481 chore: Convert some Note's to NOTE's
The later is more standard and some editor plugins will highlight those
for you.
2025-12-11 16:09:21 +01:00
Damir Jelić
cc4cf3d54f refactor(r2d2): Create common report_lag method to reduce duplicated code 2025-12-11 13:34:48 +01:00
Mauro
9a6acd5334 Add space_room_from_id function (#5944)
Useful to get a specific space room if available given its id.

---------

Co-authored-by: Doug <douglase@element.io>
2025-12-11 12:11:48 +00:00
Damir Jelić
2522a3694f refactor(qr-login): Prepare the secure channel to be usable with HPKE
This patch abstracts away the cryptographic channel which is used in the
SecureChannel implementation for the QR code login support.

This will allow us to use HPKE alongside of ECIES since MSC4108 recently
proposed the switch to HPKE.
2025-12-11 09:24:55 +01:00
Jonas Platte
f2ba338e12 Fix new rustc + clippy warnings 2025-12-10 16:37:43 +00:00
Jonas Platte
0035259e3d Reformat matrix-sdk-crypto 2025-12-10 16:37:43 +00:00
Jonas Platte
431eb88a2d Upgrade matrix-sdk-crypto to Rust edition 2024 2025-12-10 16:37:43 +00:00
Jonas Platte
f8d5014921 Add + use<_> to impl Trait return types
(part of `cargo fix --edition`)
2025-12-10 16:37:43 +00:00
Jonas Platte
b0072160af Remove unnecessary ref mut from patterns
(part of `cargo fix --edition`)
2025-12-10 16:37:43 +00:00
Jonas Platte
536f889649 Add a missing semicolon 2025-12-10 16:37:43 +00:00