Judge every manifest against the list of predefined keys of its tree, and carry the list from a build
Mesh and node config may hold values only for keys on a fixed, reviewed list (hq ADR 0348 clause 7, design 57 package K2, issue 661). A build reads predefined.json at the root of the repository at the commit it builds and carries it with the commit's generation; module check and the merge gate read it from the tree. (Part 1 of 2: the changes to existing files.) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -61,18 +61,6 @@ const (
|
||||
// accountFacts are what the mesh places for a module's account, never config values (ADR 0348 §11).
|
||||
var accountFacts = map[string]bool{"puid": true, "pgid": true}
|
||||
|
||||
// PredefinedKey is one key of the catalogue's list of predefined keys, as far as a module's value falling back
|
||||
// to it is judged here: its type, and whether it is trusted (ADR 0348 §7, §8).
|
||||
type PredefinedKey struct {
|
||||
Type string
|
||||
Trusted bool
|
||||
}
|
||||
|
||||
// predefinedKeys is the list of predefined keys, nil until it is present. The list (`predefined.json` at the
|
||||
// catalogue's root) arrives with design 57's package K2 (issue 661); until then a value naming one is refused
|
||||
// saying the list is not yet present.
|
||||
var predefinedKeys map[string]PredefinedKey
|
||||
|
||||
// configForms is which of the two forms a manifest was written in, by the words of each it uses.
|
||||
type configForms struct {
|
||||
config, settings []string
|
||||
@@ -259,12 +247,13 @@ func ConfigProblems(m Manifest) []string {
|
||||
"(novox/hq ADR 0348 §4, ADR 0112)", word)
|
||||
}
|
||||
if d.Predefined != "" {
|
||||
p, listed := predefinedKeys[d.Predefined]
|
||||
p, listed := m.predefined[d.Predefined]
|
||||
switch {
|
||||
case predefinedKeys == nil:
|
||||
say("falls back to the predefined key %q, and the list of predefined keys (the catalogue's "+
|
||||
"predefined.json, design 57 package K2) is not yet present: no value can fall back to one "+
|
||||
"until it is; leave \"predefined\" out for now (novox/hq ADR 0348 §7)", d.Predefined)
|
||||
case m.predefined == nil:
|
||||
say("falls back to the predefined key %q, and the list of predefined keys (%s at the root of "+
|
||||
"the catalogue's repository) is not present where it is judged: a value falls back only to a "+
|
||||
"key on that list; judge it in the catalogue, or leave \"predefined\" out (novox/hq ADR 0348 §7)",
|
||||
d.Predefined, PredefinedFile)
|
||||
case !listed:
|
||||
say("falls back to %q, which is not on the list of predefined keys: name a key on it, or leave "+
|
||||
"\"predefined\" out (novox/hq ADR 0348 §7)", d.Predefined)
|
||||
|
||||
Reference in New Issue
Block a user