Skip to content

Use sender instead of user_id for any stripped state event usages#1424

Closed
MadLittleMods wants to merge 1 commit into
developfrom
madlittlemods/user_id-to-sender-invite-room-state
Closed

Use sender instead of user_id for any stripped state event usages#1424
MadLittleMods wants to merge 1 commit into
developfrom
madlittlemods/user_id-to-sender-invite-room-state

Conversation

@MadLittleMods

@MadLittleMods MadLittleMods commented May 26, 2026

Copy link
Copy Markdown
Contributor

Use sender instead of user_id for any stripped state event usages

Spawning from element-hq/synapse#19723 (where these tests started to fail) which ensures we actually use stripped state everywhere. Stripped state only has content, sender, state_key, type available. Previously, this relied on the full PDU being available which meant access touser_id as well.

user_id is a deprecated field from Synapse that isn't in the spec.

Dev notes

Example failure:
Error: FAILURE: #219: Can invite unbound 3pid over federation with no ops into a private room
Logs
  # Started: 2026-05-26 20:15:54.169
  # Ended: 2026-05-26 20:15:55.904
  # No inviter member invite state at tests/30rooms/12thirdpartyinvite.pl line 229.
  # 0.029646: Registered new user @anon-20260526_201439-154:127.0.0.1:8838
  # 0.052488: Registered new user @anon-20260526_201439-152:127.0.0.1:8800
  # 0.053313: Registered new user @anon-20260526_201439-153:127.0.0.1:8800
  # 0.439184: room_id=!KRaggKHbkwunOCEjIy:127.0.0.1:8800
  # 0.545050: Invited user @anon-20260526_201439-153:127.0.0.1:8800 to !KRaggKHbkwunOCEjIy:127.0.0.1:8800
  # {}
  # 0.664036: User @anon-20260526_201439-153:127.0.0.1:8800 joined room
  # { room_id => "!KRaggKHbkwunOCEjIy:127.0.0.1:8800" }
  # 0.714240: Created room_id=!KRaggKHbkwunOCEjIy:127.0.0.1:8800
  # 1.159396: sent 3pid invite for lemurs@monkeyworld.org to SyTest::Identity::Server=HASH(0x55b492174fc8)
  # 1.730745: Invite
  # {
  #   invite_state => {
  #     events => [
  #       {
  #         content   => {
  #                        creator => "\@anon-20260526_201439-152:127.0.0.1:8800",
  #                        room_version => 10,
  #                      },
  #         sender    => "\@anon-20260526_201439-152:127.0.0.1:8800",
  #         state_key => "",
  #         type      => "m.room.create",
  #       },
  #       {
  #         content   => { join_rule => "invite" },
  #         sender    => "\@anon-20260526_201439-152:127.0.0.1:8800",
  #         state_key => "",
  #         type      => "m.room.join_rules",
  #       },
  #       {
  #         content   => { alias => "#test-20260526_201439-23:127.0.0.1:8800" },
  #         sender    => "\@anon-20260526_201439-152:127.0.0.1:8800",
  #         state_key => "",
  #         type      => "m.room.canonical_alias",
  #       },
  #       {
  #         content   => {
  #                        membership => "invite",
  #                        third_party_invite => {
  #                          display_name => "Bob",
  #                          signed => {
  #                            mxid => "\@anon-20260526_201439-154:127.0.0.1:8838",
  #                            signatures => {
  #                              "localhost:45425" => {
  #                                "ed25519:0" => "nYMBeK9UPutCo2CxT7JQat8pwbmmixGJT/xVTqsRZVArP7YVwWv0XRogUYA82pSqoZyw9eLtQ6dvmT4ORuAqAg",
  #                              },
  #                            },
  #                            token => 3,
  #                          },
  #                        },
  #                      },
  #         sender    => "\@anon-20260526_201439-153:127.0.0.1:8800",
  #         state_key => "\@anon-20260526_201439-154:127.0.0.1:8838",
  #         type      => "m.room.member",
  #       },
  #     ],
  #   },
  # }

Testing:

docker run --rm -it \
    -v ~/Documents/github/element/synapse:/src:ro \
    -v ~/Documents/github/element/sytest/logs\:/logs \
    -v ~/Documents/github/element/sytest:/sytest:ro \
    matrixdotorg/sytest-synapse:bookworm \
    tests/30rooms/12thirdpartyinvite.pl

Generic (from docs):

docker run --rm -it -v /path/to/synapse\:/src:ro -v /path/to/where/you/want/logs\:/logs \
    -v /path/to/code/sytest\:/sytest:ro matrixdotorg/sytest-synapse:bookworm

@MadLittleMods

Copy link
Copy Markdown
Contributor Author

Closing in favor of #1425 which has the same branch name as the Synapse changes (element-hq/synapse#19723)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant