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

Test that invites from ignored users are omitted from incremental syncs #267

Merged
merged 14 commits into from Dec 9, 2021

Conversation

DMRobertson
Copy link
Contributor

@DMRobertson DMRobertson commented Dec 3, 2021

Reproduces matrix-org/synapse#11506.

Leaving this as a draft until I fix the issue in Synapse. Sticking up a PR for now to see what Dendrite does.

Also note: fd3a555 is cherry-picked from #237

@DMRobertson
Copy link
Contributor Author

Fails on Dendrite:

 PUT hs1/_matrix/client/v3/user/@alice:hs1/account_data/m.ignored_user_list => 404 Not Found (722.71µs)

Guessing this isn't implemented in Dendrite yet: if so, suggest blacklisting this test.

@ShadowJonathan
Copy link
Contributor

You can do that yourself by adding runtime.SkipIf(t, runtime.Dendrite) to the start of the test, fwiw

@DMRobertson
Copy link
Contributor Author

Guessing this isn't implemented in Dendrite yet: if so, suggest blacklisting this test.

matrix-org/dendrite#600

@DMRobertson DMRobertson marked this pull request as ready for review December 6, 2021 13:44
@DMRobertson DMRobertson changed the title Reproduce matrix-org/synapse#11506 Test that invites from ignored users are omitted from incremental syncs Dec 6, 2021
@DMRobertson DMRobertson requested a review from a team December 6, 2021 13:50
@DMRobertson
Copy link
Contributor Author

You can do that yourself by adding runtime.SkipIf(t, runtime.Dendrite) to the start of the test, fwiw

My understanding is that build constraints are the done thing here, as in 0b453d9

@ShadowJonathan
Copy link
Contributor

Maybe, but more recently, skipping specific tests were introduced, these are triggered on *_blacklist in the same way.

Comment on lines 23 to 25
// Synapse does not have this property, as detailed in
// https://github.com/matrix-org/synapse/issues/11506.
// This reproduces that bug.
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe?

Suggested change
// Synapse does not have this property, as detailed in
// https://github.com/matrix-org/synapse/issues/11506.
// This reproduces that bug.
// Synapse does not handle this properly, as detailed in
// https://github.com/matrix-org/synapse/issues/11506.
// This reproduces that bug.

I don't think this is true though since this is now fixed, it might be better to say:

This is a regression test for link to issue.

// https://github.com/matrix-org/synapse/issues/11506.
// This reproduces that bug.
func TestInviteFromIgnoredUsersDoesNotAppearInSync(t *testing.T) {
deployment := Deploy(t, b.BlueprintCleanHS)
Copy link
Contributor

Choose a reason for hiding this comment

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

This test could be much simpler, I think, by starting with BlueprintOneToOneRoom? I'm not sure the third user is very helpful here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The third user was an attempt to stop this test from being racey. We want to be convinced that the server has processed Bob's invite and chosen to ignore it. I could assert that there's no invite from Bob in Alice's next sync, but... what if that's only true because Alice synced really quickly?

In #237 (comment) suggested sending and awaiting a dummy event. The third user was my attempt at doing something similar here.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think you could do that by sending a dummy user into the room, yes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, would Alice expect to see state updates for a room she's invited to, but hasn't joined yet? If so that would be much clearer.

Copy link
Contributor

@clokep clokep Dec 7, 2021

Choose a reason for hiding this comment

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

Oh, would Alice expect to see state updates for a room she's invited to, but hasn't joined yet? If so that would be much clearer.

No, they would not see those. I think I'm confused though -- isn't this just checking that some sort of events got processed by any room? (I.e. sync is working at all?)

@clokep clokep requested a review from kegsay December 7, 2021 16:19
@clokep
Copy link
Contributor

clokep commented Dec 7, 2021

I requested review from @kegsay since I believe he has thoughts about the generic infrastructure of complement.

@kegsay kegsay mentioned this pull request Dec 9, 2021
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.

For now, this is fine and I'm happy for it to be merged.

For later, this is not fine. I've filed #271 and will retrospectively fix up this PR to use the new API when it lands.

chris := deployment.RegisterUser(t, "hs1", "chris", "sufficiently_long_password_chris")

// Alice creates a room for herself.
public_room := alice.CreateRoom(t, map[string]interface{}{
Copy link
Member

Choose a reason for hiding this comment

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

Please do not use underscores for variable names.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, old habits. Is there some way to configure gofmt/goimports or VSCode to flag this up?

alice.MustDoFunc(
t,
"PUT",
[]string{"_matrix", "client", "v3", "user", alice.UserID, "account_data", "m.ignored_user_list"},
Copy link
Member

Choose a reason for hiding this comment

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

Dendrite doesn't implement any /v3/ endpoint. Is there some spec documentation on the changes between r0 and v3?

Copy link
Contributor

Choose a reason for hiding this comment

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

Dendrite doesn't implement any /v3/ endpoint. Is there some spec documentation on the changes between r0 and v3?

All r0 endpoints became v3 with Matrix 1.1 -- @DMRobertson Maybe we should just use r0 for now here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Happy to use r0; I was just blindly going by what the latest spec said.

David Robertson added 3 commits December 9, 2021 14:35
@DMRobertson
Copy link
Contributor Author

Using r0 means that we PUT the account data, but the ignored invite isn't still ignored. I'd forgotten that matrix-org/dendrite#600 was a thing.

@DMRobertson DMRobertson merged commit e7f6921 into master Dec 9, 2021
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.

None yet

4 participants