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

Replace old protection settings with the new persistent config description abstraction #66

Merged
merged 9 commits into from
Nov 26, 2024

Conversation

Gnuxie
Copy link
Owner

@Gnuxie Gnuxie commented Nov 4, 2024

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.

the-draupnir-project/planning#35

We want to be able to fake the entire protections manager without
using a different class just by providing mock backends to all
of the dependancies that do IO.

We're now stuck and hesitating because we need to change the way
we run intialization code in static methods ie the `create` methods.

So yeah I want to do something about that, hopefully in a way that
is not shit.
Problems:

1. Too many places are referencing TObject rather than `UnknownConfig`

2. The protection description uses the silly `registerProtection`
utility rather than values directly that will aid type inference.

3. A lot of method signatures that accept a protection description are
   just wrong and don't make the protection description type generic,
   where we can do things like infer the type for capability set
   or the protection config.
@Gnuxie Gnuxie force-pushed the gnuxie/persistent-config-protection-settings branch from c51ebaf to 38fe4b8 Compare November 7, 2024 16:49
It really wasn't doing us any good when we had to use the mirror
with an UnknownConfig.
Before it was asking for the entire PersistentConfigData adaptor which is kinda wrong
This helps when we can't change from one representation to another.
E.g. Draupnir's command reader presentation types might be
different to the JSON Transform decoder output type.

So serializing allows them to be compatible. It kinda sucks but
whatever.
@Gnuxie Gnuxie merged commit c913c5c into main Nov 26, 2024
3 checks passed
Gnuxie added a commit that referenced this pull request Dec 9, 2024
I don't know why we were half asleep in
#66.  But set
serialized value in this PR needs to be deleted.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant