Fix the description of the allowed_lifetime_min retention option (#20520)

The config documentation said `allowed_lifetime_min` bounds a room's
`min_lifetime`. It actually sets the minimum allowed value for
`max_lifetime`: purge jobs raise a room's `max_lifetime` to
`allowed_lifetime_min` when it is lower
(`synapse/handlers/pagination.py`), and
`synapse/rest/client/retention.py` reports both `allowed_lifetime_*`
options as bounds on `max_lifetime`.
`docs/message_retention_policies.md` already describes this correctly.
This commit is contained in:
mxandreas authored and GitHub committed 2026-11-23 13:10:55 +00:00
1 parent a20d648506
commit 5db8d08bf7
4 files changed
+20 -37

No files matched your search

+1
View File
@@ -0,0 +1 @@
Fix the documentation of the `allowed_lifetime_min` and `allowed_lifetime_max` retention options, and remove the `min_lifetime` retention option, which Synapse doesn't act on, from the documentation.
+5 -15
View File
@@ -18,13 +18,6 @@ it was sent to the room. If a room doesn't have a message retention
policy, and there's no default one for a given server, then no message
sent in that room is ever purged on that server.
MSC1763 also specifies semantics for a `min_lifetime` parameter which
defines the amount of time after which an event _can_ get purged (after
it was sent to the room), but Synapse doesn't currently support it
beyond registering it.
Both `max_lifetime` and `min_lifetime` are optional parameters.
Note that message retention policies don't apply to state events.
Once an event reaches its expiry date (defined as the time it was sent
@@ -72,14 +65,13 @@ the configuration file and adding these sub-options:
```yaml
default_policy:
min_lifetime: 1d
max_lifetime: 1y
```
Here, `min_lifetime` and `max_lifetime` have the same meaning and level
of support as previously described. They can be expressed either as a
duration (using the units `s` (seconds), `m` (minutes), `h` (hours),
`d` (days), `w` (weeks) and `y` (years)) or as a number of milliseconds.
Here, `max_lifetime` has the same meaning as previously described. It
can be expressed either as a duration (using the units `s` (seconds),
`m` (minutes), `h` (hours), `d` (days), `w` (weeks) and `y` (years)) or
as a number of milliseconds.
### Purge jobs
@@ -185,9 +177,7 @@ moderator needs to send a state event in that room with the type
In this event's content, the `max_lifetime` parameter has the same
meaning as previously described, and needs to be expressed in
milliseconds. The event's content can also include a `min_lifetime`
parameter, which has the same meaning and limited support as previously
described.
milliseconds.
Note that over every server in the room, only the ones with support for
message retention policies will actually remove expired events. This
@@ -1169,13 +1169,11 @@ This setting has the following sub-options:
This setting has the following sub-options:
* `min_lifetime`: Minimum message retention time of the default message retention policy. Synapse doesn't take this option into account yet. Defaults to `null`.
* `max_lifetime`: Maximum message retention time of the default message retention policy. Defaults to `null`.
* `allowed_lifetime_min`: Retention policy limit. If set, and the state of a room contains a `m.room.retention` event in its state which contains a `min_lifetime` that's beyond this bound, Synapse will cap the room's policy to these limits when running purge jobs. Defaults to `null`.
* `allowed_lifetime_min`: Retention policy limit: the minimum allowed value for `max_lifetime`. If set, and the `max_lifetime` that applies to a room is below this bound, Synapse will use this value instead when running purge jobs. This applies both to a room's explicit retention policy (its `m.room.retention` state event) and to the default policy used when the room has none. Defaults to `null`.
* `allowed_lifetime_max`: Retention policy limit. If set, and the state of a room contains a `m.room.retention` event in its state which contains a `max_lifetime` that's beyond this bound, Synapse will cap the room's policy to these limits when running purge jobs. Defaults to `null`.
* `allowed_lifetime_max`: Retention policy limit: the maximum allowed value for `max_lifetime`. If set, and the `max_lifetime` that applies to a room is above this bound, Synapse will use this value instead when running purge jobs. This applies both to a room's explicit retention policy (its `m.room.retention` state event) and to the default policy used when the room has none. Defaults to `null`.
* `purge_jobs` (array|null): Server admins can define the settings of the background jobs purging the events whose lifetime has expired under the `purge_jobs` section.
@@ -1202,7 +1200,6 @@ Example configuration:
retention:
enabled: true
default_policy:
min_lifetime: 1d
max_lifetime: 1y
allowed_lifetime_min: 1d
allowed_lifetime_max: 1y
+12 -17
View File
@@ -1418,14 +1418,6 @@ properties:
Default message retention policy. If set, Synapse will apply it to
rooms that lack the `m.room.retention` state event.
properties:
min_lifetime:
oneOf:
- $ref: "#/$defs/duration"
- type: "null"
description: >-
Minimum message retention time of the default message retention
policy. Synapse doesn't take this option into account yet.
default: null
max_lifetime:
oneOf:
- $ref: "#/$defs/duration"
@@ -1438,20 +1430,24 @@ properties:
- $ref: "#/$defs/duration"
- type: "null"
description: >-
Retention policy limit. If set, and the state of a room contains a
`m.room.retention` event in its state which contains a `min_lifetime`
that's beyond this bound, Synapse will cap the room's policy to these
limits when running purge jobs.
Retention policy limit: the minimum allowed value for `max_lifetime`.
If set, and the `max_lifetime` that applies to a room is below this
bound, Synapse will use this value instead when running purge jobs.
This applies both to a room's explicit retention policy (its
`m.room.retention` state event) and to the default policy used when
the room has none.
default: null
allowed_lifetime_max:
oneOf:
- $ref: "#/$defs/duration"
- type: "null"
description: >-
Retention policy limit. If set, and the state of a room contains a
`m.room.retention` event in its state which contains a `max_lifetime`
that's beyond this bound, Synapse will cap the room's policy to these
limits when running purge jobs.
Retention policy limit: the maximum allowed value for `max_lifetime`.
If set, and the `max_lifetime` that applies to a room is above this
bound, Synapse will use this value instead when running purge jobs.
This applies both to a room's explicit retention policy (its
`m.room.retention` state event) and to the default policy used when
the room has none.
default: null
purge_jobs:
type: ["array", "null"]
@@ -1518,7 +1514,6 @@ properties:
examples:
- enabled: true
default_policy:
min_lifetime: 1d
max_lifetime: 1y
allowed_lifetime_min: 1d
allowed_lifetime_max: 1y