Skip to content

Conversation

@jason-famedly
Copy link
Collaborator

@jason-famedly jason-famedly commented Sep 25, 2025

MSC3911 Testing for Complement

For: https://github.com/famedly/product-management/issues/3367

Testing(both local and federated):

  • 4 room history visibility variants with image messages restricted
  • 4 room history visibility variants with membership avatar's restricted
  • room creation membership event is a proper copy of the global profile avatar
  • media copy api endpoint
  • Figure out a way to skip these tests if the client versions show it's not available

Adjusted existing test:

  • TestAvatarUrlUpdate - This test was using a url string for the mxc that was against the spec. This is now fixed

Depends on #4

@jason-famedly jason-famedly marked this pull request as ready for review September 29, 2025 17:22
@jason-famedly jason-famedly changed the base branch from main to jason/remove-signoff October 27, 2025 11:22
@itsoyou
Copy link

itsoyou commented Oct 27, 2025

Do we need to add msc3911 package to packages: ./tests/msc3874 ./tests/msc3902 ./tests/msc4306 in the ci.yaml file?

@jason-famedly
Copy link
Collaborator Author

Do we need to add msc3911 package to packages: ./tests/msc3874 ./tests/msc3902 ./tests/msc4306 in the ci.yaml file?

No, I don't think so. Those packages were chosen to represent a bare minimum of support. This particular test run just makes sure we haven't broken anything for the internals of Complement itself if/when we change something.

The actual line up of tests is decided on that repo/platform that runs it in it's own CI(like I added in famedly/synapse#139)

Base automatically changed from jason/remove-signoff to main October 27, 2025 11:48
client/client.go Outdated

// UncheckedDownloadContentAuthenticated makes the raw request for a piece of media and returns the http.Response.
// Response is unchecked in any way. The existing DownloadContentAuthenticated() should have been a "Must" variant. Rather
// than refactor that across the code base, this version just uses an explict name
Copy link

Choose a reason for hiding this comment

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

a little typo explict -> explicit


// MustSetDisplayName sets the global display name for this account or fails the test.
func (c *CSAPI) MustSetProfileAvatar(t ct.TestLike, mxcUri string) {
c.MustDo(t, "PUT", []string{"_matrix", "client", "v3", "profile", c.UserID, "avatar_url"}, WithJSONBody(t, map[string]any{
Copy link

Choose a reason for hiding this comment

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

would it be better to also add t.Helper() here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

🤔 Probably, nice catch

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think I missed it since the display setter just above did not have it. Looks like the display name "getter" below doesn't either. I wonder just how significant it really it. I think it's just to make the logging simpler in it's display and otherwise has no functional use. Oh well, putting it in anyways

// We will reuse that and copy it

// There seem to be no existing utilities to split an mxc uri into it's components, which is needed for the copy endpoint.
// Mxc uri's are formatted as "mxc://server_name/media_id"
Copy link

Choose a reason for hiding this comment

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

there is the func SplitMxc(mxcUri string) (string, string) in client.go, maybe we can reuse it

Copy link
Collaborator Author

@jason-famedly jason-famedly Oct 29, 2025

Choose a reason for hiding this comment

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

Nice catch, not sure how I missed that

if !bytes.Equal(aliceOriginalProfileBytes, aliceNewAvatarBytes) {
t.Fatalf("Media is differing and should be identical")
}

Copy link

Choose a reason for hiding this comment

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

should we add that the newMxcUri is not equal to the aliceGlobalProfileAvatarMxcUri?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added comparison test also, good idea.

@itsoyou
Copy link

itsoyou commented Oct 27, 2025

Looks good 👍 I didn't expected that the shared visibility is actually act like a world_readable. Would it make difference if the user is banned from a room?

@jason-famedly
Copy link
Collaborator Author

Looks good 👍

🎉

I didn't expected that the shared visibility is actually act like a world_readable.

It's not supposed to be. I believe it's actually a Synapse bug, and appears to be part of the "peeking" capability for seeing into a room in advance. I actually have the test scenario written up, thanks for reminding me about that.

Would it make difference if the user is banned from a room?

🤔 I don't know. It shouldn't, as there is a priority indexing structure that we use in Synapse that places bans below leaves. It should just work, but let me stare at this a while and see if I can produce a test for that.

@jason-famedly
Copy link
Collaborator Author

jason-famedly commented Oct 29, 2025

Looks good 👍

🎉

I didn't expected that the shared visibility is actually act like a world_readable.

It's not supposed to be. I believe it's actually a Synapse bug, and appears to be part of the "peeking" capability for seeing into a room in advance. I actually have the test scenario written up, thanks for reminding me about that.

Would it make difference if the user is banned from a room?

🤔 I don't know. It shouldn't, as there is a priority indexing structure that we use in Synapse that places bans below leaves. It should just work, but let me stare at this a while and see if I can produce a test for that.

So, to properly test this, would have to basically duplicate(or at least add to) each existing test. Do we want this? Just like with "bob", either is invited to or joins a room, just to get banned and then test ability to see the media. I want to say it comes across the same as a "leave", but am open to suggestion

EDIT: It also looks like it would end up depending on exactly when we ban the user(before or after the media is available). Because we check to see if they were ever able to actually see the media, if they ever could they should still be able to even after a ban

@itsoyou
Copy link

itsoyou commented Oct 31, 2025

EDIT: It also looks like it would end up depending on exactly when we ban the user(before or after the media is available). Because we check to see if they were ever able to actually see the media, if they ever could they should still be able to even after a ban

hmm. Banned user still able to see the media doesn't sound right. Should we maybe remove the copied media for banned user?

@jason-famedly
Copy link
Collaborator Author

hmm. Banned user still able to see the media doesn't sound right. Should we maybe remove the copied media for banned user?

I'm not sure. I don't think so. A ban is just a "forced" leave event on a room. I think they still have the right to see the past of when they were in there. Consider the case of a malicious ban from a room that was for not a legitimate reason. Would you like to be able to go back and collect that evidence to make an appeal?

Copy link

@itsoyou itsoyou left a comment

Choose a reason for hiding this comment

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

As I heard yesterday standup that according to the spec, banned user is still able to see the past events when the person was still in the room. All good 👍

Adjust TestAvatarUrlUpdate to make MXC's match the matrix spec
@jason-famedly jason-famedly merged commit ba7b6e5 into main Nov 6, 2025
3 of 4 checks passed
@jason-famedly jason-famedly deleted the msc3911 branch November 6, 2025 15:17
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.

3 participants