1
0

Compare commits

..

3 Commits

Author SHA1 Message Date
Olivier 'reivilibre
6712a5d731 Newsfile 2025-06-06 16:11:01 +01:00
Emmanuel Ferdman
097b553ad5 Migrate to assertEqual
Signed-off-by: Emmanuel Ferdman <emmanuelferdman@gmail.com>
2025-05-29 05:59:39 -07:00
Hubert Chathi
2436512a25 Mark dehydrated devices in admin get devices endpoint (#18252)
Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
2025-05-28 12:20:27 +01:00
30 changed files with 107 additions and 78 deletions

View File

@@ -1,57 +1,3 @@
# Synapse 1.131.0 (2025-06-03)
No significant changes since 1.131.0rc1.
# Synapse 1.131.0rc1 (2025-05-28)
### Features
- Add `msc4263_limit_key_queries_to_users_who_share_rooms` config option as per [MSC4263](https://github.com/matrix-org/matrix-spec-proposals/pull/4263). ([\#18180](https://github.com/element-hq/synapse/issues/18180))
- Add option to allow registrations that begin with `_`. Contributed by `_` (@hex5f). ([\#18262](https://github.com/element-hq/synapse/issues/18262))
- Include room ID in response to the [Room Deletion Status Admin API](https://element-hq.github.io/synapse/latest/admin_api/rooms.html#status-of-deleting-rooms). ([\#18318](https://github.com/element-hq/synapse/issues/18318))
- Add support for calling Policy Servers ([MSC4284](https://github.com/matrix-org/matrix-spec-proposals/pull/4284)) to mark events as spam. ([\#18387](https://github.com/element-hq/synapse/issues/18387))
### Bugfixes
- Prevent race-condition in `_maybe_retry_device_resync` entrance. ([\#18391](https://github.com/element-hq/synapse/issues/18391))
- Fix the `tests.handlers.test_worker_lock.WorkerLockTestCase.test_lock_contention` test which could spuriously time out on RISC-V architectures due to performance differences. ([\#18430](https://github.com/element-hq/synapse/issues/18430))
- Fix admin redaction endpoint not redacting encrypted messages. ([\#18434](https://github.com/element-hq/synapse/issues/18434))
### Improved Documentation
- Update `room_list_publication_rules` docs to consider defaults that changed in v1.126.0. Contributed by @HarHarLinks. ([\#18286](https://github.com/element-hq/synapse/issues/18286))
- Add advice for upgrading between major PostgreSQL versions to the database documentation. ([\#18445](https://github.com/element-hq/synapse/issues/18445))
### Internal Changes
- Fix a memory leak in `_NotifierUserStream`. ([\#18380](https://github.com/element-hq/synapse/issues/18380))
- Fix a couple type annotations in the `RootConfig`/`Config`. ([\#18409](https://github.com/element-hq/synapse/issues/18409))
- Explicitly enable PyPy builds in `cibuildwheel`s config to avoid it being disabled on a future upgrade to `cibuildwheel` v3. ([\#18417](https://github.com/element-hq/synapse/issues/18417))
- Update the PR review template to remove an erroneous line break from the final bullet point. ([\#18419](https://github.com/element-hq/synapse/issues/18419))
- Explain why we `flush_buffer()` for Python `print(...)` output. ([\#18420](https://github.com/element-hq/synapse/issues/18420))
- Add lint to ensure we don't add a `CREATE/DROP INDEX` in a schema delta. ([\#18440](https://github.com/element-hq/synapse/issues/18440))
- Allow checking only for the existence of a field in an SSO provider's response, rather than requiring the value(s) to check. ([\#18454](https://github.com/element-hq/synapse/issues/18454))
- Add unit tests for homeserver usage statistics. ([\#18463](https://github.com/element-hq/synapse/issues/18463))
- Don't move invited users to new room when shutting down room. ([\#18471](https://github.com/element-hq/synapse/issues/18471))
### Updates to locked dependencies
* Bump actions/setup-python from 5.5.0 to 5.6.0. ([\#18398](https://github.com/element-hq/synapse/issues/18398))
* Bump authlib from 1.5.1 to 1.5.2. ([\#18452](https://github.com/element-hq/synapse/issues/18452))
* Bump docker/build-push-action from 6.15.0 to 6.17.0. ([\#18397](https://github.com/element-hq/synapse/issues/18397), [\#18449](https://github.com/element-hq/synapse/issues/18449))
* Bump lxml from 5.3.0 to 5.4.0. ([\#18480](https://github.com/element-hq/synapse/issues/18480))
* Bump mypy-zope from 1.0.9 to 1.0.11. ([\#18428](https://github.com/element-hq/synapse/issues/18428))
* Bump pyo3 from 0.23.5 to 0.24.2. ([\#18460](https://github.com/element-hq/synapse/issues/18460))
* Bump pyo3-log from 0.12.3 to 0.12.4. ([\#18453](https://github.com/element-hq/synapse/issues/18453))
* Bump pyopenssl from 25.0.0 to 25.1.0. ([\#18450](https://github.com/element-hq/synapse/issues/18450))
* Bump ruff from 0.7.3 to 0.11.11. ([\#18451](https://github.com/element-hq/synapse/issues/18451), [\#18482](https://github.com/element-hq/synapse/issues/18482))
* Bump tornado from 6.4.2 to 6.5.0. ([\#18459](https://github.com/element-hq/synapse/issues/18459))
* Bump setuptools from 72.1.0 to 78.1.1. ([\#18461](https://github.com/element-hq/synapse/issues/18461))
* Bump types-jsonschema from 4.23.0.20241208 to 4.23.0.20250516. ([\#18481](https://github.com/element-hq/synapse/issues/18481))
* Bump types-requests from 2.32.0.20241016 to 2.32.0.20250328. ([\#18427](https://github.com/element-hq/synapse/issues/18427))
# Synapse 1.130.0 (2025-05-20)
### Bugfixes

View File

@@ -0,0 +1 @@
Add `msc4263_limit_key_queries_to_users_who_share_rooms` config option as per [MSC4263](https://github.com/matrix-org/matrix-spec-proposals/pull/4263).

1
changelog.d/18252.misc Normal file
View File

@@ -0,0 +1 @@
Mark dehydrated devices in the [List All User Devices Admin API](https://element-hq.github.io/synapse/latest/admin_api/user_admin_api.html#list-all-devices).

View File

@@ -0,0 +1 @@
Add option to allow registrations that begin with `_`. Contributed by `_` (@hex5f).

1
changelog.d/18286.doc Normal file
View File

@@ -0,0 +1 @@
Update `room_list_publication_rules` docs to consider defaults that changed in v1.126.0. Contributed by @HarHarLinks.

View File

@@ -0,0 +1 @@
Include room ID in room deletion status response.

1
changelog.d/18380.misc Normal file
View File

@@ -0,0 +1 @@
Fix a memory leak in `_NotifierUserStream`.

View File

@@ -0,0 +1 @@
Add support for calling Policy Servers ([MSC4284](https://github.com/matrix-org/matrix-spec-proposals/pull/4284)) to mark events as spam.

1
changelog.d/18391.bugfix Normal file
View File

@@ -0,0 +1 @@
Prevent race-condition in `_maybe_retry_device_resync` entrance.

1
changelog.d/18409.misc Normal file
View File

@@ -0,0 +1 @@
Fix a couple type annotations in the `RootConfig`/`Config`.

1
changelog.d/18417.misc Normal file
View File

@@ -0,0 +1 @@
Explicitly enable PyPy builds in `cibuildwheel`s config to avoid it being disabled on a future upgrade to `cibuildwheel` v3.

1
changelog.d/18419.misc Normal file
View File

@@ -0,0 +1 @@
Update the PR review template to remove an erroneous line break from the final bullet point.

1
changelog.d/18420.misc Normal file
View File

@@ -0,0 +1 @@
Explain why we `flush_buffer()` for Python `print(...)` output.

1
changelog.d/18430.bugfix Normal file
View File

@@ -0,0 +1 @@
Fix the `tests.handlers.test_worker_lock.WorkerLockTestCase.test_lock_contention` test which could spuriously time out on RISC-V architectures due to performance differences.

1
changelog.d/18434.bugfix Normal file
View File

@@ -0,0 +1 @@
Fix admin redaction endpoint not redacting encrypted messages.

1
changelog.d/18440.misc Normal file
View File

@@ -0,0 +1 @@
Add lint to ensure we don't add a `CREATE/DROP INDEX` in a schema delta.

1
changelog.d/18445.doc Normal file
View File

@@ -0,0 +1 @@
Add advice for upgrading between major PostgreSQL versions to the database documentation.

1
changelog.d/18451.misc Normal file
View File

@@ -0,0 +1 @@
Bump ruff from 0.7.3 to 0.11.10.

1
changelog.d/18454.misc Normal file
View File

@@ -0,0 +1 @@
Allow checking only for the existence of a field in an SSO provider's response, rather than requiring the value(s) to check.

1
changelog.d/18459.misc Normal file
View File

@@ -0,0 +1 @@
Bump tornado from 6.4.2 to 6.5.0.

1
changelog.d/18460.misc Normal file
View File

@@ -0,0 +1 @@
Bump pyo3 from 0.23.5 to 0.24.2.

1
changelog.d/18463.misc Normal file
View File

@@ -0,0 +1 @@
Add unit tests for homeserver usage statistics.

1
changelog.d/18471.misc Normal file
View File

@@ -0,0 +1 @@
Don't move invited users to new room when shutting down room.

1
changelog.d/18488.misc Normal file
View File

@@ -0,0 +1 @@
Migrate `assertEquals` (deprecated) to `assertEqual` in the tests. Contributed by @emmanuel-ferdman.

12
debian/changelog vendored
View File

@@ -1,15 +1,3 @@
matrix-synapse-py3 (1.131.0) stable; urgency=medium
* New Synapse release 1.131.0.
-- Synapse Packaging team <packages@matrix.org> Tue, 03 Jun 2025 14:36:55 +0100
matrix-synapse-py3 (1.131.0~rc1) stable; urgency=medium
* New synapse release 1.131.0rc1.
-- Synapse Packaging team <packages@matrix.org> Wed, 28 May 2025 10:25:44 +0000
matrix-synapse-py3 (1.130.0) stable; urgency=medium
* New Synapse release 1.130.0.

View File

@@ -954,7 +954,8 @@ A response body like the following is returned:
"last_seen_ip": "1.2.3.4",
"last_seen_user_agent": "Mozilla/5.0 (X11; Linux x86_64; rv:103.0) Gecko/20100101 Firefox/103.0",
"last_seen_ts": 1474491775024,
"user_id": "<user_id>"
"user_id": "<user_id>",
"dehydrated": false
},
{
"device_id": "AUIECTSRND",
@@ -962,7 +963,8 @@ A response body like the following is returned:
"last_seen_ip": "1.2.3.5",
"last_seen_user_agent": "Mozilla/5.0 (X11; Linux x86_64; rv:103.0) Gecko/20100101 Firefox/103.0",
"last_seen_ts": 1474491775025,
"user_id": "<user_id>"
"user_id": "<user_id>",
"dehydrated": false
}
],
"total": 2
@@ -992,6 +994,7 @@ The following fields are returned in the JSON response body:
- `last_seen_ts` - The timestamp (in milliseconds since the unix epoch) when this
devices was last seen. (May be a few minutes out of date, for efficiency reasons).
- `user_id` - Owner of device.
- `dehydrated` - Whether the device is a dehydrated device.
- `total` - Total number of user's devices.

View File

@@ -97,7 +97,7 @@ module-name = "synapse.synapse_rust"
[tool.poetry]
name = "matrix-synapse"
version = "1.131.0"
version = "1.130.0"
description = "Homeserver for the Matrix decentralised comms protocol"
authors = ["Matrix.org Team and Contributors <packages@matrix.org>"]
license = "AGPL-3.0-or-later"

View File

@@ -145,6 +145,17 @@ class DevicesGetRestServlet(RestServlet):
devices = await self.device_worker_handler.get_devices_by_user(
target_user.to_string()
)
# mark the dehydrated device by adding a "dehydrated" flag
dehydrated_device_info = await self.device_worker_handler.get_dehydrated_device(
target_user.to_string()
)
if dehydrated_device_info:
dehydrated_device_id = dehydrated_device_info[0]
for device in devices:
is_dehydrated = device["device_id"] == dehydrated_device_id
device["dehydrated"] = is_dehydrated
return HTTPStatus.OK, {"devices": devices, "total": len(devices)}

View File

@@ -27,7 +27,7 @@ from twisted.test.proto_helpers import MemoryReactor
import synapse.rest.admin
from synapse.api.errors import Codes
from synapse.handlers.device import DeviceHandler
from synapse.rest.client import login
from synapse.rest.client import devices, login
from synapse.server import HomeServer
from synapse.util import Clock
@@ -299,6 +299,7 @@ class DeviceRestTestCase(unittest.HomeserverTestCase):
class DevicesRestTestCase(unittest.HomeserverTestCase):
servlets = [
synapse.rest.admin.register_servlets,
devices.register_servlets,
login.register_servlets,
]
@@ -390,15 +391,63 @@ class DevicesRestTestCase(unittest.HomeserverTestCase):
self.assertEqual(0, channel.json_body["total"])
self.assertEqual(0, len(channel.json_body["devices"]))
@unittest.override_config(
{"experimental_features": {"msc2697_enabled": False, "msc3814_enabled": True}}
)
def test_get_devices(self) -> None:
"""
Tests that a normal lookup for devices is successfully
"""
# Create devices
number_devices = 5
for _ in range(number_devices):
# we create 2 fewer devices in the loop, because we will create another
# login after the loop, and we will create a dehydrated device
for _ in range(number_devices - 2):
self.login("user", "pass")
other_user_token = self.login("user", "pass")
dehydrated_device_url = (
"/_matrix/client/unstable/org.matrix.msc3814.v1/dehydrated_device"
)
content = {
"device_data": {
"algorithm": "m.dehydration.v1.olm",
},
"device_id": "dehydrated_device",
"initial_device_display_name": "foo bar",
"device_keys": {
"user_id": "@user:test",
"device_id": "dehydrated_device",
"valid_until_ts": "80",
"algorithms": [
"m.olm.curve25519-aes-sha2",
],
"keys": {
"<algorithm>:<device_id>": "<key_base64>",
},
"signatures": {
"@user:test": {"<algorithm>:<device_id>": "<signature_base64>"}
},
},
"fallback_keys": {
"alg1:device1": "f4llb4ckk3y",
"signed_<algorithm>:<device_id>": {
"fallback": "true",
"key": "f4llb4ckk3y",
"signatures": {
"@user:test": {"<algorithm>:<device_id>": "<key_base64>"}
},
},
},
"one_time_keys": {"alg1:k1": "0net1m3k3y"},
}
self.make_request(
"PUT",
dehydrated_device_url,
access_token=other_user_token,
content=content,
)
# Get devices
channel = self.make_request(
"GET",
@@ -410,13 +459,22 @@ class DevicesRestTestCase(unittest.HomeserverTestCase):
self.assertEqual(number_devices, channel.json_body["total"])
self.assertEqual(number_devices, len(channel.json_body["devices"]))
self.assertEqual(self.other_user, channel.json_body["devices"][0]["user_id"])
# Check that all fields are available
# Check that all fields are available, and that the dehydrated device is marked as dehydrated
found_dehydrated = False
for d in channel.json_body["devices"]:
self.assertIn("user_id", d)
self.assertIn("device_id", d)
self.assertIn("display_name", d)
self.assertIn("last_seen_ip", d)
self.assertIn("last_seen_ts", d)
if d["device_id"] == "dehydrated_device":
self.assertTrue(d.get("dehydrated"))
found_dehydrated = True
else:
# Either the field is not present, or set to False
self.assertFalse(d.get("dehydrated"))
self.assertTrue(found_dehydrated)
class DeleteDevicesRestTestCase(unittest.HomeserverTestCase):

View File

@@ -112,11 +112,11 @@ class TestTaskScheduler(HomeserverTestCase):
# At this point, there should be MAX_CONCURRENT_RUNNING_TASKS active tasks and
# one scheduled task.
self.assertEquals(
self.assertEqual(
len(get_tasks_of_status(TaskStatus.ACTIVE)),
TaskScheduler.MAX_CONCURRENT_RUNNING_TASKS,
)
self.assertEquals(
self.assertEqual(
len(get_tasks_of_status(TaskStatus.SCHEDULED)),
1,
)
@@ -126,17 +126,17 @@ class TestTaskScheduler(HomeserverTestCase):
# Check that MAX_CONCURRENT_RUNNING_TASKS tasks have run and that one
# is still scheduled.
self.assertEquals(
self.assertEqual(
len(get_tasks_of_status(TaskStatus.COMPLETE)),
TaskScheduler.MAX_CONCURRENT_RUNNING_TASKS,
)
scheduled_tasks = get_tasks_of_status(TaskStatus.SCHEDULED)
self.assertEquals(len(scheduled_tasks), 1)
self.assertEqual(len(scheduled_tasks), 1)
# The scheduled task should start 0.1s after the first of the active tasks
# finishes
self.reactor.advance(0.1)
self.assertEquals(len(get_tasks_of_status(TaskStatus.ACTIVE)), 1)
self.assertEqual(len(get_tasks_of_status(TaskStatus.ACTIVE)), 1)
# ... and should finally complete after another second
self.reactor.advance(1)
@@ -144,7 +144,7 @@ class TestTaskScheduler(HomeserverTestCase):
self.task_scheduler.get_task(scheduled_tasks[0].id)
)
assert prev_scheduled_task is not None
self.assertEquals(
self.assertEqual(
prev_scheduled_task.status,
TaskStatus.COMPLETE,
)