The indexer and the builder hold no list, so claude-code, dunst and xterm were refused; ParseManifestForInputs takes each fallback as its value declares it and judges no config value, refusing everything else ParseManifest refuses.
42 lines
1.7 KiB
Go
42 lines
1.7 KiB
Go
package catalogue
|
|
|
|
import "encoding/json"
|
|
|
|
// ParseManifestForInputs reads a manifest for the inputs of its build and its fingerprint: the indexer's and the
|
|
// builder's read (novox/hq issue 1751). It is never a judge of config values. A value falling back to a predefined key
|
|
// (ADR 0348 §7) is judged against the list the mesh published when this process holds one (PublishedPredefined);
|
|
// where it holds none, as in the indexer and the builder, each key a value names is taken as the value declares it (its
|
|
// type, trusted when it is), since the list is read where a manifest is judged: the merge gate from the tree's root,
|
|
// the controller from what it published. No input of a fingerprint or a build comes from the list. Everything else
|
|
// ParseManifest refuses is refused here too.
|
|
func ParseManifestForInputs(raw []byte) (Manifest, error) {
|
|
list := PublishedPredefined()
|
|
if list == nil {
|
|
list = fallbacksOf(raw)
|
|
}
|
|
return parseManifest(raw, list)
|
|
}
|
|
|
|
// fallbacksOf is the list of the predefined keys a manifest's config values fall back to, each as the value declares
|
|
// it. A manifest that is not JSON gives an empty list, and the parser says what is wrong with it.
|
|
func fallbacksOf(raw []byte) PredefinedList {
|
|
var m struct {
|
|
Config map[string]struct {
|
|
Type string `json:"type"`
|
|
Description string `json:"description"`
|
|
Predefined string `json:"predefined"`
|
|
Trusted bool `json:"trusted"`
|
|
} `json:"config"`
|
|
}
|
|
list := PredefinedList{}
|
|
if json.Unmarshal(raw, &m) != nil {
|
|
return list
|
|
}
|
|
for _, d := range m.Config {
|
|
if d.Predefined != "" {
|
|
list[d.Predefined] = PredefinedKey{Type: d.Type, Description: d.Description, Trusted: d.Trusted}
|
|
}
|
|
}
|
|
return list
|
|
}
|