Skip to content

Conversation

@sandhose
Copy link
Member

This reads the AS users from the Synapse database, doesn't import them, but keep them in memory, so that we can properly ignore threepids, external ids, devices and access tokens belonging to them.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Feb 27, 2025

Deploying matrix-authentication-service-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 1e99a6b
Status: ✅  Deploy successful!
Preview URL: https://921d1ba7.matrix-authentication-service-docs.pages.dev
Branch Preview URL: https://quenting-syn2mas-ignore-as-u.matrix-authentication-service-docs.pages.dev

View logs

@sandhose sandhose added A-Migration Related to the migration tooling T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks. labels Feb 27, 2025
@sandhose sandhose requested a review from reivilibre February 27, 2025 13:33
state.users.insert(
CompactString::new(&mas_user.username),
UserInfo {
mas_user_id: Uuid::nil(),
Copy link
Member Author

Choose a reason for hiding this comment

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

We could make this field an Option<NonNilUuid> (that would take the same space in memory) if we wanted to make sure that we never use a nil one?

Copy link
Contributor

Choose a reason for hiding this comment

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

I like this idea, even if it does mean you will probably need some unwraps or so, it feels more 'direct' to explicitly unwrap than potentially let some accident happen and find out later, probably in a harder to debug way.
That said, the current approach is defensible and not a big deal but avoiding sentinel values has been generally a pretty productive idea for me, so I prefer it as a maintenance safety improvement.

state.users.insert(
CompactString::new(&mas_user.username),
UserInfo {
mas_user_id: Uuid::nil(),
Copy link
Contributor

Choose a reason for hiding this comment

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

I like this idea, even if it does mean you will probably need some unwraps or so, it feels more 'direct' to explicitly unwrap than potentially let some accident happen and find out later, probably in a harder to debug way.
That said, the current approach is defensible and not a big deal but avoiding sentinel values has been generally a pretty productive idea for me, so I prefer it as a maintenance safety improvement.

@sandhose
Copy link
Member Author

sandhose commented Mar 4, 2025

@reivilibre I did the thing of using NonNilUuids for MAS user IDs in 1e99a6b. wdyt? Should I extend that to all MAS ULIDs?

@sandhose sandhose merged commit 7d060f5 into main Mar 4, 2025
21 checks passed
@sandhose sandhose deleted the quenting/syn2mas/ignore-as-users branch March 4, 2025 11:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Migration Related to the migration tooling T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants