the-draupnir-project / Draupnir

A Matrix moderation bot
https://the-draupnir-project.github.io/draupnir-documentation/
91 stars 14 forks source link

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

Open ll-SKY-ll opened 1 month ago

ll-SKY-ll commented 1 month ago

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

Gnuxie commented 1 month ago

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 :)

ll-SKY-ll commented 1 month ago

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

Gnuxie commented 1 month ago

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.