The validator judges if-config, config-lines, config-json and a process's bus on requires; grants follow (issue 1979) #211

Merged
mesh-tools merged 6 commits from feature/1979-zfs-owns-zfs into main 2026-11-13 08:00:36 +00:00
2 changed files with 8 additions and 7 deletions
Showing only changes of commit e1db8701b5 - Show all commits
+3 -5
View File
@@ -724,13 +724,11 @@ func ConfigProblems(m catalogue.Manifest) []string {
if strings.TrimSpace(d.Description) == "" {
say("no description: say in a sentence what the value is, including its unit (novox/hq ADR 0348 §4)")
}
switch {
case d.Required && d.Default != nil:
// A value with neither a default nor `required` is not managed until it is set (design 42 zfs-owns-zfs §11,
// answer A-14).
if d.Required && d.Default != nil {
say("both a default and required: a required value is the operator's own and has no default; give " +
"one or the other (novox/hq ADR 0348 §4)")
case !d.Required && d.Default == nil:
say("neither a default nor required: give a default, or say \"required\": true for a value that is " +
"the operator's own (novox/hq ADR 0348 §4)")
}
if as := renamed[key]; as != "" && d.Required {
say("is laid into its file as %q, and only when it is set, so the file and its code fall back when "+
@@ -3497,11 +3497,14 @@ func caseConfigRefusesAValueNeitherPlacedNorReadAtRuntime(t *testing.T) {
}
}
// Rule 2: a value with neither a default nor required.
// Rule 2: a value with both a default and required is refused; one with neither is not managed until set (design 42
// zfs-owns-zfs §11, V4/AC1, answer A-14).
func caseConfigRefusesAValueWithNeitherDefaultNorRequired(t *testing.T) {
m := inConfigForm()
delete(declaration(m, "width"), "default")
refused(t, m, `"width"`, "neither a default nor required")
if _, err := parseRaw(t, m); err != nil {
t.Fatal(err)
}
m = inConfigForm()
declaration(m, "sender")["default"] = "noreply@example.org"
refused(t, m, `"sender"`, "both a default and required")