-
Notifications
You must be signed in to change notification settings - Fork 390
Fix users being set to PL0 when downgrading v12 rooms #18818
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
base: develop
Are you sure you want to change the base?
Conversation
The second attempt to send a power levels event was not MSC4289-aware - it would drop the request back down to PL0 when copying the old room's power levels a second time. The second attempt to send power levels didn't appear to do anything useful anyways. So simply removing it fixes both the bug, and saves a state event. Fixes #18810
If you take the minimum PL needed to send powerlevel events, wouldnt that create a case where if i have a room like this: and then "upgrade" it to < 12, i end up with Alice havin PL 3000 while I, the former "creator" end up with PL 200, which seems wrong to me overall wouldnt it be safer to just use the max powerlevel here, since that best reflects the previous powerlevel structure from the V12 room? |
Due to that creators have infinite power in v12 it would be safest to set them to PL 2^53-1 and if there happens to be a user at that PL put them at 2^53-2 and increment all the events at that PL down to the same value. That way you effectively get as close as is realistic to the behavior of the v12 room. Since v12 rooms always have access to the full powerlevel spectrum this assumption is essentially the only way to make this fail safe and not eligible for screwing up somehow. |
@ll-SKY-ll @FSG-Cat you're both spot on, see matrix-org/complement#794 (comment). |
Setting to draft status while the exact power level is worked out. |
portdb failures are unrelated to this PR. |
Two things are happening in this PR:
Room creators of v12 rooms were being set to PL0 upon downgrading their room from v12 -> anything lower (Tombstoning a V12 room to any room version < 12 can lead to loss of powerlevel #18810)
additional_creators
listed in the old v12 room were not included in the power levels of the upgraded room, effectively dropping them to PL0 on upgrade. I noticed this while writing Complement tests for this PR.additional_creators
in the upgraded room.Associated Complement tests: matrix-org/complement#794
Note that MSC4289 does not actually state what a user's power level should be when downgrading a room. I've taken the liberty of making this "the minimum power level needed to send
m.room.power_levels
events. But note that this is currently not covered by the spec. It really shouldn't be 0 though, as that makes the room unmoderatable.Fixes #18810
Recommended to review commit-by-commit.
Pull Request Checklist
EventStore
toEventWorkerStore
.".code blocks
.