Skip to content

MSC2716 federation changes - #175

Merged
MadLittleMods merged 12 commits into
masterfrom
madlittlemods/msc2716-federation-changes
Sep 8, 2021
Merged

MadLittleMods merged 12 commits into
masterfrom
madlittlemods/msc2716-federation-changes

Conversation

@MadLittleMods

@MadLittleMods MadLittleMods commented Jul 23, 2021 •

Copy link
Copy Markdown
Contributor

MSC2716 federation changes

Dev notes

COMPLEMENT_DIR=../complement ./scripts-dev/complement.sh TestBackfillingHistory

messagesResAsdf := alice.MustDoFunc(t, "GET", []string{"_matrix", "client", "r0", "rooms", roomID, "messages"}, client.WithContentType("application/json"), client.WithQueries(url.Values{
	"dir":   []string{"b"},
	"limit": []string{"100"},
}))
messagesResAsdfBody := client.ParseJSON(t, messagesResAsdf)
eventDebugStringsFromResponseAsdf := getRelevantEventDebugStringsFromMessagesResponse(t, messagesResAsdfBody)
logrus.WithFields(logrus.Fields{
	"eventDebugStringsFromResponseAsdf": eventDebugStringsFromResponseAsdf,
}).Error("see messages")

Todo

@MadLittleMods
MadLittleMods marked this pull request as draft July 23, 2021 05:21
Comment thread tests/msc2716_test.go
})

t.Run("Historical messages are visible when joining on federated server - auto-generated base insertion event", func(t *testing.T) {
t.Skip("Skipping until federation is implemented")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing as matrix-org/synapse#10245 is now merged

Comment thread tests/msc2716_test.go
Comment thread tests/msc2716_test.go Outdated
Comment thread tests/msc2716_test.go
Comment thread tests/msc2716_test.go
Comment thread tests/msc2716_test.go
Comment thread tests/msc2716_test.go
Comment thread tests/msc2716_test.go
})

t.Run("When messages have already been scrolled back through, new historical messages are visible in next scroll back on federated server", func(t *testing.T) {
t.Skip("Skipping until federation is implemented")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing as matrix-org/synapse#10498 is now merged

@MadLittleMods MadLittleMods changed the title Draft: MSC2716 federation changes MSC2716 federation changes Aug 10, 2021
@MadLittleMods
MadLittleMods marked this pull request as ready for review August 10, 2021 22:44
@MadLittleMods
MadLittleMods requested a review from kegsay August 10, 2021 22:47
Comment thread tests/msc2716_test.go
})
})

t.Run("Batch send endpoint only returns state events that we passed in via state_events_at_start", func(t *testing.T) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test added to verify matrix-org/synapse#10552

Comment thread tests/msc2716_test.go
Comment thread tests/msc2716_test.go
Comment thread tests/msc2716_test.go
Comment thread tests/msc2716_test.go
Comment thread tests/msc2716_test.go
Comment thread tests/msc2716_test.go Outdated
// We only expect 1 state event to be returned because we only passed in 1
// event into `?state_events_at_start`
if len(stateEventIDs) != 1 {
t.Fatalf("Expected only 1 state event to be returned but received %d: %s", len(stateEventIDs), stateEventIDs)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
t.Fatalf("Expected only 1 state event to be returned but received %d: %s", len(stateEventIDs), stateEventIDs)
t.Fatalf("Expected only 1 state event to be returned but received %d: %v", len(stateEventIDs), stateEventIDs)

@MadLittleMods MadLittleMods Sep 8, 2021 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For my own reference, what's the benefit of using %v vs %s here?

They both appear like:

Expected only 1 state event to be returned but received 1: [$EVEa7PzafkdmDIu4kEYwlqJFSSKV_pj5h5xYfRspFs4]

Comment thread tests/msc2716_test.go
Comment thread tests/msc2716_test.go
},
}
// We can't use as.SendEventSynced(...) because application services can't use the /sync API
markerSendRes := as.MustDoFunc(t, "PUT", []string{"_matrix", "client", "r0", "rooms", roomID, "send", markerEvent.Type, "txn-m123"}, client.WithJSONBody(t, markerEvent.Content))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it a problem that the txn id never changes?

@MadLittleMods MadLittleMods Sep 8, 2021 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the homeserver is new every run, I think it's fine. I did notice that txn-m123 was re-used once, so I updated to something different.

Might be nice to add a helper function to client to get a random unique one easily (using txnId in there). I added an internal one in #192

Comment thread tests/msc2716_test.go Outdated
Comment thread tests/msc2716_test.go Outdated
Comment thread tests/msc2716_test.go Outdated

@kegsay kegsay left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise LGTM

@MadLittleMods
MadLittleMods merged commit 735548e into master Sep 8, 2021
@MadLittleMods

Copy link
Copy Markdown
Contributor Author

Thanks for the review @kegsay and catching the Python patterns that slipped in 🐆

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.

2 participants