News News feed (Atom)

This Week in Ruma

› published on by

On Friday, I live streamed myself working on Ruma for the first time. I tweeted about it from my personal account and mentioned it in #ruma:matrix.org, but otherwise didn't publicize it. A few people watched and helped work out the kinks with audio and video quality. (Thank you to those who watched!) I walked through the API endpoint for creating message events, explaining more or less line by line how the code works, then worked on implementing the API endpoint for creating state events. The people who watched gave me good feedback, and I had a good time doing it, so I think I'll start to stream some of my Ruma development regularly. It will be at 1:00 PM Pacific Time on my Twitch channel. I will start tweeting about it from Ruma's Twitter account to remind everyone. I'd love to get some questions during the stream, so if you're interested in learning about Matrix, Rust, or both, please come watch and tell me what you want to know!

Notable changes to ruma

  • Added initial support for the state event creation API endpoint.
  • Filled in missing functionality and fixed a few issues with the room alias API endpoints, which checks those off the list completely.
  • A new contributor is working on the API endpoint for joining a room, and in the process added a new Iron middleware for extracting a ruma_identifiers::RoomId from the URL path parameter wherever it's required.
  • A small quality of life fix: script/cargo now passed the value of RUST_LOG to the Docker environment when developing.
  • The project's README now includes some more information about how to determine which version of nightly Rust Ruma is built against for those not using Docker for development.

New contributors

This Week in Ruma

› published on by

Apologies for the lack of updates the last two weeks! Two weeks ago I had family visiting over the weekend and last weekend I was in Portland for the first ever RustConf, which was fantastic!

In addition to the changes below, I've been working on transaction support for the message event creation API. It looks like it's going to require a few features that are not yet supported by Diesel: SET TRANSACTION and tables with composite primary keys. These are already on the roadmap for Diesel, so more progress will be made on this front soon.

Notable changes to ruma

  • Some changes to error handling to be more ergonomic, provide better user-facing error messages, and to follow Rust conventions better.
  • Added information to the project's README about how to develop without Docker.
  • Added integration tests for the message event creation API, which uncovered a bug that is now fixed.
  • The room alias creation API now correctly returns a 409 HTTP status code if the alias already exists.

New contributors

Rust at large

  • Talked with Niko Matsakis at RustConf and concluded that the functionality proposed in RFC 1546 will be necessary for ruma-events to define the different kinds of Matrix events as traits instead of structs. I added a somewhat rambly explanation of this in the comments on the RFC.

Matrix at large

  • The Matrix client Vector has come out of beta and has been rebranded as Riot! End-to-end encrypted messages are finally here!

This Week in Ruma

› published on by

Recently, types from the ruma-identifiers crate were integrated into ruma-events and ruma, so that values representing a Matrix ID can guarantee some important invariants. Previously these values were just strings. There was still a source of confusion and errors in that the ID types had to be converted to and from strings for the structs that represent database records using the Diesel ORM. To fix this, I added the necessary implementations to ruma-identifiers (under the "diesel" feature) so that the ID types can serve directly as the database columns' data types. Of course, these are still stored as text in the database, but the conversion happens only during data serialization and deserialization, and so cannot be broken by application logic. This was a pretty hairy change and it took a while to get it all working and to get the test suite updated and passing. Big thanks to Sean Griffin (author of Diesel) for helping me figure out how to achieve this.

Notable changes to ruma

  • Increase the portability of the Cargo wrapper script.
  • Use ruma-identifiers ID types for relevant database columns.

Notable changes to ruma-identifiers

  • Crate version 0.4.0 and then 0.4.1 were released, adding Diesel integration and a bug fix for case-sensitivity in user IDs.

New contributors

Rust at large

  • Sean Griffin shared some details of generic implementations that don't work right now, but ideally could help make it easier for apps to create their own custom Diesel data types.
  • An important step for the future prospects of moving Ruma to stable Rust, the implementation for macros 1.1 will land soon. This will allow Diesel and Serde to use custom derive without requiring nightly features, which is one of the main reasons Ruma targets nightly Rust.

This Week in Ruma

› published on by

Apologies for the missed update last week! I was sick and didn't get a chance to write it. However, there was work on the project last week. I will just include those changes in this update.

Notable changes to ruma

  • Previous work to update Diesel and Serde to the latest versions have been completed.
  • Ruma now uses the types from ruma-identifiers to represent Matrix IDs instead of strings.
  • Ruma now uses the latest version of ruma-events which also uses ruma-identifiers.
  • The Docker Compose file now locks the Ruma development image to a specific version, so breaking changes to the image are now coordinated with Ruma. As part of the same change, the image is now locked to a specific version of the nightly compiler.
  • Database migrations are now embedded in the ruma binary, which means a check out of the source code is no longer necessary.
  • Add initial support for the message event creation API. This is a big milestone and one of the core APIs that makes Matrix work!

Notable changes to ruma-events

  • Added simple type aliases for custom events of each kind (basic, room, and state events).
  • I'm experimenting again with a version of the API where the event kinds are traits instead of generic structs. They really feel like they should be traits, but the actual usage pattern for the events in the main ruma application may not work well like this.

Notable changes to ruma-identifiers

  • Crate version 0.3.0 was released, which implements Clone for the ID types and Copy for the error type.
  • I'm working on a change that would allow the ID types to be used directly as struct fields for Diesel table types. Right now it seems like more trouble than it's worth, but I'm following the issue on user-defined FromSql/ToSql types.

Matrix at large

  • Paul Evans of the Matrix team is working on testing Ruma with SyTest, a blackbox integration testing framework for Matrix homeservers. Even though few of the APIs are complete in Ruma so far, there are already a few tests passing!
  • SPEC-442: Explain requirements and guarantees around transaction IDs
  • SPEC-444: Add an API for getting auth flows The May 22, 2016 news update mentioned that Vector and Synapse use unspecified APIs for negotiating authentication flows, but an issue was never filed for improving that.

Rust at large

  • Starting to think about how permissions checks will work in Ruma, I opened an issue for transaction isolation support in Diesel as a possible way to prevent ToCToU errors.

This Week in Ruma

› published on by

This week I began working on upgrading the libraries used by Ruma. In particular, Diesel and Serde have new minor versions (which prior to 1.0 are effectively major versions.) I'm also working on integrating ruma-identifiers and the recent round of changes to ruma-events back into Ruma. Because of library changes, there are a lot of code updates needed. I got the compiler errors down from about 60 to about 10, but there are a few blocking issues to fix the rest. These are noted in the section on Rust below.

Notable changes to ruma-events

  • Replace macro for enum implementation with more straightforward usage of Serde annotations where possible. This means that Display and FromStr are no longer implemented for these types, but they may not be used by Ruma anyway. They'll be added back if and when there is an actual need.

Rust at large

  • diesel-rs/diesel#394 Remove the Copy constraint from Identifiable. In Diesel 0.7.0, struct fields representing a database table's primary key must be Copy. Because strings are used for this in Ruma, this PR must be merged in order to avoid a bunch of otherwise unnecessary newtypes in Ruma.
  • iron/body-parser#72: Bump Serde to 0.8. Needed due to version conflicts with serde_json::Value.