Skip to content
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

MSC2716 federation changes #175

Merged
merged 12 commits into from
Sep 8, 2021

Conversation

MadLittleMods
Copy link
Contributor

@MadLittleMods MadLittleMods commented Jul 23, 2021

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
@@ -337,7 +337,6 @@ func TestBackfillingHistory(t *testing.T) {
})

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
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

tests/msc2716_test.go Outdated Show resolved Hide resolved
@@ -569,10 +599,9 @@ func TestBackfillingHistory(t *testing.T) {
})

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
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
@@ -284,20 +290,53 @@ func TestBackfillingHistory(t *testing.T) {
})
})

t.Run("Batch send endpoint only returns state events that we passed in via state_events_at_start", func(t *testing.T) {
Copy link
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

// 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
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)

Copy link
Contributor Author

@MadLittleMods MadLittleMods Sep 8, 2021

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]

},
}
// 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
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?

Copy link
Contributor Author

@MadLittleMods MadLittleMods Sep 8, 2021

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

tests/msc2716_test.go Outdated Show resolved Hide resolved
tests/msc2716_test.go Outdated Show resolved Hide resolved
tests/msc2716_test.go Outdated Show resolved Hide resolved
Copy link
Member

@kegsay kegsay left a comment

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
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