-
Notifications
You must be signed in to change notification settings - Fork 369
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MSC3997: Add timestamp massaging to /createRoom
#3997
Open
MadLittleMods
wants to merge
5
commits into
main
Choose a base branch
from
madlittlemods/createroom-timestamp-massaging
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
08b26d2
Add proposal for adding timestamp massaging to /createRoom
MadLittleMods dad262a
Use MSC number
MadLittleMods 5cd3644
Fix wrong MSC number
MadLittleMods 818dda0
Add punctuation
MadLittleMods 6a3404a
Add cross-reference to MSC3998
MadLittleMods File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
# MSC3997: Add timestamp massaging to `/createRoom` | ||
|
||
[Timestamp massaging is an existing | ||
concept](https://spec.matrix.org/v1.5/application-service-api/#timestamp-massaging) | ||
introduced by [MSC3316](https://github.com/matrix-org/matrix-spec-proposals/pull/3316) | ||
for the `/send?ts=123` and `/state?ts=123` endpoint in order to override the | ||
`origin_server_ts` of sent events. | ||
|
||
But timestamp massaging is impossible for the primordial events created by `/createRoom` | ||
like `m.room.create`, the initial creator `m.room.member`, `m.room.power_levels`, etc; | ||
and room creation can't be mimicked with `/send`/`/state`. | ||
|
||
When writing end-to-end tests, it's useful to have your room appear as though it was | ||
created back in time before your messages were sent and to have stable/consistent | ||
timestamps. If you start using timestamp massaging when sending messages, it can appear | ||
as though those events occurred before the `m.room.create` and other primordial events. | ||
We specifically run into this with the [Matrix Public | ||
Archive](https://github.com/matrix-org/matrix-public-archive/) end-to-end tests. | ||
|
||
In real-life scenarios, practically, this hasn't mattered much for content because the | ||
DAG is ordered topologically and not by timestamp but is a semantic inconsistency that | ||
is becoming more important with API's like `/timestamp_to_event` which find events by | ||
their `origin_server_ts`. And makes things tricky for the Matrix Public Archive to | ||
navigate tombstone and predecessor room upgrade history by date assuming good | ||
intentions. | ||
|
||
This idea is tracked in Synapse by https://github.com/matrix-org/synapse/issues/15346 | ||
|
||
## Proposal | ||
|
||
Add timestamp massaging to the `/createRoom` endpoint to be able to override the | ||
`origin_server_ts` of all primordial events created with that call. We do this by adding | ||
a `ts` querystring parameter on `POST /_matrix/client/v3/createRoom?ts=123` specifying | ||
the value to apply to `origin_server_ts` on the event (UNIX epoch milliseconds). | ||
|
||
This functionality is restricted to the application service (AS) API to be consistent | ||
with [MSC3316](https://github.com/matrix-org/matrix-spec-proposals/pull/3316). There | ||
could be future considerations to opening this up to any client as it's kinda arbitrary | ||
to restrict it this way and just seems like friction to try to get only people with good | ||
intentions using it. | ||
|
||
--- | ||
|
||
Also related: [MSC3998](https://github.com/matrix-org/matrix-spec-proposals/pull/3998) | ||
proposes adding a `ts` querystring parameter to the `/join` and `/knock` endpoints but | ||
for different reasons. | ||
|
||
## Potential issues | ||
|
||
*None surmised so far* | ||
|
||
|
||
## Alternatives | ||
|
||
*None at the moment* | ||
|
||
|
||
## Security considerations | ||
|
||
Timestamps should already be considered untrusted over federation, and application | ||
services are trusted server components, so allowing appservices to override timestamps | ||
does not create any new security considerations. | ||
|
||
|
||
## Unstable prefix | ||
|
||
While this feature is in development, the `ts` querystring parameter can be used as | ||
`org.matrix.msc3997.ts` | ||
|
||
### While the MSC is unstable | ||
|
||
During this period, to detect server support clients should check for the presence of | ||
the `org.matrix.msc3997` flag in `unstable_features` on `/versions`. Clients are also | ||
required to use the unstable prefixes (see [unstable prefix](#unstable-prefix)) during | ||
this time. | ||
|
||
### Once the MSC is merged but not in a spec version | ||
|
||
Once this MSC is merged, but is not yet part of the spec, clients should rely on the | ||
presence of the `org.matrix.msc3997.stable` flag in `unstable_features` to determine | ||
server support. If the flag is present, clients are required to use stable prefixes (see | ||
[unstable prefix](#unstable-prefix)). | ||
|
||
### Once the MSC is in a spec version | ||
|
||
Once this MSC becomes a part of a spec version, clients should rely on the presence of | ||
the spec version, that supports the MSC, in `versions` on `/versions`, to determine | ||
support. Servers are encouraged to keep the `org.matrix.msc3997.stable` flag around for | ||
a reasonable amount of time to help smooth over the transition for clients. "Reasonable" | ||
is intentionally left as an implementation detail, however the MSC process currently | ||
recommends *at most* 2 months from the date of spec release. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @ara4n as the original
?ts
proposer from the old version of MSC2716cc @tulir as an interested party in timestamp massaging (author of MSC3316 and one of the main consumers of the
?ts
API)