Improve space (and room!) upgrades #907

Merged
nex merged 8 commits from nex/feat/space-upgrades into main 2025-07-19 18:44:56 +00:00
Owner

This PR does the following:

  • Implements MSC4168 by updating both the parent and child space references
  • Fixes an issue where only state with an empty state key ("") is cloned
  • Adds a helper function that allows the state_accessor service to iterate over all of the state keys for a given event type

This is primarily in preparation for room v12, where some people may desire to upgrade their spaces.
It is important to note that some clients, such as Element Web and possibly Cinny, perform these new steps client-side as well. Given we create & send the events first, this just results in overlapping behaviour, rather than a functional issue, and is safe to ignore.

This PR does the following: - Implements [MSC4168](https://github.com/matrix-org/matrix-spec-proposals/pull/4168) by updating both the parent and child space references - Fixes an issue where only state with an empty state key (`""`) is cloned - Adds a helper function that allows the `state_accessor` service to iterate over all of the state keys for a given event type This is primarily in preparation for room v12, where some people may desire to upgrade their spaces. It is important to note that some clients, such as Element Web and possibly Cinny, perform these new steps client-side as well. Given we create & send the events first, this just results in overlapping behaviour, rather than a functional issue, and is safe to ignore.
nex added this to the 0.5.0-old milestone 2025-07-19 14:47:46 +00:00
nex requested reviews from Jade, Owners 2025-07-19 14:47:53 +00:00
Jade force-pushed nex/feat/space-upgrades from 607caddacf
All checks were successful
Release Docker Image / define-variables (push) Successful in 17s
Checks / Prefligit / prefligit (push) Successful in 53s
Checks / Rust / Format (push) Successful in 1m4s
Documentation / Build and Deploy Documentation (pull_request) Successful in 36s
Checks / Prefligit / prefligit (pull_request) Successful in 19s
Checks / Rust / Clippy (push) Successful in 5m22s
Checks / Rust / Cargo Test (push) Successful in 5m46s
Release Docker Image / build-image (linux/amd64, release, linux-amd64, base) (push) Successful in 13m47s
Release Docker Image / build-image (linux/arm64, release, linux-arm64, base) (push) Successful in 14m4s
Release Docker Image / merge (push) Successful in 27s
to c639228f4d
All checks were successful
Checks / Prefligit / prefligit (pull_request) Successful in 14s
Documentation / Build and Deploy Documentation (pull_request) Successful in 51s
Release Docker Image / define-variables (push) Successful in 2s
Checks / Prefligit / prefligit (push) Successful in 19s
Documentation / Build and Deploy Documentation (push) Successful in 48s
Checks / Rust / Format (push) Successful in 47s
Checks / Rust / Clippy (push) Successful in 3m39s
Checks / Rust / Cargo Test (push) Successful in 4m12s
Release Docker Image / build-image (linux/amd64, release, linux-amd64, base) (push) Successful in 10m37s
Release Docker Image / build-image (linux/arm64, release, linux-arm64, base) (push) Successful in 22m18s
Release Docker Image / merge (push) Successful in 37s
2025-07-19 17:37:54 +00:00
Compare
Jade approved these changes 2025-07-19 18:14:46 +00:00
Jade left a comment
Owner

I think it's pretty much good, although I wonder if in future it's worth breaking this out into a separate function outside of the API crate.

I think it's pretty much good, although I wonder if in future it's worth breaking this out into a separate function outside of the API crate.
@ -297,0 +338,4 @@
&body.room_id
);
// First, drop the space's child event
let state_lock = services.rooms.state.mutex.lock(space_id).await;
Owner

This lock should probably be an explicit scope. conduwuit::utils::with_lock::WithLock then mutex.with_lock(|state_lock| {, instead of using drop - from the code style guide.

This lock should probably be an explicit scope. `conduwuit::utils::with_lock::WithLock` then `mutex.with_lock(|state_lock| {`, instead of using drop - from the code style guide.
Author
Owner

(resolved with no changes because the desired system isn't compatible with the mutex in question)

(resolved with no changes because the desired system isn't compatible with the mutex in question)
nex marked this conversation as resolved
@ -297,0 +367,4 @@
PduBuilder {
event_type: StateEventType::SpaceChild.into(),
content: to_raw_value(&SpaceChildEventContent {
via: vec![sender_user.server_name().to_owned()],
Owner

Shouldn't via be multiple servers? Although IG we would be the only server in the room, so not much we can do other than update later.

Shouldn't via be multiple servers? Although IG we would be the only server in the room, so not much we can do other than update later.
Author
Owner

MSC explicitly states only the sender server should be included

MSC explicitly states only the sender server should be included
Jade marked this conversation as resolved
nex merged commit c639228f4d into main 2025-07-19 18:44:56 +00:00
nex deleted branch nex/feat/space-upgrades 2025-07-19 18:44:56 +00:00
Jade modified the milestone from 0.5.0-old to v0.5.0-rc.7 2025-07-25 12:45:11 +00:00
Jade modified the milestone from v0.5.0-rc.7 to 0.5.0-old 2025-07-25 12:49:51 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
continuwuation/continuwuity!907
No description provided.