WIP: Configuration subproblem #38

Draft
toonn wants to merge 16 commits from toonn/meta:configuration into main
Member

Description of the configuration subproblem incorporating a first round of review.

Description of the configuration subproblem incorporating a first round of review.
Switch to shorthand Host to avoid the more overloaded term Provider.

Co-authored-by: Kiara Grouwstra <kiara@procolix.eu>
In the real world it is likely that both Application versions and
Fediversity versions differ between Hosting Providers. A combined test
would simulate this as closely as possible.

Co-authored-by: Sara Ortiz Bonet <toast003@tutamail.com>
@ -0,0 +13,4 @@
## [Hosting Providers can update configuration][159]
Hosting Providers (Hosts for short) provide part of the Application
Author
Member

Should we avoid shorthand altogether? The various terms are admittedly already potentially confusing (Does an Operator operate hardware?), User is not the same thing as "Fediversity user," which appears in issues on the fediversity repo and means Hosting Provider.

Should we avoid shorthand altogether? The various terms are admittedly already potentially confusing (Does an Operator operate hardware?), User is not the same thing as "Fediversity user," which appears in issues on the fediversity repo and means Hosting Provider.
Owner

let's avoid them yes.
the term 'user' we haven't really defined tho i informally used them (which is bad) to refer to operators mostly.
to be fair tho, i think even our architecture document has used conflicting senses of 'maintainer', for one.

let's avoid them yes. the term 'user' we haven't really defined tho i informally used them (which is bad) to refer to operators mostly. to be fair tho, i think even our architecture document has used conflicting senses of 'maintainer', for one.
Author
Member

User is defined in the Actors section of the README.

"Fediversity user" is used in many user story issues, an example is fediversity/fediversity#158, where it means Hosting Provider, not Operator.

"Fediversity maintainer" also occurs and refers to developers of the Fediversity code where I've seen it, fediversity/fediversity#626 for example.

I'll remove the use of shorthand and switch it to "Hosting Provider" everywhere. For an architecture document that is fine but it is quite cumbersome in discussions TBH.

Should we move the Actors and Glossary sections of the Fediversity README to a glossary document in this repository? It could be a good place to mention older terminology like "Fediversity user/maintainer," which isn't a great fit for the main README. And also be a clear place to suggest future changes to terminology including shorthand.

User is defined in the [Actors section of the README](https://git.fediversity.eu/fediversity/fediversity/src/branch/main/README.md#actors). "Fediversity user" is used in many user story issues, an example is fediversity/fediversity#158, where it means Hosting Provider, not Operator. "Fediversity maintainer" also occurs and refers to developers of the Fediversity code where I've seen it, fediversity/fediversity#626 for example. I'll remove the use of shorthand and switch it to "Hosting Provider" everywhere. For an architecture document that is fine but it is quite cumbersome in discussions TBH. Should we move the Actors and Glossary sections of the Fediversity README to a glossary document in this repository? It could be a good place to mention older terminology like "Fediversity user/maintainer," which isn't a great fit for the main README. And also be a clear place to suggest future changes to terminology including shorthand.
Owner

these sound good - thanks!

these sound good - thanks!
Author
Member

The architecture document also includes Actors and Glossary sections. Is either one of these locations more recent/authoritative?

The [architecture document](https://git.fediversity.eu/fediversity/meta/src/branch/main/architecture-docs/architecture.md) also includes Actors and Glossary sections. Is either one of these locations more recent/authoritative?
Owner

the architecture document came later, and i guess i agree the repo readme isn't really the right place. i imagine they may not have diverged too much but the readme may be more outdated.

the architecture document came later, and i guess i agree the repo readme isn't really the right place. i imagine they may not have diverged too much but the readme may be more outdated.
toonn marked this conversation as resolved
@ -0,0 +33,4 @@
setting it is possible for a new version of Mastodon to drop support. Mastodon
could handle this multiple ways:
- Ignore the presence of the environment variable. The configuration would
Owner

continuing from fediversity/fediversity#846 (comment):

Silently drop the setting as it has been removed from the schema would be the scenario of the first bullet.
Refusing to deploy and requiring interaction from the Operator would be like the second bullet point.

this maybe raises the question: drop from what? as in, on the one hand perhaps drop it from the conf file used in deployment (e.g. some like mastodon.toml or whatever depending on the application), vs from the stored operator configuration.
dropping it from the conf file used in deployment could end up more flexible in terms of potentially facilitating downgrading operator configuration across fediversity versions (if downgrades are even facilitated by the application itself given application state?).

now, if such a route were to offer more functionality, one option could be to choose that as a later extension, while settling on whatever seems easier in the shorter term.

requiring interaction from the Operator

given the potentially subjective choices involved, updating without operator involvement might just not be viable.

continuing from https://git.fediversity.eu/fediversity/fediversity/pulls/846#issuecomment-12541: > Silently drop the setting as it has been removed from the schema would be the scenario of the first bullet. > Refusing to deploy and requiring interaction from the Operator would be like the second bullet point. this maybe raises the question: drop from what? as in, on the one hand perhaps drop it from the conf file used in deployment (e.g. some like `mastodon.toml` or whatever depending on the application), vs from the stored operator configuration. dropping it from the conf file used in deployment could end up more flexible in terms of potentially facilitating downgrading operator configuration across fediversity versions (if downgrades are even facilitated by the application itself given application state?). now, if such a route were to offer more functionality, one option could be to choose that as a later extension, while settling on whatever seems easier in the shorter term. > requiring interaction from the Operator given the potentially subjective choices involved, updating without operator involvement might just not be viable.
Author
Member

this maybe raises the question: drop from what? as in, on the one hand perhaps drop it from the conf file used in deployment (e.g. some like mastodon.toml or whatever depending on the application), vs from the stored operator configuration.

This should definitely go in the solution section/document. I do think the latter is easier and also a bit more declarative maybe. With the flexible approach a single Operator configuration could lead to different deployed configurations losing that declarativeness (Operator configuration and deployment configuration generator together are still declarative but the Operator only sees the former.)

given the potentially subjective choices involved, updating without operator involvement might just not be viable.

Indeed, though it's easy to imagine a painless update for a small patch to an Application.

> this maybe raises the question: drop from what? as in, on the one hand perhaps drop it from the conf file used in deployment (e.g. some like `mastodon.toml` or whatever depending on the application), vs from the stored operator configuration. This should definitely go in the solution section/document. I do think the latter is easier and also a bit more declarative maybe. With the flexible approach a single Operator configuration could lead to different deployed configurations losing that declarativeness (Operator configuration and deployment configuration generator together are still declarative but the Operator only sees the former.) > given the potentially subjective choices involved, updating without operator involvement might just not be viable. Indeed, though it's easy to imagine a painless update for a small patch to an Application.
@ -0,0 +73,4 @@
implicitly do through choice of Host, maybe explicit (limited) control is
desireable. Might serve as a way for Hosts to get incremental roll outs. More
adventurous Operators are allowed to update beyond the current standard
deployment versions with the understanding that is a risk they choose to take.
Owner

continuing from fediversity/fediversity#846 (comment):

separating the versions seems conceivable, sure, and i agree this could server to further empower particularly power users, perhaps.
maybe again tho i'd advocate trying to handle our enhancements in order, so as to perhaps try and keep in mind what might do for an 'MVP', rather than making things more complicated than we'd need them to be already.

continuing from https://git.fediversity.eu/fediversity/fediversity/pulls/846#issuecomment-12542: separating the versions seems conceivable, sure, and i agree this could server to further empower particularly power users, perhaps. maybe again tho i'd advocate trying to handle our enhancements in order, so as to perhaps try and keep in mind what might do for an 'MVP', rather than making things more complicated than we'd need them to be already.
toonn marked this conversation as resolved
To maximize clarity we will avoid the use of shorthand terminology.
toonn force-pushed configuration from dd571f0a6f to fa0b613356 2026-04-27 20:47:21 +02:00 Compare
Move the configuration subproblem description into a subdirectory to
allow for more related files without cluttering the parent.

Since the goal of Clan's lib/jsonschema is similar to ours of generating
JSON schemas for NixOS modules it warrants a look.  The header of
`clan-lib-jsonschema.nix` is a long comment that explains the
evaluation. After building the derivation, the files
`input-output-comparison.json` and `typePrefix-and-readOnly.json` are
most interesting and motivate why jsonschema is not fit for our purpose.
@ -0,0 +108,4 @@
Applications offer configuration options. Some of these options are relevant to
Hosting Providers, others to Operators, overlap is not impossible. Sticking
with Mastodon as an example.
Owner

note that our data model now does handle reconciling configurations of hosting providers and of operators at the level of a resource, which can encode any business logic needed to do this for the modeled domain.

note that our data model now does handle reconciling configurations of hosting providers and of operators at the level of a resource, which can encode any business logic needed to do this for the modeled domain.
Author
Member

Is this Application-specific business logic that Fediversity needs to maintain?

General policies of the form "Operators get the final say on configuration," or "Hosting Providers override Operators because the latter are expected to be non-technical," are possible and general enough that it would not be a maintenance burden.

However, it's easy to imagine more specific behavior, a domain deny-list would be a good candidate for merging rather than either party's setting to override the other, the Hosting Provider detects a spammer on some of its hosted instances and adds their domain to all hosted instances, an Operator notices abuse targeted to their instance and blocks the domain, ideally both settings are merged so all the abusers are blocked rather than having an Operator be powerless to deal with targeted abuse or the Hosting Provider to be powerless to deal with widespread, subtler attacks. Conversely a domain allow-list is sensitive, merging leads to more exposure rather than less (especially if wildcards are a thing and an Operator sets a broad default rather than leave the setting empty).

Deciding a solid policy for every option requires Application-specific information. If this is the responsibility of Fediversity we get back to a similar issue as with Fediversity-maintained schemas for upstream Applications.

Is this Application-specific business logic that Fediversity needs to maintain? General policies of the form "Operators get the final say on configuration," or "Hosting Providers override Operators because the latter are expected to be non-technical," are possible and general enough that it would not be a maintenance burden. However, it's easy to imagine more specific behavior, a domain deny-list would be a good candidate for merging rather than either party's setting to override the other, the Hosting Provider detects a spammer on some of its hosted instances and adds their domain to all hosted instances, an Operator notices abuse targeted to their instance and blocks the domain, ideally both settings are merged so all the abusers are blocked rather than having an Operator be powerless to deal with targeted abuse or the Hosting Provider to be powerless to deal with widespread, subtler attacks. Conversely a domain allow-list is sensitive, merging leads to more exposure rather than less (especially if wildcards are a thing and an Operator sets a broad default rather than leave the setting empty). Deciding a solid policy for every option requires Application-specific information. If this is the responsibility of Fediversity we get back to a similar issue as with Fediversity-maintained schemas for upstream Applications.
@ -0,0 +119,4 @@
A Hosting Provider is in a good position to spot waves of spam registrations
and to respond by enabling hCaptcha on all its Mastodon deployments or add
specific abuser domains to the `EMAIL_DOMAIN_DENYLIST`, this is a hypothetical
case of overlap.
Owner

custom interface surfaces like this raise questions on our migration story (#100) but yeah

custom interface surfaces like this raise questions on our migration story (#100) but yeah
Owner

unless our layer is unaffected for such purposes, but it feels like such decoupling maybe makes things more complicated still for now (not sure we got elegant solutions there that don't like mostly raise further questions)

unless our layer is unaffected for such purposes, but it feels like such decoupling maybe makes things more complicated still for now (not sure we got elegant solutions there that don't like mostly raise further questions)
@ -0,0 +139,4 @@
If upstreams do not want to maintain such a schema, either the Fediversity team
needs to maintain one or provide a way for Hosting Providers to bring their own
(With a shared repository for other Hosting Providers to benefit from, a
Fediversity wiki?). Upstreams would be expected to provide a schema with each
Owner

tbh for the purpose of migrations between hosting providers i think the common incentive would seem to be to handle things thru a central repo rather than some wiki (fragmentation)

tbh for the purpose of migrations between hosting providers i think the common incentive would seem to be to handle things thru a central repo rather than some wiki (fragmentation)
Author
Member

When I say wiki I really mean "communally managed resource without a promise of thorough validation," but that's a mouthful. A repository clearly labeled as such falls under my use of "wiki," it is harder to make it clear that such a repo is open to contributions from anyone without a burdensome review process but it can be done, e.g., the AUR or the nix-community org.

FWIW a repository doesn't solve fragmentation, different revisions will be in use due to inertia.

When I say wiki I really mean "communally managed resource without a promise of thorough validation," but that's a mouthful. A repository clearly labeled as such falls under my use of "wiki," it is harder to make it clear that such a repo is open to contributions from anyone without a burdensome review process but it can be done, e.g., the AUR or the nix-community org. FWIW a repository doesn't solve fragmentation, different revisions will be in use due to inertia.
toonn marked this conversation as resolved
@ -0,0 +172,4 @@
What and how can we test?
- JSON schema generation:
- Against a known-good module/schema pair (Characterization/Golden test).
Owner

not sure such canonical pairs will exist in the wild particularly given the domain discrepancy (e.g. nix modules suggesting you to configure the package used)

not sure such canonical pairs will exist in the wild particularly given the domain discrepancy (e.g. nix modules suggesting you to configure the `package` used)
Author
Member

A fixed revision of a sufficiently complicated module is what I had in mind here.

A fixed revision of a sufficiently complicated module is what I had in mind here.
toonn marked this conversation as resolved
@ -0,0 +4,4 @@
# The overall conclusion is that Clan's usecase of generating Python types is
# too different from ours.
#
# While we have not decided to provide Conduit yet, a Matrix server is a good
Owner

fyi i think procolix promised the EC a matrix server and investigated configuring synapse, tho not sure what the status of that is since the changes in project governance.
since the start of the project i think the state of matrix implementations and their forks has kept progressing - off the top of my head the most recent decent implementation seems continuwuity.
NLNet has internally been using XMPP.

fyi i think procolix promised the EC a matrix server and investigated [configuring synapse](https://git.fediversity.eu/fediversity/matrix-synapse-debian), tho not sure what the status of that is since the changes in project governance. since the start of the project i think the state of matrix implementations and their forks has [kept progressing](https://git.fediversity.eu/fediversity/apps-sheet) - off the top of my head the most recent decent implementation seems [continuwuity](https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/services/matrix/continuwuity.nix). NLNet has internally been using XMPP.
Author
Member

I'll rephrase to something like "While we do not plan to provide Conduit," (without yet), I didn't want to imply a value judgement in either the positive (current) or negative (do not plan sounds a bit like a decision already taken) sense here. Simply spotted a Matrix-related module while grepping Nixpkgs for a good example.

My understanding of the topic is that Synapse is the only "official" implementation, it is universally loathed because of its performance and resource use, but, the push for and optimism around Dendrite as its replacement seems to have decreased if not entirely disappeared, Conduit looked like the best (only) alternative for a while but spawned a problematic fork Conduwuit, which then spawned Continuwuity and Tuwunel, the latter seems to have its own baggage. That leaves Conduit and Continuwuity to evaluate next to Synapse.

I'll rephrase to something like "While we do not plan to provide Conduit," (without yet), I didn't want to imply a value judgement in either the positive (current) or negative (do not plan sounds a bit like a decision already taken) sense here. Simply spotted a Matrix-related module while grepping Nixpkgs for a good example. My understanding of the topic is that Synapse is the only "official" implementation, it is universally loathed because of its performance and resource use, but, the push for and optimism around Dendrite as its replacement seems to have decreased if not entirely disappeared, Conduit looked like the best (only) alternative for a while but spawned a problematic fork Conduwuit, which then spawned Continuwuity and Tuwunel, the latter seems to have its own baggage. That leaves Conduit and Continuwuity to evaluate next to Synapse.
toonn marked this conversation as resolved
@ -0,0 +18,4 @@
# `builtins.toJSON`. Technically this is a JSON schema that allows anything,
# since the subschemas in `$defs` are not referred to. Turning it into a
# schema that actually restricts values is not difficult, simply add
# `"$ref": "#/$defs/Input"` at the top level.
Owner

yeah that's kinda what i did at my poc for forms for configuring nix contracts' providers

yeah that's kinda what i did at my [poc for forms for configuring nix contracts' providers](https://gist.github.com/KiaraGrouwstra/93e819314c5902b7403530428dd74164#file-json-schema-json)
toonn marked this conversation as resolved
@ -0,0 +162,4 @@
`clan-lib-jsonschema.nix` has made us reconsider.
We will implement a JSON schema converter for NixOS modules on top of Nixpkgs'
`nixosOptionsDoc`. To begin with it'll only contain a schema for the NixOS
Owner

sounds good, i guess it sounds lower-level (doesn't seem it has a notion of JSON Schema), and maybe i managed to shoehorn two use-cases onto Clan's so far, but yeah having a tool made for more general use-cases (on top of cutting a clunky dependency) def seems an improvement.
references may be among JSON Schema's complex parts, tho not sure those are as bad in our direction here.

sounds good, i guess it sounds lower-level (doesn't seem it has a notion of JSON Schema), and maybe i managed to shoehorn two use-cases onto Clan's so far, but yeah having a tool made for more general use-cases (on top of cutting a clunky dependency) def seems an improvement. references may be among JSON Schema's complex parts, tho not sure those are as bad in our direction here.
Owner

btw this document has maybe been a bit abstract in its criticism of clan's thing, credibly arguing it offers abstraction layers not useful to us tho ostensibly it'd offer lower-level layers of abstraction as well. as such, maybe it'd be useful to give an example of the type of module its abstraction layers (starting with high) don't handle well and argue why they wouldn't?

btw this document has maybe been a bit abstract in its criticism of clan's thing, credibly arguing it offers abstraction layers not useful to us tho ostensibly it'd offer lower-level layers of abstraction as well. as such, maybe it'd be useful to give an example of the type of module its abstraction layers (starting with high) don't handle well and argue why they wouldn't?
Author
Member

Hmm, I thought using a derivation to demonstrate the shortcomings would be sufficiently concrete. The problem boils down to not having all the information that can be part of module options, default values (would be nice to display in a UI) and thereadOnly flag (options that are read-only should probably not allow modification or at least require a very explicit "I know what I'm doing," interaction) for instance.

The nixosOptionsDoc output also has a declarations property for every option, doesn't seem too useful right now but I think it might allow pointing out an option comes from an overlay rather than upstream Nixpkgs. (Would be nice if it came with line numbers so we could easily link to the option definition for technical users. Not important if the schema's only used for non-technical UIs.)

Hmm, I thought using a derivation to demonstrate the shortcomings would be sufficiently concrete. The problem boils down to not having all the information that can be part of module options, default values (would be nice to display in a UI) and the`readOnly` flag (options that are read-only should probably not allow modification or at least require a very explicit "I know what I'm doing," interaction) for instance. The `nixosOptionsDoc` output also has a `declarations` property for every option, doesn't seem too useful right now but I think it might allow pointing out an option comes from an overlay rather than upstream Nixpkgs. (Would be nice if it came with line numbers so we could easily link to the option definition for technical users. Not important if the schema's only used for non-technical UIs.)
Owner

default values

fwiw, i just got that one in for the contracts UI thing i tried there. readOnly i hadn't tried.

(Would be nice if it came with line numbers so we could easily link to the option definition for technical users. Not important if the schema's only used for non-technical UIs.)

fwiw options.foo.loc should also like give [ "options" "foo" ] for in as far as that might help (i dunno if that helps the clan case).

> default values fwiw, i just got [that one in](https://git.clan.lol/clan/clan-core/pulls/7397) for the contracts UI thing i tried there. `readOnly` i hadn't tried. > (Would be nice if it came with line numbers so we could easily link to the option definition for technical users. Not important if the schema's only used for non-technical UIs.) fwiw `options.foo.loc` should also like give `[ "options" "foo" ]` for in as far as that might help (i dunno if that helps the clan case).
toonn marked this conversation as resolved
toonn added this to the Dev project 2026-08-04 12:58:26 +02:00
@ -7,2 +7,2 @@
# While we have not decided to provide Conduit yet, a Matrix server is a good
# candidate for inclusion in Fediversity and its module has options with
# While we have not decided which Matrix homeserver to provide yet, Conduit is
# a good candidate for inclusion in Fediversity and its module has options with
Owner

so, procolix tried comparing these to set up our current instance at the time as well (synapse), and felt under the impression the older implementations seemed more mature in terms of functionality.
i'm not confident how much of that would be relevant for our purposes (still), while i think nix has also tended to make it easier to use rust/go over python (favoring... any of the 4+ implementations that aren't synapse).
those options should be included over at apps-sheet as well, if with limited info maybe.

so, procolix tried comparing these to set up our current instance at the time as well (synapse), and felt under the impression the older implementations seemed more mature in terms of functionality. i'm not confident how much of that would be relevant for our purposes (still), while i think nix has also tended to make it easier to use rust/go over python (favoring... any of the 4+ implementations that aren't synapse). those options should be included over at [`apps-sheet`](https://git.fediversity.eu/fediversity/apps-sheet) as well, if with limited info maybe.
Author
Member

OK, so this is just about motivating why I looked at its NixOS module at all. It holds no value judgement on what Matrix implementation Fediversity should include. I already reworded this once to make that clearer, suggestions welcome if it still isn't.

OK, so this is just about motivating why I looked at its NixOS module at all. It holds no value judgement on what Matrix implementation Fediversity should include. I already reworded this once to make that clearer, suggestions welcome if it still isn't.
Owner

it's fine, just wanted to provide the fyi in case it was useful

it's fine, just wanted to provide the fyi in case it was useful
kiara marked this conversation as resolved
toonn force-pushed configuration from c98dee72c9 to 82b5adc2de 2026-08-18 10:40:18 +02:00 Compare
toonn force-pushed configuration from 82b5adc2de to e9888f68f9 2026-08-18 19:38:37 +02:00 Compare
This pull request is marked as a work in progress.
This branch is out-of-date with the base branch
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u configuration:toonn-configuration
git switch toonn-configuration

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch main
git merge --no-ff toonn-configuration
git switch toonn-configuration
git rebase main
git switch main
git merge --ff-only toonn-configuration
git switch toonn-configuration
git rebase main
git switch main
git merge --no-ff toonn-configuration
git switch main
git merge --squash toonn-configuration
git switch main
git merge --ff-only toonn-configuration
git switch main
git merge toonn-configuration
git push origin main
Sign in to join this conversation.
No reviewers
No labels
WP2
WP3
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
fediversity/meta!38
No description provided.