Draupnir icon indicating copy to clipboard operation
Draupnir copied to clipboard

Draupnir not reading the "org.matrix.mjolnir.enabled_protections" at startup (schema migration failure)

Open ll-SKY-ll opened this issue 1 year ago • 3 comments

When Draupnir starts, it doesnt read the enabled protections from account data, seemingly falling back to the default of enabled/disabled protections. Using the !draupnir protections disable/enable command correctly sets the account data and enables/disables the protections at runtime, though after a restart it again falls back to the defaults, regardless whats in the account data.

Version: v2.0.0-beta.6-1-gd0e3cbe

ll-SKY-ll avatar Sep 15 '24 08:09 ll-SKY-ll

I just built from v2.0.0-beta.0 and the list of disabled/enabled protections also dont persist there, so if it was working before, i guess it got lost somewhere in the switch from 1.xxx to 2.xxx though i can see in the reverseproxy logs, that the account_data/org.matrix.mjolnir.enabled_protections is requested and answered with status code 200, so i guess its not a bot <--> homeserver-connection problem :)

Gnuxie avatar Sep 16 '24 09:09 Gnuxie

after further debugging attempts it looks lik just disabling protections which are enabled by default are broken, enabling other protections persist after restarts

so for example !draupnir protections disable PolicyChangeNotification doesnt survive a restart but !draupnir protections enable MentionLimitProtection does

so the error is not that account data isnt read, but rather that it looks like the account data isnt overriding the default enabled protections

ll-SKY-ll avatar Sep 16 '24 12:09 ll-SKY-ll

Ok the problem is that for some reason I allowed the schema to control the version number in SchemedDataManager, but then when you write to account data, we use the number of schema as the version number. So naturally they became inconsistent. I need to patch MPS to pass the starting version to SchemedDataManager and not allow the schema to control the version number.

Gnuxie avatar Sep 20 '24 15:09 Gnuxie

@ll-SKY-ll having problems reproducing this for some reason, the most recent protection to join the defaults is JoinRoomsOnInviteProtection but i can't get it to silently renable. Could you try again?

Gnuxie avatar Jan 08 '25 12:01 Gnuxie

Ok it is still an issue, and it's with all of the default protections apparently. https://matrix.to/#/%21IaWNErZAgQUhGqJXjX%3Amatrix.org/%24V0LWZ4tnrTHd_5l2Sj0JwVjl60E76fDJSRhqkl9iXXk?via=matrix.org&via=envs.net&via=tchncs.de. Will need to investigate later

Gnuxie avatar Jan 08 '25 19:01 Gnuxie

So we have confirmation that the schema version number is missing from the account data when this bug has been reported ..... .

Gnuxie avatar Jan 09 '25 19:01 Gnuxie