design: service actions reference undeclared services — no base state for reconciliation #34
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
enable/disablein profiles validate the service name only by shape (Service.mkServiceName, src/DSL/Service.hs) — there is no check that aservicesection with that name exists. A config withdisable "docker"and zeroservicesections compiles silently. The action target (Service.ServiceName) and the section name (ServiceSectionName) are unrelated types, so nothing links them even structurally.This is more than a missing referential check. Conditional profiles have while-semantics: when the condition goes false (steam exits), the planner must reconcile the service back to its base state — and today the configuration does not define one.
disable "docker"in a conditional profile leaves the runtime with no answer to "what should docker be now?". The system drifts from the configuration and stays there.Proposal
Make the
servicesection a declaration: "this service is managed by the configuration, here is its base state".Validate.hs: every service targeted byenable/disable(in any profile) must have a correspondingservicesection. Undeclared target →ValidationError. NixOS-style: not declared — not managed.servicesection, e.g. abaseState Enabledfield — the state the reconciler returns the service to when no conditional profile is active. Explicit field rather than reusingenable/disableinside the section: "desired under condition" and "base" are different roles and should not share constructors.Notes
enable/disable= priority 100,interConflictin Validate.hs): base state is what applies when no profile acts on the service, so it needs no priority.