From a2cf1aaf4819c1548534accdc90768cc44ed6edd Mon Sep 17 00:00:00 2001 From: S7evinK <2353100+S7evinK@users.noreply.github.com> Date: Mon, 14 Mar 2022 20:04:24 +0100 Subject: [PATCH] Fix /context with lazy_load_members (#2277) * Add membership events to the end of the list, to ensure Sytest sees them * Move tests to allowlist * Append to correct list, fix logging message * Add flakey tests to blacklist * Remove flakey tests from whitelist --- syncapi/routing/context.go | 8 +++++--- sytest-blacklist | 4 ++-- sytest-whitelist | 4 +--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/syncapi/routing/context.go b/syncapi/routing/context.go index d07fc0c6..2412bc2a 100644 --- a/syncapi/routing/context.go +++ b/syncapi/routing/context.go @@ -66,7 +66,7 @@ func Context( membershipRes := roomserver.QueryMembershipForUserResponse{} membershipReq := roomserver.QueryMembershipForUserRequest{UserID: device.UserID, RoomID: roomID} if err = rsAPI.QueryMembershipForUser(ctx, &membershipReq, &membershipRes); err != nil { - logrus.WithError(err).Error("unable to fo membership") + logrus.WithError(err).Error("unable to query membership") return jsonerror.InternalServerError() } @@ -158,17 +158,19 @@ func applyLazyLoadMembers(filter *gomatrixserverlib.RoomEventFilter, eventsAfter } newState := []*gomatrixserverlib.HeaderedEvent{} + membershipEvents := []*gomatrixserverlib.HeaderedEvent{} for _, event := range state { if event.Type() != gomatrixserverlib.MRoomMember { newState = append(newState, event) } else { // did the user send an event? if x[event.Sender()] { - newState = append(newState, event) + membershipEvents = append(membershipEvents, event) } } } - return newState + // Add the membershipEvents to the end of the list, to make Sytest happy + return append(newState, membershipEvents...) } func parseRoomEventFilter(req *http.Request) (*gomatrixserverlib.RoomEventFilter, error) { diff --git a/sytest-blacklist b/sytest-blacklist index cee2406e..6a3b8839 100644 --- a/sytest-blacklist +++ b/sytest-blacklist @@ -24,7 +24,6 @@ Local device key changes get to remote servers with correct prev_id # Flakey Local device key changes appear in /keys/changes -/context/ with lazy_load_members filter works # we don't support groups Remove group category @@ -32,9 +31,10 @@ Remove group role # Flakey AS-ghosted users can use rooms themselves -/context/ with lazy_load_members filter works AS-ghosted users can use rooms via AS Events in rooms with AS-hosted room aliases are sent to AS server +Inviting an AS-hosted user asks the AS server +Accesing an AS-hosted room alias asks the AS server # Flakey, need additional investigation Messages that notify from another user increment notification_count diff --git a/sytest-whitelist b/sytest-whitelist index 6c4745b3..c3a4ad92 100644 --- a/sytest-whitelist +++ b/sytest-whitelist @@ -515,7 +515,6 @@ AS can create a user with inhibit_login AS can set avatar for ghosted users AS can set displayname for ghosted users Ghost user must register before joining room -Inviting an AS-hosted user asks the AS server Can generate a openid access_token that can be exchanged for information about a user Invalid openid access tokens are rejected Requests to userinfo without access tokens are rejected @@ -661,6 +660,5 @@ Multiple calls to /sync should not cause 500 errors Canonical alias can be set Canonical alias can include alt_aliases Can delete canonical alias -Multiple calls to /sync should not cause 500 errors AS can make room aliases -Accesing an AS-hosted room alias asks the AS server +/context/ with lazy_load_members filter works