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

matrix: Add room retention policy #2040

Merged
merged 30 commits into from
Jan 20, 2025
Merged

Conversation

backspace
Copy link
Contributor

@backspace backspace commented Jan 14, 2025

This adds a retention policy to auth rooms created by a realm Matrix user. It also backfills the policy to existing rooms, this can be deleted after it has run in production. I already ran it in staging, you can confirm that your user’s rooms have a policy with this script after having stored matrix-service in $E via Ember Inspector:

roomRows = [];
for (r of (await $E._client.getJoinedRooms()).joined_rooms) {
    roomRow = {roomId: r};
    roomRows.push(roomRow);

    roomRow.members = (Object.keys((await $E._client.getJoinedRoomMembers(r)).joined).join(', '));
    try {
      await $E._client.http.authedRequest('GET', `/rooms/${r}/state/m.room.retention`);
      roomRow.hasRetention = (true);
    } catch(e) {
      roomRow.hasRetention = (false);
    }
}

console.table(roomRows);

(This would only apply for users that existed when this branch was deployed.)

@backspace backspace added the enhancement New feature or request label Jan 14, 2025
@backspace backspace self-assigned this Jan 14, 2025
Copy link

github-actions bot commented Jan 14, 2025

Host Test Results

    1 files  ±0      1 suites  ±0   21m 41s ⏱️ +36s
729 tests ±0  727 ✔️ ±0  2 💤 ±0  0 ±0 
734 runs  ±0  732 ✔️ ±0  2 💤 ±0  0 ±0 

Results for commit 26c0aaa. ± Comparison against base commit fc4cc23.

♻️ This comment has been updated with latest results.

);

expect(retentionPolicy).toMatchObject({
max_lifetime: 60 * 60 * 1000,
Copy link
Contributor Author

@backspace backspace Jan 20, 2025

Choose a reason for hiding this comment

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

I don’t love having this duplicated vs importing the constant from runtime-common but if you look at the CI history you can see a type-checking can of worms 😞

Copy link
Contributor

Choose a reason for hiding this comment

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

I ran into the same challenge with matrix event name constants

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ugh… it’s really a shame, I just lack the understanding of how to get through the typechecking minefield

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe create an issue to review this with @ef4

@backspace backspace marked this pull request as ready for review January 20, 2025 16:55
@backspace backspace requested a review from a team January 20, 2025 16:56
);

expect(retentionPolicy).toMatchObject({
max_lifetime: 60 * 60 * 1000,
Copy link
Contributor

Choose a reason for hiding this comment

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

I ran into the same challenge with matrix event name constants

@backspace backspace merged commit a246bac into main Jan 20, 2025
43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants