Skip to content

Commit 3f0ba9c

Browse files
bwindelsturt2liveanoadragon453
authored
MSC3267: Reference relations (#3267)
* initial draft of reference relations msc * change MSC number * Apply formatting * Convert to point at present rather than ideal * Clarify that multiple relations is a thing we don't have and won't fix here * Fix wording to match reality, again * fix a typo Co-authored-by: Travis Ralston <[email protected]> Co-authored-by: Andrew Morgan <[email protected]>
1 parent e979b3b commit 3f0ba9c

File tree

1 file changed

+92
-0
lines changed

1 file changed

+92
-0
lines changed

proposals/3267-reference-relations.md

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# MSC3267: reference relationships
2+
3+
## Proposal
4+
5+
This proposal defines a relation type (using
6+
[MSC2674 relations](https://github.com/matrix-org/matrix-doc/pull/2674))
7+
for events to make a reference to another event.
8+
9+
A `rel_type` of `m.reference` is defined as a generic way to associate an
10+
event with another event. As a bundle, `m.reference` relations appear as
11+
an object with a single `chunk` field. The `chunk` is an array of objects
12+
with a single `event_id` field for all the child events which `m.reference`
13+
the parent.
14+
15+
There are no implied semantics by a reference relation: the feature or event
16+
type which makes use of the `rel_type` should specify what sort of semantic
17+
behaviour there is, if any. For example, describing that a poll response event
18+
*references* the poll start event, or that a location update *references* a
19+
previous location update.
20+
21+
Reference relations are used by [MSC2241](https://github.com/matrix-org/matrix-doc/pull/2241)
22+
to tie all events together for the same verification request.
23+
24+
For instance, an `m.room.message` which references an existing event
25+
would look like:
26+
27+
```json5
28+
{
29+
// Unimportant fields omitted
30+
"type": "m.room.message",
31+
"content": {
32+
"msgtype": "m.text",
33+
"body": "i <3 shelties",
34+
"m.relates_to": {
35+
"rel_type": "m.reference",
36+
"event_id": "$another_event_id"
37+
}
38+
}
39+
}
40+
```
41+
42+
## Server aggregation
43+
44+
[MSC2674](https://github.com/matrix-org/matrix-doc/pull/2674) states
45+
that values for `rel_type` should define how the server should aggregate the
46+
`rel_type`. For `m.reference`, child events are bundled to appear as follows
47+
under `m.relations`:
48+
49+
```json5
50+
{
51+
"m.reference": {
52+
"chunk": [
53+
{"event_id": "$one"},
54+
{"event_id": "$two"},
55+
{"event_id": "$three"}
56+
]
57+
}
58+
}
59+
```
60+
61+
Note that currently only the `event_id` is noted in the chunk, however a future
62+
MSC might add more fields.
63+
64+
## Limitations
65+
66+
Different subtypes of references could be defined through additional fields on
67+
the `m.relates_to` object, to distinguish between other forms of semantic behaviour
68+
independent of type (hypothetical threads, replies, etc if we didn't have a system
69+
for them already). This MSC doesn't attempt to define these subtypes.
70+
71+
This relation cannot be used in conjunction with another relation due to `rel_type`
72+
being a single value. This is known and unfortunately not resolved by this MSC.
73+
A future MSC might address the concern.
74+
75+
## Edge Cases
76+
77+
Can you reference an event which doesn't have logical meaning? Eg to a [reaction](https://github.com/matrix-org/matrix-doc/pull/2677)?
78+
* Yes, at the protocol level. But you shouldn't expect clients to do anything
79+
useful with it.
80+
* The relationship is effectively pointless, so the event would appear as though
81+
there was no reference relationship.
82+
83+
Do we need to support retrospective references?
84+
* For something like "m.duplicate" to retrospectively declare that one event
85+
dupes another, we might need to bundle two-levels deep (subject+ref and then
86+
ref+target). We can cross this bridge when we get there though, as another
87+
aggregation type
88+
89+
## Unstable prefix
90+
91+
Unfortunately not applicable - this MSC was used in production and appears in the
92+
specified version of the [key verification framework](https://spec.matrix.org/v1.2/client-server-api/#key-verification-framework).

0 commit comments

Comments
 (0)