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

[Story] Safe Mode #1

Closed
Gnuxie opened this issue Jan 30, 2024 · 3 comments
Closed

[Story] Safe Mode #1

Gnuxie opened this issue Jan 30, 2024 · 3 comments

Comments

@Gnuxie
Copy link
Member

Gnuxie commented Jan 30, 2024

Description

A Draupnir moderator's Mjolnir fails to start due to a configuration issue. For example, sometimes it's not possible for the homeserver to find the room associated with a room reference in org.matrix.mjonir.watched_lists and we have previously had to encourage them to manually login as the Mjolnir user, open devtools, and remove the reference from the event manually. This is obviously not something that is at all possible in draupnir4all or for a non technical user. Instead, Draupnir starts in a limited safe mode, and no protections are given any capabilities for consequences. The moderator is well aware that Draupnir is in safe mode and is notified about the source of the problem (e.g. watched lists config) even if an exact diagnosis cannot be given. The user should be able to use commands to edit the configuration in account data or room state without opening up devtools. After the configuration has been edited, the user should be able to restart the bot into the normal mode of operation by issuing a command.

Acceptance Criteria

  • It is obvious to the moderator that Draupnir is in safe mode, even if days have passed since the failure happened and there is lots of scrollback to reach that point
  • It is obvious which part of the config needs attention and what steps to take to remedy it (e.g. using rooms remove or rooms add). Even if the exact reason for the config's failure to load is not diagnosable.
  • It is possible to introspect on the config. That isn't to say the exact JSON needs to be presented, that could be too technical.
  • It is ovbious how to attempt to restart Draupnir normally in any notification relating to Draupnir being in safe mode

Issues

Tasks

Dependencies

Total Pain

54

@Gnuxie
Copy link
Member Author

Gnuxie commented May 17, 2024

This needs breaking up some more. We need to describe precisely how we will unify config in one model that requires a description object that describes with a JSON path where the value came from (as in the specific file, or MPS interface implementation, or a default).

After this is done, the implication is that the old config/production.yaml will be parsed using JSONSchema before we pick off and feed the unified config model.

@Gnuxie
Copy link
Member Author

Gnuxie commented May 17, 2024

It should be noted that until we have #6 we will just have to disable all protections outright in safe mode.

@Gnuxie
Copy link
Member Author

Gnuxie commented Oct 9, 2024

Feedback:

@Gnuxie Gnuxie closed this as completed Nov 4, 2024
@github-project-automation github-project-automation bot moved this from In progress to Done in Draupnir planning Nov 4, 2024
Gnuxie added a commit to Gnuxie/matrix-protection-suite that referenced this issue Nov 26, 2024
…n-settings

When we decided to go with the config recovery in the safe mode work the-draupnir-project/planning#1, we also decided we would unify the wrappers used for all persistent config to be based on a system that leveraged TypeBox to provide us with schema. So this PR replaces `ProtectionSettings` with the new `ConfigDescription` system. This branch was written and linked with the work to migrate draupnir's protection's to the new system too.    

This slightly longer because the types are not liberal enough in what they accept when they are describing interfaces. This is a general bitch throughout the code base and I don't really know how to address it yet.

Basically we need to allow interfaces for things like the methods on the `ConfigMirror` to accept arguments liberally. But the implementation needs to be as defensive as `unknown` etc. It's my fault for not really understanding variance properly.

There was also an issue where the command reader from Draupnir's interface-manager produced objects that are different to the transform types in the `ConfigDescription` schema. So we had to update the `ConfigMirror` to accept serialized representations of values as a workaround. Not a big deal but it's a thing.  

Aside from that I've been at a low point these past weeks.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Status: Done
Development

No branches or pull requests

1 participant