Read stored manifests leniently and mark the defaults layer (hq ADR 0262 review)
A strict read of the stored catalogue fails every plan and send once a manifest uses a field an older controller lacks; registration stays strict. A node named default lost its layer to the name check. Judge the operator's keys by whole words, and scan a default under any key.
This commit is contained in:
@@ -559,7 +559,7 @@ func describeEffective(module, where string, values []catalogue.SettingSource) s
|
||||
for _, v := range values {
|
||||
value, _ := json.Marshal(v.Value)
|
||||
fmt.Fprintf(&b, " %s = %s (%s", v.Key, value, v.From)
|
||||
if v.HasDefault && v.From != catalogue.DefaultLayer {
|
||||
if v.HasDefault && !v.FromDefault {
|
||||
d, _ := json.Marshal(v.Default)
|
||||
fmt.Fprintf(&b, "; the default is %s", d)
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
func TestSettingsSayWhereEachValueComesFrom(t *testing.T) {
|
||||
got := describeEffective("dunst", "laptop", []catalogue.SettingSource{
|
||||
{Key: "font-size", Value: float64(13), From: "laptop", Default: float64(10), HasDefault: true},
|
||||
{Key: "width", Value: float64(250), From: catalogue.DefaultLayer, Default: float64(250), HasDefault: true},
|
||||
{Key: "width", Value: float64(250), From: catalogue.DefaultLayer, FromDefault: true, Default: float64(250), HasDefault: true},
|
||||
})
|
||||
want := "dunst on laptop, every value and where it comes from:\n" +
|
||||
" font-size = 13 (laptop; the default is 10)\n" +
|
||||
|
||||
Reference in New Issue
Block a user