G A-92: the node-engine's seat definition gains the state bounds, key <what>.<id>, in its old section
Builds: design 47 G §560, §557, §627, A-77, A-92 Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
This commit is contained in:
@@ -121,6 +121,7 @@ const (
|
||||
StatePackages = "packages"
|
||||
StateHealth = "health"
|
||||
StateFindings = "findings"
|
||||
StateBounds = "bounds"
|
||||
)
|
||||
|
||||
// HaveByNodeModuleKey is the key of one value of the state have under the form "<node>.<module>".
|
||||
@@ -393,6 +394,42 @@ func DecodeFindingsByKeyValue(raw []byte) (FindingsByKeyValue, error) {
|
||||
return v, nil
|
||||
}
|
||||
|
||||
// BoundsByWhatIDKey is the key of one value of the state bounds under the form "<what>.<id>".
|
||||
func BoundsByWhatIDKey(what, id string) string { return what + "." + id }
|
||||
|
||||
// ParseBoundsByWhatIDKey reads the parts of a key of the form "<what>.<id>", in the order of the form; the last result is false for a key of another form.
|
||||
func ParseBoundsByWhatIDKey(key string) (string, string, bool) {
|
||||
rest := key
|
||||
v0, after0, found0 := strings.Cut(rest, ".")
|
||||
if !found0 || v0 == "" {
|
||||
return "", "", false
|
||||
}
|
||||
rest = after0
|
||||
if rest == "" {
|
||||
return "", "", false
|
||||
}
|
||||
v2 := rest
|
||||
rest = ""
|
||||
if rest != "" {
|
||||
return "", "", false
|
||||
}
|
||||
return v0, v2, true
|
||||
}
|
||||
|
||||
// DecodeBoundsByWhatIDValue reads one value of the state bounds under the form "<what>.<id>", refusing a field BoundsByWhatIDValue does not know and any text after the value.
|
||||
func DecodeBoundsByWhatIDValue(raw []byte) (BoundsByWhatIDValue, error) {
|
||||
var v BoundsByWhatIDValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
}
|
||||
|
||||
// AccountsHanded is the hashes of the users of the list, sealed to the vault.
|
||||
type AccountsHanded struct {
|
||||
// when
|
||||
@@ -1684,3 +1721,12 @@ const (
|
||||
FindingsByKeyValueSeverityUrgent = "urgent"
|
||||
FindingsByKeyValueSeverityWarning = "warning"
|
||||
)
|
||||
|
||||
// BoundsByWhatIDValue is one value of the state bounds under the key <what>.<id>.
|
||||
type BoundsByWhatIDValue struct {
|
||||
Module string `json:"module,omitempty"`
|
||||
// when the wait began, RFC 3339
|
||||
Since string `json:"since"`
|
||||
// layout version, 1
|
||||
V int64 `json:"v"`
|
||||
}
|
||||
|
||||
@@ -93,6 +93,8 @@ func TestFixtures(t *testing.T) {
|
||||
decode: func(b []byte) (any, error) { var v HealthByNodeValue; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
|
||||
{name: "a have that waits for the recovery module, with its wait, ask-at and act (design 47 G 560, 629)", subject: "", given: "{\"detail\":\"waiting for a restore point\",\"fp\":\"0123456789ab\",\"health\":\"waits\",\"phase\":\"held\",\"v\":1,\"wait\":{\"act\":\"a-20261111t100000\",\"ask-at\":\"2026-11-11T10:00:00Z\",\"bound\":\"90m\",\"clock-from\":\"2026-11-11T10:00:00Z\",\"on\":\"the recovery module's ended\",\"owner\":\"node-engine\",\"reason\":\"recovery wait\",\"since\":\"2026-11-11T10:00:00Z\",\"step\":\"compose\",\"words\":\"waiting for the point of postgres's data\"}}", wire: "{\"detail\":\"waiting for a restore point\",\"fp\":\"0123456789ab\",\"health\":\"waits\",\"phase\":\"held\",\"v\":1,\"wait\":{\"act\":\"a-20261111t100000\",\"ask-at\":\"2026-11-11T10:00:00Z\",\"bound\":\"90m\",\"clock-from\":\"2026-11-11T10:00:00Z\",\"on\":\"the recovery module's ended\",\"owner\":\"node-engine\",\"reason\":\"recovery wait\",\"since\":\"2026-11-11T10:00:00Z\",\"step\":\"compose\",\"words\":\"waiting for the point of postgres's data\"}}",
|
||||
decode: func(b []byte) (any, error) { var v HaveByNodeModuleValue; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
|
||||
{name: "a bound of a wait on the recovery module's restore point", subject: "", given: "{\"module\":\"mesh-delivery-assigner\",\"since\":\"2026-11-11T14:00:00Z\",\"v\":1}", wire: "{\"module\":\"mesh-delivery-assigner\",\"since\":\"2026-11-11T14:00:00Z\",\"v\":1}",
|
||||
decode: func(b []byte) (any, error) { var v BoundsByWhatIDValue; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
|
||||
{name: "manifest-reads answers what the engine reads and when it stated it", subject: "", given: "{\"manifest-reads\":[\"form:seat-reference\",\"word:series\"],\"node\":\"ace\",\"stated-at\":\"2026-11-04T10:00:00Z\",\"v\":1}", wire: "{\"manifest-reads\":[\"form:seat-reference\",\"word:series\"],\"node\":\"ace\",\"stated-at\":\"2026-11-04T10:00:00Z\",\"v\":1}",
|
||||
decode: func(b []byte) (any, error) { var v ManifestReadsAnswer; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
|
||||
{name: "manifest-reads of an engine built before it said them is the baseline", subject: "", given: "{\"node\":\"g14\",\"stated-at\":\"2026-11-04T10:05:00Z\",\"v\":1}", wire: "{\"node\":\"g14\",\"stated-at\":\"2026-11-04T10:05:00Z\",\"v\":1}",
|
||||
|
||||
Reference in New Issue
Block a user