200 Commits

Author SHA1 Message Date
Michael Goldenberg
2bcab72dbb ci: remove reference to matrix-sdk/rustls-tls feature flag
Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
2026-04-07 09:44:33 -04:00
Michael Goldenberg
c8c9a94995 feat(ffi): remove rustls-tls feature flag
Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
2026-04-07 09:44:33 -04:00
Michael Goldenberg
0e679904e3 feat(sdk): remove support for native-tls
Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
2026-04-07 09:44:33 -04:00
Jonas Platte
e376670af3 refactor(xtask): Fix clippy lints 2026-04-02 09:10:51 +02:00
Doug
4071a55cd7 chore: Use a single Swift module when building the bindings.
This fixes support for Xcode 26.4.
2026-04-01 09:20:38 +02:00
Doug
02c41e20ad chore: Remove uniffi Swift mocks workaround now that we're using 0.31.0. 2026-03-30 21:43:07 +02:00
Ivan Enderlin
d6c666a88d fix(xtask): The pos field can be absent when computing log sync.
This patch fixes a bug in `xtask log sync` which can miss a `sync_once`
log when the `pos` field is absent. It happens when there is no `pos`!

Example where `pos` is absent before `timeout`. Note the double space
before `timeout`:

```
… > sync_once{conn_id="room-list"  timeout=0} > send{request_id="REQ-15" …
```

While when the `pos` is present, it's:

```
… > sync_once{conn_id="room-list" pos="0/m67590980…" timeout=30000} > send{request_id="REQ-23" …
```
2026-03-16 11:16:44 +01:00
mgoldenberg
b65e450813 Support TLS v1.3 on all platforms (#6053)
**Note:** _this pull request has a companion pull request in the
[`complement-crypto`](https://github.com/matrix-org/complement-crypto/pull/229)
repository, which must be merged in conjunction with this one._

_Before merging, this should be tested in conjunction with the Element X
iOS client to ensure that TLS v1.3 is working properly._ @stefanceriu
has agreed to work on this.

## Overview

The primary change in this pull request upgrades the `reqwest`
dependency to its latest version, which defaults to using `rustls` with
support for `rustls-platform-verifier` instead of `native-tls` (see
[`reqwest@0.13.0`](https://github.com/seanmonstar/reqwest/releases/tag/v0.13.0)).
The benefit here is that `rustls` supports TLS v1.3 on all platforms,
whereas [`native-tls` does
not](https://github.com/sfackler/rust-native-tls/pull/278).

Additionally, this pull request makes `rustls` the default TLS
implementation in all the crates in this repository.

This will be particularly helpful with element-hq/element-x-ios#786.

## Changes

- `reqwest` bumped to `0.13.1`
- The API for adding/replacing certificates has changed a bit, so this
required some updating in `HttpSettings::make_client`
- `oauth2-reqwest` added in favor of `oauth2/reqwest` 
    - This is required in order to be compatible with `reqwest^0.13`
- _**`oauth2-reqwest` is currently in alpha release, so it probably
makes sense to let this stabilize a bit.**_ For details, see
https://github.com/ramosbugs/oauth2-rs/issues/333#issuecomment-3906712203.
- `getrandom` bumped to `0.3.4`
    - This is required in order to be compatible with `oauth2@5.1.0`
- `proptest` bumped to `1.9.0`
    - This is required in order to be compatible with `getrandom@0.3.4` 
- Make `rustls` the default TLS implementation

## Questions

### Mirror feature flag names?

A number of feature flags have been replaced in the dependencies above.

1. _**`reqwest/rustls-tls` => `reqwest/rustls`**_ - this is simply a
name change, but is semantically identical (see
[`reqwest@0.13.0`](https://github.com/seanmonstar/reqwest/releases/tag/v0.13.0)).
2. _**`getrandom/js` => `getrandom/wasm_js`**_ - the semantics here have
changed slightly, but it seems to just make it easier to enable the
`wasm_js` backend (see
[`getrandom@0.3.4`](https://github.com/rust-random/getrandom/blob/master/CHANGELOG.md#major-change-to-wasm_js-backend)).

At any rate, I have updated references to these flags in each of the
various `Cargo.toml` files, but have not changed the names of our
exposed features to mimic those in the dependencies.

Any thoughts or preferences on whether to mirror those names? That
would, of course, result in a breaking change.

### Default to using `rustls`? Deprecate `native-tls`?

Now that the dependencies have all been bumped, we can use `rustls` on
all platforms. Should this be the new default given that `native-tls`
will very likely never support TLS v1.3 on Apple devices? And should
`native-tls` be deprecated as a result?

**UPDATE:** _The consensus here seems to be that we should default to
using `rustls`, but that `native-tls` should still be available._

---
Fixes #5800.


- [ ] Public API changes documented in changelogs (optional)

Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>

---------

Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
2026-03-10 13:38:18 +01:00
Ivan Enderlin
5902a857d9 fix(xtask): log overview sanitizes HTML.
The log message can contain HTML data. It happens notably when the
homeserver is broken, and an HTML document is returned in some errors.
We don't want to parse the fields in this case, because HTML breaks
everything.
2026-03-09 11:26:44 +01:00
Damir Jelić
ae53b62762 chore: Bump the MSRV 2026-02-27 17:40:08 +01:00
Damir Jelić
4576013878 fix(ffi): Enable rustls by default
It's important to have one of those enabled so a simple cargo check on
the crate works.
2026-02-27 17:40:08 +01:00
Ivan Enderlin
aa11e9f062 fix(xtask): Fix a broken gap in the fields grid of overview. 2026-02-25 16:03:57 +01:00
Ivan Enderlin
4d9268d104 fix(xtask): Fix an infinite loop when parsing the fields of a span.
The error was coming from the subslice from `message` instead of
`fields`.

This patch also fixes an HTML error (`</li>` right after `<ul>`).
2026-02-25 16:03:57 +01:00
Ivan Enderlin
0cbe48e986 feat(xtask): Add cargo xtask log timer.
This patch adds a new `timer` command. It helps to visualise the
`timer!` log in a table with their duration.
2026-02-25 15:15:36 +01:00
Ivan Enderlin
99bfb94d6d fix(xtask): Fix an expect message. 2026-02-25 15:15:36 +01:00
Ivan Enderlin
3aa424117c fix(xtask): Fix a CSS custom property naming error. 2026-02-25 15:15:36 +01:00
Ivan Enderlin
13b07c3ece feat(xtask): Always open leaf nodes.
This patch adds the `open` attribute to the `<details>` for displaying
leaf nodes of the tree. My experience shows that it's nice to always
have them open. The “occurences” list is still folded, so it shouldn't
take to much space on the screen most of the time (one line per level of
logs in this node).
2026-02-10 13:33:48 +01:00
Ivan Enderlin
00e58056a4 fix(xtask): Remove a bad calculation to timeout bar. 2026-02-10 13:33:48 +01:00
Ivan Enderlin
e1e86a78c9 feat(xtask): Add log overview.
This patch adds the `log overview` task that generates a standalone HTML
report representing the logs as a tree where each node is a target, and
each leaf is a log location with occurrences, spans and fields.

Each node displays the sum of errors and warnings for this node.
It helps to quickly spot the problematic targets, and it guides to
exploration of the node without taking the reader's hand by trying to
draw conclusions. We don't want to guide the reader to a mistake: we
just want to guide the reader to draw its own conclusions.

Each line can be highlighted. When a node is folded/closed, it is also
highlighted if at least one of its child is highlighted.

The occurrences of logs are displayed on a timeline.
2026-02-10 13:33:48 +01:00
Ivan Enderlin
8f156cbba8 feat(xtask): Display timeout in the duration graph of log sync.
This patch displays the timeout in the duration graph of `log sync`:

```
xxxxxxxxxuuuuu
```

where `x` represents the timeout, and `u` the duration.
2026-02-05 10:58:39 +01:00
Ivan Enderlin
ae9fe44a7c feat(xtask): Add <time> in log sync reports.
This patch adds `<time>` around the values in the Time Column.
2026-02-05 10:58:39 +01:00
Ivan Enderlin
edbddbdb55 feat(xtask): Display pos and timeout for sync report.
This patch updates the `cargo xtask log sync` command to extract the
`pos` and `timeout` fields so that we can display them. The `timeout`
is displayed in its own column, while the `pos` is displayed in the
line summary.
2026-02-05 10:58:39 +01:00
Ivan Enderlin
7918a1817c doc(xtask): Add missing documentation for log and log sync. 2026-01-30 13:57:26 +01:00
Ivan Enderlin
43e1932691 feat(xtask): Introduce xtask log sync to visualise logs about sync.
This patch introduces a new family of commands: `xtask log`. The goal
is to manipulate logs, to extract the right amount of data we need to
solve specific problems. The first member of this family is `sync` to
visualise logs about the sync process. It presents the sync requests and
responses in a table, with a "timeline" _à la_ network profiler graph.
The code is rather simple, on purpose. The generated HTML reports are
lightweight, and fully standalone: no JavaScript, pure HTML and CSS, no
external resources. These reports can be shared or archived super
easily.

Features:

- requests/responses are grouped by connection ID
- permalink to specific request ID
- status have colours
- time is displayed in a human form
- duration is calculated from the log timestamps
- view syncs in a "tree-like" flavor, a "time graph", super quick to
  spot long requests
- each line can be "opened" to see details, so far only log line numbers
  to get more context manually
2026-01-30 13:57:26 +01:00
Benjamin Bouvier
c420d45e64 test(wasm): allow running the wasm tests with only one runner
Sometimes, running the wasm tests with a given runner will fail with
obscure, undecipherable reasons. As a result, it's convenient to be able
to locally run the wasm-pack tests with only a single runner, which this
commit allows.
2026-01-28 14:16:51 +01:00
Jorge Martín
031d8457b6 refactor: Upgrade uniffi to the latest upstream 2025-12-04 15:17:26 +01:00
Doug
0b5e1fb9c5 xtask: Add support for building watchOS targets. 2025-11-19 11:36:53 +01:00
Doug
1a384f0049 xtask: Workaround UniFFI's noHandle generation for Swift.
https://github.com/mozilla/uniffi-rs/issues/2717
2025-11-04 14:11:14 +02:00
Ivan Enderlin
7c6ff517d5 feat(ffi): Add IndexedDB and in-memory session stores support.
This patch introduces the `sqlite` and `indexeddb` feature flag,
enabling the use of SQLite or IndexedDB for the stores. This patch also
introduces the ability to use non-persistent, in-memory stores.

The new `ClientBuilder::in_memory_store`, `ClientBuilder::sqlite_store`
and `ClientBuilder::indexeddb_store` methods are introduced to
configure the stores. This patch adds new `SqliteStoreBuilder` and
`IndexedDbStoreBuilder` structure.
2025-10-29 15:28:20 +01:00
Jorge Martín
25b1c85998 feat(ffi): Upgrade UniFFI to v0.30.0 2025-10-29 10:08:03 +01:00
mgoldenberg
2e6790d0a5 IndexedDB: upgrade indexed_db_futures dependency (#5722)
**NOTE:** _this should not be merged until matrix-org/rust-indexed-db#1
is merged! The `[patch]` in this branch should point to the official
`matrix-org` fork of `rust-indexed_db`, but is currently pointed at my
personal fork._

## Background

This pull request makes updates
[`indexed_db_futures`](https://docs.rs/indexed_db_futures/latest/indexed_db_futures/index.html)
in the `matrix-sdk-indexeddb` crate. The reason we'd like to update this
dependency is because the version currently used does not fully support
the Chrome browser (see #5420).

The latest version of `indexed_db_futures` has significant changes. Many
of these changes can be integrated without issue. There is, however, a
single change which is incompatible with the `matrix-sdk-indexeddb`
crate. Namely, one cannot access the active transaction in the callback
to update the database (for details, see Alorel/rust-indexed-db#66).

### An Updated Proposal

Originally, new migrations were implemented in order to work around this
issue (see #5467). However, the proposal was ultimately rejected (see
@andybalaam's
[comment](https://github.com/matrix-org/matrix-rust-sdk/pull/5467#issuecomment-3149550617)).

For this reason, the dependency has instead been `[patch]`ed in the
top-level `Cargo.toml` with a modified version of `indexed_db_futures`
(see matrix-org/rust-indexed-db#1). Furthermore, these changes have been
proposed to the maintainer and are awaiting feedback (see
Alorel/rust-indexed-db#72).

### Why do we need the active transaction in our migrations?

The `crypto_store` module provides access to the active transaction to
its migrations (see
[here](ca89700dfe/crates/matrix-sdk-indexeddb/src/crypto_store/migrations/mod.rs (L211))).
Furthermore, there is a single migration (`v11_to_v12`) in the
`crypto_store` module which actually makes use of the active transaction
(see
[here](ca89700dfe/crates/matrix-sdk-indexeddb/src/crypto_store/migrations/v11_to_v12.rs (L23))).

For clarity, the reason `v11_to_v12` is problematic in the latest
versions of `indexed_db_futures` is because it is simply adding an index
to an object store which was created in a different migration and this
requires access to the active transaction. All the other migrations
create object stores and indices in the same migration, which does not
suffer from the same issue.

## Changes

- Move `indexed_db_futures` to the workspace `Cargo.toml` and add a
`[patch]` so that it points to a modified version.
- Add `GenericError` type and conversions in order to more easily map
`indexed_db_futures` errors into `matrix-sdk-*` errors.
- Update all IndexedDB interactions so that they use the upgraded
interface provided by `indexed_db_futures`
- Add functionality for running `wasm-pack` tests against Chrome


---
Closes #5420.

---

- [ ] Public API changes documented in changelogs (optional)


Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>

---------

Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
2025-10-03 14:10:10 +02:00
Kévin Commaille
8c515b0c12 fix(docs): Replace doc_auto_cfg with doc_cfg feature
The former has been merge in the latter, and it errors when generating
the docs in a recent version of nightly, like the one used on docs.rs.

This also requires to bump the version of nightly used in CI, otherwise
it would break the docs generation.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-10-03 12:27:50 +03:00
Jorge Martín
9776ae6acd refactor: rename feature to experimental-element-recent-emoji 2025-09-12 08:21:14 +02:00
Jorge Martín
231840f6ae refactor: Make the ci task also use the element-recent-emojis feature for different tasks 2025-09-12 08:21:14 +02:00
Benjamin Bouvier
17abab0d53 chore(ci): bump wasm-pack and the runtime timeout 2025-09-03 12:46:09 +02:00
Benjamin Bouvier
1ea2162012 chore(ci): add a search feature to try out the experimental-search branch in CI 2025-08-18 17:33:34 +02:00
Skye Elliot
ae7f0fe022 feat: Experimental encrypted state feature flag with CI support (#5537)
This PR makes some non-domain-specific changes across multiple crates
that are required for proper testing of features implemented for #5397.

* Adds a `experimental-encrypted-state-events` feature flag across the
SDK.
* Introduces a feature set into xtask to ensure feature-gated tests are
run during CI.
* Minor fix to a test that would otherwise fail with the newly
introduced CI.
2025-08-15 12:54:41 +00:00
Kévin Commaille
c6210cad21 ci: Upgrade the version of Rust nightly
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-08-13 12:31:22 +01:00
Ivan Enderlin
1089a25588 fix(xtask): Use --package instead of -p on cargo ndk.
We use `cargo ndk -p {package_name}`, where `-p` is short for
`--package`. However, `cargo ndk` has introduced the `-p` option (see
c6b93a89a2),
short for `--platform`. It creates a confusion and the command line
doesn't execute properly. Let's use the long option `--package` to
clarify everything.
2025-08-04 10:41:17 +02:00
Jonas Platte
995ec618df chore: Upgrade xtask and uniffi-bindgen to Rust edition 2024 2025-07-09 08:41:41 +02:00
Benjamin Bouvier
0f8fc53019 chore(ci): use the dev profile when building the swift bindings (#5328)
The swift bindings aren't getting tested (they don't run) in CI anymore,
so building with the reldbg profile (that's a workaround to make it run
and not crash in production) doesn't provide more value than building in
debug mode, while taking much longer to build.

Let's use the default dev profile for this; we have to specify it
manually, because the default for the xtask command is to use the
`reldbg` profile otherwise.

This requires a fix for the dev profile, that consists in being able to
set the iOS deployment target, and set it to a high value in CI
settings. Production builds *don't* have to set it, though.
2025-07-02 14:20:53 +02:00
Kévin Commaille
8a847a99d4 ci: Bump the version of Rust nightly
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-06-28 09:47:28 +02:00
Jonas Platte
3d642356c6 refactor: Clean up formatting in many places
Process:
- set style_edition to 2024 in .rustfmt.toml
- run `cargo fmt`
- undo .rustfmt.toml change
- run `cargo fmt` again
- manually rewrap some strings
2025-06-27 19:54:13 +02:00
Daniel Salinas
abcc05f889 Change matrix-sdk-ffi to rely on features over platform targets
The system of platform targets was already quite messy, and becoming
even worse as we start preparing for Wasm support. Switch to features
instead to make this easier to work with.
2025-06-19 16:16:59 +02:00
Damir Jelić
cc7f6243c6 ci: Make the text output for our coverage xtask the default 2025-06-19 13:57:58 +02:00
Damir Jelić
422fd19d10 ci: Add an xtask subcommand for coverage reports
This command uses llvm-cov which we are planning to switch to.
2025-06-19 09:50:16 +02:00
Damir Jelić
0f4afb32f7 refactor(xtask): Use a helper to append options for the release tasks 2025-06-10 09:34:56 +02:00
Damir Jelić
398787253d feat: Support releasing a specific package 2025-06-10 09:34:56 +02:00
Kévin Commaille
f6c5addf55 refactor(sdk): Remove experimental-oidc feature
Now that is compiles under WASM and that the API was cleaned up, it
should be okay.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-03-24 14:04:04 +02:00
Ivan Enderlin
cabb345a1c fix(xtask): Add --limit 100 to gh pr list.
Because yes, some weeks, we are very productive!

This patch adds `--limit 100` to `gh pr list` so that we are sure to not
miss pull requests if there are many.
2025-03-14 18:04:33 +01:00