Artifact.Series and SeriesOf (0.1 when absent); Manifest.Packages and AcceptedSeries; a config declaration's renamed-from, written back in the config form; a package's generated-from. One round-trip case covers the four, in the config form's existing test; the judge's rules on them are the indexer's (DLV-I13..I16). Claude-Session: https://claude.ai/code/session_01JG73KJNrH5EgFXMKKYSrig
66 lines
3.2 KiB
Go
66 lines
3.2 KiB
Go
package catalogue
|
|
|
|
// SettingDeclaration is one key's default, as the definition gives it.
|
|
type SettingDeclaration struct {
|
|
// Kind says what sort of value this is. `preference` is the only kind with a default; it is
|
|
// stated rather than assumed so a reviewer sees the claim being made.
|
|
Kind string `json:"kind"`
|
|
// Default is the value when no layer sets the key: a string, a number or a boolean.
|
|
Default any `json:"default"`
|
|
// Why this default: one sentence for whoever wonders whether to change it.
|
|
Why string `json:"why"`
|
|
|
|
// The config form's declaration (novox/hq ADR 0348 §4, config.go): none of these is said under
|
|
// `settings`, and neither Kind nor Why under `config`.
|
|
|
|
// Type is number, string or boolean; object or list only when Trusted.
|
|
Type string `json:"type,omitempty"`
|
|
// Description says what the value is, including its unit.
|
|
Description string `json:"description,omitempty"`
|
|
// Enum, Minimum, Maximum and Pattern are its validation: the values it may take, the bounds of a
|
|
// number, and the whole of a string matching the pattern.
|
|
Enum []any `json:"enum,omitempty"`
|
|
Minimum *float64 `json:"minimum,omitempty"`
|
|
Maximum *float64 `json:"maximum,omitempty"`
|
|
Pattern string `json:"pattern,omitempty"`
|
|
// Trusted is a value that decides what runs or who can reach what (ADR 0348 §8).
|
|
Trusted bool `json:"trusted,omitempty"`
|
|
// Predefined is the predefined key the value falls back to, of the same type (ADR 0348 §2, §7).
|
|
Predefined string `json:"predefined,omitempty"`
|
|
// Required is the operator's own value: it has no default (ADR 0348 §4).
|
|
Required bool `json:"required,omitempty"`
|
|
// Runtime is a value the module's code reads at runtime rather than one placed in a file (ADR 0348 §5).
|
|
Runtime bool `json:"runtime,omitempty"`
|
|
// RenamedFrom is the value's old name, a config value of this module's own (novox/hq ADR 0609 §4, design 32 *A
|
|
// config value renamed*): on the merge mesh-config moves the value held under it to this name, and answers both
|
|
// names until every node-engine reports a build reading the new one. The config form only: the judge refuses it
|
|
// under `settings`, on a secret, and where it changes the value's trust.
|
|
RenamedFrom string `json:"renamed-from,omitempty"`
|
|
}
|
|
|
|
// KindPreference is the kind of a setting that may have a default.
|
|
const KindPreference = "preference"
|
|
|
|
// DefaultLayer is what the layer of a module's own defaults is called where a value's source is said.
|
|
// Only said: the layer is recognised by Layer.Default, never by this name, which a node may also have.
|
|
const DefaultLayer = "default"
|
|
|
|
// meshWords are the settings keys the mesh reads itself; a module declares none of them.
|
|
var meshWords = map[string]bool{
|
|
PortsSetting: true, ExposeSetting: true, ReachSetting: true, EndpointsSetting: true,
|
|
PlacesSetting: true, AccessesSetting: true, NetworksSetting: true,
|
|
}
|
|
|
|
// SettingSource is one key's effective value and the layer it came from.
|
|
type SettingSource struct {
|
|
Key string
|
|
Value any
|
|
// From is DefaultLayer, MeshWideLayer or the node's name.
|
|
From string
|
|
// FromDefault is whether the value is the module's default, whatever From reads.
|
|
FromDefault bool
|
|
// Default is the module's default, when it gives one.
|
|
Default any
|
|
HasDefault bool
|
|
}
|