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

[Task] Safe mode - config introspection #27

Closed
Gnuxie opened this issue Sep 13, 2024 · 1 comment
Closed

[Task] Safe mode - config introspection #27

Gnuxie opened this issue Sep 13, 2024 · 1 comment

Comments

@Gnuxie
Copy link
Member

Gnuxie commented Sep 13, 2024

Main story: #1

Acceptance criteria for this task:

  • 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.

Note, this has been fleshed out and covered by #29

The details below are no longer relevant

Details

The way this will work is we will have to identify each piece of config and build an editor for them.

The configs
  • org.matrix.mjolnir.watched_lists
  • org.matrix.mjolnir.protected_rooms
  • org.matrix.mjolnir.enabled_protections

Note, these configs may fail when they load, but are more likely to fail downstream when consumed by their respective managers e.g. ProtectedRoomsManager (in the case of protected rooms).

The editors need to be prepared to handle anything, including completely garbled or undeserializable JSON. And being able to use the client server API to reset them.

There should be no reason to use devtools. If for example there is a malformed room id in the list, it should be possible for the editor to revert down to parsing room references as strings and presenting them as items in a list, allowing the config to still be viewed and edited.

This may require a general JSON editor (operated by commands of course) that can use JSON paths. But maybe we can avoid that. It's probably possible for us to display each value alongside it's JSON path in a code block, so that it is easy for the user to copy paste. Equally, we could make that path a prompt reaction.

Is it possible for us to reuse the ProtectionSettings editors and schema here? But we'd also want to be able to recover protection settings when they become corrupted too.

Restarts

As a stretch, each piece of config could pre-empt where issues arrive and suggest a course of action. So for example, wathced lists could suggest unwatching the list that is causing issues and create a prompt to do that for the user.
Then once the prompt has done, we can prompt to restart and boot into draupnir.

The way that can work is by adding something like a restart to a ResultError which really would be a side effect that can be triggered. Actually doing the restarting part would have to be all manual i think? Yeah. We could even add more restarts like how elaborationswork, and then show a list of available restarts.

@Gnuxie
Copy link
Member Author

Gnuxie commented Oct 7, 2024

This ended up being covered by #29

@Gnuxie Gnuxie closed this as not planned Won't fix, can't repro, duplicate, stale Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

1 participant