Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Some fields are missing in events of /sync response #4359

Closed
elinorbgr opened this issue Jan 7, 2019 · 8 comments
Closed

Some fields are missing in events of /sync response #4359

elinorbgr opened this issue Jan 7, 2019 · 8 comments

Comments

@elinorbgr
Copy link

Description

Some state events sent in an initial /sync response from synapse are missing the origin_server_ts and event_id, while the spec lists them as required.

Steps to reproduce

Attempting to parse the sync response using ruma-client fails because these fields are missing, see https://github.com/ruma/ruma-events/pull/20

Version information

  • Homeserver: my personal HS

If not matrix.org:

  • Version: synapse version 0.34.0

  • Install method: pip

  • Platform: Gentoo/Linux in a python3 virtualenv

@richvdh
Copy link
Member

richvdh commented Jan 8, 2019

This is surprising. Both of these fields should be present. Can you provide clearer repro steps and/or a dump of the json you believe to be faulty?

@richvdh
Copy link
Member

richvdh commented Jan 8, 2019

@elinorbgr
Copy link
Author

It specifically affects the "invite" rooms in the sync response, here is a json extract. We can see that the 3 first state events don't have these fields.

"invite": {
   "!JnIqzGggEpbkjEPJvc:safaradeg.net":{
      "invite_state":{
         "events":[
            {
               "content":{
                  "join_rule":"invite"
               },
               "sender":"@levans:safaradeg.net",
               "state_key":"",
               "type":"m.room.join_rules"
            },
            {
               "content":{
                  "name":"TEST"
               },
               "sender":"@levans:safaradeg.net",
               "state_key":"",
               "type":"m.room.name"
            },
            {
               "content":{
                  "avatar_url":"mxc://safaradeg.net/TfUUoDkOWpbbIwuIpShznpNp",
                  "displayname":"Levans",
                  "membership":"join"
               },
               "sender":"@levans:safaradeg.net",
               "state_key":"@levans:safaradeg.net",
               "type":"m.room.member"
            },
            {
               "content":{
                  "avatar_url":null,
                  "displayname":null,
                  "membership":"invite"
               },
               "event_id":"$1546954279258alCXG:safaradeg.net",
               "membership":"invite",
               "origin_server_ts":1546954279291,
               "sender":"@levans:safaradeg.net",
               "state_key":"@tabsbot:safaradeg.net",
               "type":"m.room.member",
               "unsigned":{
                  "age":17030,
                  "prev_content":{
                     "membership":"leave"
                  },
                  "prev_sender":"@levans:safaradeg.net",
                  "replaces_state":"$1546954273257NfLye:safaradeg.net"
               }
            }
         ]
      }
   }
}

@richvdh
Copy link
Member

richvdh commented Jan 8, 2019

https://matrix.org/docs/spec/client_server/r0.4.0.html#get-matrix-client-r0-sync says:

invite_state: ... These state events may only have the sender, type, state_key and content keys present.

@elinorbgr
Copy link
Author

Oh. That explains it.

But in that case, according to the spec, invite_state should only contain stripped events, (it is defined as a [StrippedState]), but here the 4th event is not stripped. So there is still an inconsistency...

@richvdh
Copy link
Member

richvdh commented Jan 8, 2019

the spec does say "may only have", rather than "will only have", but yes I'm inclined to agree this is inconsistent and a bug which should be fixed.

@richvdh
Copy link
Member

richvdh commented Jan 8, 2019

could you open a new bug which describes the problem succinctly?

@elinorbgr
Copy link
Author

Will do

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants