H2 K1: every seat package read tolerantly, saying its form

A reader of another part's value refused a field it did not know, so a holder
that added one broke every reader until each was rebuilt. Every package is
generated again by mesh-delivery's seatgen (feat/47-H2 ff7db337): each
generated decoder keeps unknown fields, returns the form read (1 when absent)
and each package states its Form (1 everywhere, left out on the wire). The
hand-written clients take the three values, and the node-engine client's
ask, answer, composition and have decoders keep unknown fields too; their tests
now hold that tolerance. seatgen -check clean in all five folders.

Builds: design 47 H2 §780; H-A-350 DMC-4
This commit is contained in:
2026-11-21 23:15:25 +01:00
parent 28cb4d5441
commit 2172a8732d
41 changed files with 2514 additions and 543 deletions
+409 -120
View File
@@ -4,9 +4,7 @@
package nodeengine
import (
"bytes"
"encoding/json"
"errors"
"strings"
"time"
)
@@ -14,6 +12,17 @@ import (
// Seat is the seat's name.
const Seat = "node-engine"
// Form is the form of the seat's values, events and answers this contract was generated at (design 47 H2 §780):
// a reader of a value of another form says "form N, this reader knows M".
const Form = 1
// The forms and the digest of the fields this contract was generated from: the generator's compare fails a definition
// whose fields changed while its forms did not (design 47 H2 §780).
const (
generatedForms = "1"
generatedFieldsDigest = "7aedbf50b5318425acb9a4ff0bcb65ab61b3e9276585934936cd2498a7117107"
)
const (
VerbHandOver = "hand-over"
VerbAccessAct = "access-act"
@@ -149,18 +158,13 @@ func ParseHaveByNodeModuleKey(key string) (string, string, bool) {
return v0, v2, true
}
// DecodeHaveByNodeModuleValue reads one value of the state have under the form "<node>.<module>", refusing a field HaveByNodeModuleValue does not know and any text after the value.
func DecodeHaveByNodeModuleValue(raw []byte) (HaveByNodeModuleValue, error) {
// DecodeHaveByNodeModuleValue reads one value of the state have under the form "<node>.<module>" as another part wrote it: a field HaveByNodeModuleValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
func DecodeHaveByNodeModuleValue(raw []byte) (HaveByNodeModuleValue, int, error) {
var v HaveByNodeModuleValue
dec := json.NewDecoder(bytes.NewReader(raw))
dec.DisallowUnknownFields()
if err := dec.Decode(&v); err != nil {
return v, err
if err := json.Unmarshal(raw, &v); err != nil {
return v, 0, err
}
if dec.More() {
return v, errors.New("text after the value")
}
return v, nil
return v, formRead(raw), nil
}
// HaveByNodeNodeKey is the key of one value of the state have under the form "<node>.node".
@@ -180,18 +184,13 @@ func ParseHaveByNodeNodeKey(key string) (string, bool) {
return v0, true
}
// DecodeHaveByNodeNodeValue reads one value of the state have under the form "<node>.node", refusing a field HaveByNodeNodeValue does not know and any text after the value.
func DecodeHaveByNodeNodeValue(raw []byte) (HaveByNodeNodeValue, error) {
// DecodeHaveByNodeNodeValue reads one value of the state have under the form "<node>.node" as another part wrote it: a field HaveByNodeNodeValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
func DecodeHaveByNodeNodeValue(raw []byte) (HaveByNodeNodeValue, int, error) {
var v HaveByNodeNodeValue
dec := json.NewDecoder(bytes.NewReader(raw))
dec.DisallowUnknownFields()
if err := dec.Decode(&v); err != nil {
return v, err
if err := json.Unmarshal(raw, &v); err != nil {
return v, 0, err
}
if dec.More() {
return v, errors.New("text after the value")
}
return v, nil
return v, formRead(raw), nil
}
// ComposedByNodeModuleFingerprintKey is the key of one value of the state composed under the form "<node>.<module>.<fingerprint>".
@@ -223,18 +222,13 @@ func ParseComposedByNodeModuleFingerprintKey(key string) (string, string, string
return v0, v2, v4, true
}
// DecodeComposedByNodeModuleFingerprintValue reads one value of the state composed under the form "<node>.<module>.<fingerprint>", refusing a field ComposedByNodeModuleFingerprintValue does not know and any text after the value.
func DecodeComposedByNodeModuleFingerprintValue(raw []byte) (ComposedByNodeModuleFingerprintValue, error) {
// DecodeComposedByNodeModuleFingerprintValue reads one value of the state composed under the form "<node>.<module>.<fingerprint>" as another part wrote it: a field ComposedByNodeModuleFingerprintValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
func DecodeComposedByNodeModuleFingerprintValue(raw []byte) (ComposedByNodeModuleFingerprintValue, int, error) {
var v ComposedByNodeModuleFingerprintValue
dec := json.NewDecoder(bytes.NewReader(raw))
dec.DisallowUnknownFields()
if err := dec.Decode(&v); err != nil {
return v, err
if err := json.Unmarshal(raw, &v); err != nil {
return v, 0, err
}
if dec.More() {
return v, errors.New("text after the value")
}
return v, nil
return v, formRead(raw), nil
}
// ComposedByNodeNodeKey is the key of one value of the state composed under the form "<node>.node".
@@ -254,18 +248,13 @@ func ParseComposedByNodeNodeKey(key string) (string, bool) {
return v0, true
}
// DecodeComposedByNodeNodeValue reads one value of the state composed under the form "<node>.node", refusing a field ComposedByNodeNodeValue does not know and any text after the value.
func DecodeComposedByNodeNodeValue(raw []byte) (ComposedByNodeNodeValue, error) {
// DecodeComposedByNodeNodeValue reads one value of the state composed under the form "<node>.node" as another part wrote it: a field ComposedByNodeNodeValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
func DecodeComposedByNodeNodeValue(raw []byte) (ComposedByNodeNodeValue, int, error) {
var v ComposedByNodeNodeValue
dec := json.NewDecoder(bytes.NewReader(raw))
dec.DisallowUnknownFields()
if err := dec.Decode(&v); err != nil {
return v, err
if err := json.Unmarshal(raw, &v); err != nil {
return v, 0, err
}
if dec.More() {
return v, errors.New("text after the value")
}
return v, nil
return v, formRead(raw), nil
}
// DataByNodeModuleKey is the key of one value of the state data under the form "<node>.<module>".
@@ -290,18 +279,13 @@ func ParseDataByNodeModuleKey(key string) (string, string, bool) {
return v0, v2, true
}
// DecodeDataByNodeModuleValue reads one value of the state data under the form "<node>.<module>", refusing a field DataByNodeModuleValue does not know and any text after the value.
func DecodeDataByNodeModuleValue(raw []byte) (DataByNodeModuleValue, error) {
// DecodeDataByNodeModuleValue reads one value of the state data under the form "<node>.<module>" as another part wrote it: a field DataByNodeModuleValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
func DecodeDataByNodeModuleValue(raw []byte) (DataByNodeModuleValue, int, error) {
var v DataByNodeModuleValue
dec := json.NewDecoder(bytes.NewReader(raw))
dec.DisallowUnknownFields()
if err := dec.Decode(&v); err != nil {
return v, err
if err := json.Unmarshal(raw, &v); err != nil {
return v, 0, err
}
if dec.More() {
return v, errors.New("text after the value")
}
return v, nil
return v, formRead(raw), nil
}
// PackagesByNodeKey is the key of one value of the state packages under the form "<node>".
@@ -321,18 +305,13 @@ func ParsePackagesByNodeKey(key string) (string, bool) {
return v0, true
}
// DecodePackagesByNodeValue reads one value of the state packages under the form "<node>", refusing a field PackagesByNodeValue does not know and any text after the value.
func DecodePackagesByNodeValue(raw []byte) (PackagesByNodeValue, error) {
// DecodePackagesByNodeValue reads one value of the state packages under the form "<node>" as another part wrote it: a field PackagesByNodeValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
func DecodePackagesByNodeValue(raw []byte) (PackagesByNodeValue, int, error) {
var v PackagesByNodeValue
dec := json.NewDecoder(bytes.NewReader(raw))
dec.DisallowUnknownFields()
if err := dec.Decode(&v); err != nil {
return v, err
if err := json.Unmarshal(raw, &v); err != nil {
return v, 0, err
}
if dec.More() {
return v, errors.New("text after the value")
}
return v, nil
return v, formRead(raw), nil
}
// HealthByNodeKey is the key of one value of the state health under the form "<node>".
@@ -352,18 +331,13 @@ func ParseHealthByNodeKey(key string) (string, bool) {
return v0, true
}
// DecodeHealthByNodeValue reads one value of the state health under the form "<node>", refusing a field HealthByNodeValue does not know and any text after the value.
func DecodeHealthByNodeValue(raw []byte) (HealthByNodeValue, error) {
// DecodeHealthByNodeValue reads one value of the state health under the form "<node>" as another part wrote it: a field HealthByNodeValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
func DecodeHealthByNodeValue(raw []byte) (HealthByNodeValue, int, error) {
var v HealthByNodeValue
dec := json.NewDecoder(bytes.NewReader(raw))
dec.DisallowUnknownFields()
if err := dec.Decode(&v); err != nil {
return v, err
if err := json.Unmarshal(raw, &v); err != nil {
return v, 0, err
}
if dec.More() {
return v, errors.New("text after the value")
}
return v, nil
return v, formRead(raw), nil
}
// FindingsByKeyKey is the key of one value of the state findings under the form "<key>".
@@ -383,18 +357,13 @@ func ParseFindingsByKeyKey(key string) (string, bool) {
return v0, true
}
// DecodeFindingsByKeyValue reads one value of the state findings under the form "<key>", refusing a field FindingsByKeyValue does not know and any text after the value.
func DecodeFindingsByKeyValue(raw []byte) (FindingsByKeyValue, error) {
// DecodeFindingsByKeyValue reads one value of the state findings under the form "<key>" as another part wrote it: a field FindingsByKeyValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
func DecodeFindingsByKeyValue(raw []byte) (FindingsByKeyValue, int, error) {
var v FindingsByKeyValue
dec := json.NewDecoder(bytes.NewReader(raw))
dec.DisallowUnknownFields()
if err := dec.Decode(&v); err != nil {
return v, err
if err := json.Unmarshal(raw, &v); err != nil {
return v, 0, err
}
if dec.More() {
return v, errors.New("text after the value")
}
return v, nil
return v, formRead(raw), nil
}
// BoundsByWhatIDKey is the key of one value of the state bounds under the form "<what>.<id>".
@@ -419,18 +388,13 @@ func ParseBoundsByWhatIDKey(key string) (string, string, bool) {
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) {
// DecodeBoundsByWhatIDValue reads one value of the state bounds under the form "<what>.<id>" as another part wrote it: a field BoundsByWhatIDValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
func DecodeBoundsByWhatIDValue(raw []byte) (BoundsByWhatIDValue, int, error) {
var v BoundsByWhatIDValue
dec := json.NewDecoder(bytes.NewReader(raw))
dec.DisallowUnknownFields()
if err := dec.Decode(&v); err != nil {
return v, err
if err := json.Unmarshal(raw, &v); err != nil {
return v, 0, err
}
if dec.More() {
return v, errors.New("text after the value")
}
return v, nil
return v, formRead(raw), nil
}
// AccountsHanded is the hashes of the users of the list, sealed to the vault.
@@ -500,6 +464,8 @@ type ActSaid struct {
Ask string `json:"ask,omitempty"`
// the caller as the runtime proved it
Caller string `json:"caller"`
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
Form int64 `json:"form,omitempty"`
// the node whose engine says it
Node string `json:"node"`
// what the engine said of it
@@ -521,6 +487,8 @@ const (
type Acts struct {
// the acts, newest first
Acts []Act `json:"acts"`
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
Form int64 `json:"form,omitempty"`
// the node
Node string `json:"node"`
}
@@ -537,6 +505,8 @@ type Adoption struct {
type Asked struct {
// the ask's id: acts shows where it stands
Asked string `json:"asked"`
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
Form int64 `json:"form,omitempty"`
// the node
Node string `json:"node"`
// what happens next, in words
@@ -618,6 +588,8 @@ type Composed struct {
Digest string `json:"digest"`
// the fingerprint of the want composed
Fingerprint string `json:"fingerprint"`
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
Form int64 `json:"form,omitempty"`
// the module
Module string `json:"module"`
// the node
@@ -740,6 +712,8 @@ const (
type ManifestReadsChanged struct {
// when it says it, RFC 3339
At string `json:"at"`
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
Form int64 `json:"form,omitempty"`
// what its engine states it reads now
ManifestReads []string `json:"manifest-reads,omitempty"`
// the node
@@ -903,6 +877,8 @@ const (
type ProcessBuilds struct {
// why they could not be read
Error string `json:"error,omitempty"`
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
Form int64 `json:"form,omitempty"`
// the node
Node string `json:"node"`
// every process the node-engine started, by module
@@ -969,6 +945,8 @@ type Running struct {
At time.Time `json:"at"`
// the fingerprint of the build it runs; none with stopped
Fingerprint string `json:"fingerprint,omitempty"`
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
Form int64 `json:"form,omitempty"`
// the health of the build that runs, as the node-engine's have holds it from the module's declared check (ADR 0240); a running with none, said by a node-engine of before design 47 G, reads as healthy (design 47 G 520). SeatsToPassOn reads none of it: an unhealthy holder still holds its seat
Healthy *bool `json:"healthy,omitempty"`
// the digest of that build's manifest, the indexer's manifest of it, read by digest from the catalog half
@@ -985,6 +963,8 @@ type Running struct {
// Said is the answer of a read-only judgement.
type Said struct {
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
Form int64 `json:"form,omitempty"`
// the node
Node string `json:"node"`
// the engine's judgement or search, one line per directory or program
@@ -1017,6 +997,8 @@ type SeatListStatus struct {
type SeatList struct {
// why the read failed, for seat-list-again
Error string `json:"error,omitempty"`
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
Form int64 `json:"form,omitempty"`
// the one line the engine says of it; empty when nothing waits
Health string `json:"health"`
Status SeatListStatus `json:"status"`
@@ -1077,6 +1059,8 @@ type Wait struct {
Bound string `json:"bound,omitempty"`
// the time the bound counts from (design 47 G 266, 269, 498)
ClockFrom *time.Time `json:"clock-from,omitempty"`
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
Form int64 `json:"form,omitempty"`
// the node waited on: the build node for a kept build; the subject's <node> is the node that says it
Node string `json:"node,omitempty"`
// what it waits on
@@ -1145,6 +1129,8 @@ type RootFreeInput struct {
// RootFreeAnswer is what root-free answers.
type RootFreeAnswer struct {
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
Form int64 `json:"form,omitempty"`
// this machine's verdict
Machines []RootVerdict `json:"machines"`
}
@@ -1192,6 +1178,8 @@ type PackagesAnswerKey struct {
// PackagesAnswer is what packages answers.
type PackagesAnswer struct {
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
Form int64 `json:"form,omitempty"`
// the node's key as the bus holds it; absent when the engine wrote none
Key *PackagesAnswerKey `json:"key,omitempty"`
// why the key could not be read
@@ -1333,6 +1321,8 @@ type CompositionAnswer struct {
Composition Revision `json:"composition"`
// every resource that differs from what runs, when asked
Diff []map[string]any `json:"diff,omitempty"`
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
Form int64 `json:"form,omitempty"`
// what the module's have key says now; absent when it says nothing
Have *CompositionAnswerHave `json:"have,omitempty"`
// the move from what runs to the composition read
@@ -1371,6 +1361,8 @@ type CompositionDiffInput struct {
// CompositionDiffAnswer is what composition-diff answers.
type CompositionDiffAnswer struct {
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
Form int64 `json:"form,omitempty"`
// the module
Module string `json:"module"`
// the node
@@ -1406,6 +1398,8 @@ type ComposeAnswerPass struct {
// ComposeAnswer is what compose answers.
type ComposeAnswer struct {
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
Form int64 `json:"form,omitempty"`
// how the pass went
Pass ComposeAnswerPass `json:"pass"`
// the module whose apply was tried again
@@ -1428,6 +1422,8 @@ type ComposeCandidateAnswer struct {
Candidate string `json:"candidate"`
// when asked with input and a call token: how many chunks of at most 512 KiB carry the composition input, sent on the chunk subject of the call, each acknowledged by the caller (design 47 G A-237b)
Chunks int64 `json:"chunks,omitempty"`
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
Form int64 `json:"form,omitempty"`
// when asked without a call token: the composition input it composed from, inline, up to what one answer carries (the checker's form, kept until G removes the checker, G-6 section 321)
Input map[string]any `json:"input,omitempty"`
// every module placed on the node, sorted by name
@@ -1459,6 +1455,8 @@ type ManifestReadsInput struct {
// ManifestReadsAnswer is what manifest-reads answers.
type ManifestReadsAnswer struct {
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
Form int64 `json:"form,omitempty"`
// the reader capabilities its engine states: the manifest words, forms and seat names it reads; empty for an engine built before it said them, read as the baseline
ManifestReads []string `json:"manifest-reads,omitempty"`
// the node
@@ -1491,6 +1489,8 @@ type ApplyOrderAnswerOrderItem struct {
// ApplyOrderAnswer is what apply-order answers.
type ApplyOrderAnswer struct {
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
Form int64 `json:"form,omitempty"`
// one row per unapplied changed want, in the order it will be applied
Order []ApplyOrderAnswerOrderItem `json:"order"`
}
@@ -1546,6 +1546,8 @@ type FirstViewsAnswer struct {
Entries []FirstViewsAnswerEntriesItem `json:"entries"`
// one status per owner and state followed, as mesh-sdk's views runtime keeps it
FirstViews []map[string]any `json:"first-views"`
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
Form int64 `json:"form,omitempty"`
// the wants the node-engine keeps (design 47 G 683, 698)
Wants []FirstViewsAnswerWantsItem `json:"wants"`
}
@@ -1580,6 +1582,8 @@ type FirstViewAgainAnswerAsked struct {
type FirstViewAgainAnswer struct {
// the hand ask written
Asked FirstViewAgainAnswerAsked `json:"asked"`
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
Form int64 `json:"form,omitempty"`
// the verb that reads the status, first-views
Read string `json:"read"`
}
@@ -1610,6 +1614,8 @@ type EntryAgainAnswerAsked struct {
type EntryAgainAnswer struct {
// the hand ask written
Asked EntryAgainAnswerAsked `json:"asked"`
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
Form int64 `json:"form,omitempty"`
// the verb that reads the status, first-views
Read string `json:"read"`
}
@@ -1629,6 +1635,8 @@ type ConvergedInput struct {
// ConvergedAnswer is what converged answers.
type ConvergedAnswer struct {
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
Form int64 `json:"form,omitempty"`
// the kind of the firewall found, for an adopted node
Found string `json:"found,omitempty"`
// the links of this node that face outside, as the engine classifies them for its filter render (ADR 0140); an allowance with no interface never opens one
@@ -1679,6 +1687,8 @@ type HaveByNodeModuleValue struct {
// the digest of the composition the node runs
Composed string `json:"composed,omitempty"`
Detail string `json:"detail,omitempty"`
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
Form int64 `json:"form,omitempty"`
// the fingerprint held
Fp string `json:"fp,omitempty"`
Handed *AccountsHanded `json:"handed,omitempty"`
@@ -1737,16 +1747,18 @@ type HaveByNodeNodeValue struct {
// the digest of the node's own composition it runs
Composed string `json:"composed,omitempty"`
// own, or none (empty)
Composes string `json:"composes,omitempty"`
ComposesWhy string `json:"composes-why,omitempty"`
Filters []map[string]any `json:"filters,omitempty"`
Profile map[string]any `json:"profile,omitempty"`
Record *NodeRecord `json:"record,omitempty"`
Sealed []string `json:"sealed,omitempty"`
SealedAt map[string]string `json:"sealed-at,omitempty"`
Strays []map[string]any `json:"strays,omitempty"`
V int64 `json:"v"`
Windows []map[string]any `json:"windows,omitempty"`
Composes string `json:"composes,omitempty"`
ComposesWhy string `json:"composes-why,omitempty"`
Filters []map[string]any `json:"filters,omitempty"`
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
Form int64 `json:"form,omitempty"`
Profile map[string]any `json:"profile,omitempty"`
Record *NodeRecord `json:"record,omitempty"`
Sealed []string `json:"sealed,omitempty"`
SealedAt map[string]string `json:"sealed-at,omitempty"`
Strays []map[string]any `json:"strays,omitempty"`
V int64 `json:"v"`
Windows []map[string]any `json:"windows,omitempty"`
}
// ComposedByNodeModuleFingerprintValue is one value of the state composed under the key <node>.<module>.<fingerprint>.
@@ -1755,9 +1767,11 @@ type ComposedByNodeModuleFingerprintValue struct {
Data bool `json:"data,omitempty"`
// the files the provisioner fills
FilledFiles []string `json:"filled_files,omitempty"`
Fp string `json:"fp"`
Module string `json:"module"`
Node string `json:"node"`
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
Form int64 `json:"form,omitempty"`
Fp string `json:"fp"`
Module string `json:"module"`
Node string `json:"node"`
// the module's whole provisioning plan, catalogue.Plan, kept whole: it is the manifest layer's type
Plan map[string]any `json:"plan,omitempty"`
// why the module cannot be composed at this fingerprint
@@ -1775,8 +1789,10 @@ type ComposedByNodeNodeValue struct {
Data bool `json:"data,omitempty"`
// the files the provisioner fills
FilledFiles []string `json:"filled_files,omitempty"`
Node string `json:"node"`
Own *NodeOwn `json:"own,omitempty"`
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
Form int64 `json:"form,omitempty"`
Node string `json:"node"`
Own *NodeOwn `json:"own,omitempty"`
// the declaration resources, each saying its module
Resources []map[string]any `json:"resources"`
V int64 `json:"v"`
@@ -1784,7 +1800,9 @@ type ComposedByNodeNodeValue struct {
// DataByNodeModuleValue is one value of the state data under the key <node>.<module>.
type DataByNodeModuleValue struct {
Digest string `json:"digest"`
Digest string `json:"digest"`
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
Form int64 `json:"form,omitempty"`
Items []PlacedDataItem `json:"items"`
Module string `json:"module"`
Node string `json:"node"`
@@ -1800,6 +1818,8 @@ type PackagesByNodeValuePackagesItem struct {
// PackagesByNodeValue is one value of the state packages under the key <node>.
type PackagesByNodeValue struct {
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
Form int64 `json:"form,omitempty"`
Node string `json:"node"`
Packages []PackagesByNodeValuePackagesItem `json:"packages"`
}
@@ -1807,17 +1827,19 @@ type PackagesByNodeValue struct {
// HealthByNodeValue is one value of the state health under the key <node>.
type HealthByNodeValue struct {
// when
At time.Time `json:"at"`
Contract int64 `json:"contract,omitempty"`
Fallback *LoginFallback `json:"fallback,omitempty"`
Found []NodeDirectory `json:"found,omitempty"`
Network *NetworkHealth `json:"network,omitempty"`
Node string `json:"node"`
Peers []PeerSeen `json:"peers,omitempty"`
Relogin []NodeAccount `json:"relogin,omitempty"`
Root []RootAccountVerdict `json:"root,omitempty"`
Units *UnitsHealth `json:"units,omitempty"`
V int64 `json:"v"`
At time.Time `json:"at"`
Contract int64 `json:"contract,omitempty"`
Fallback *LoginFallback `json:"fallback,omitempty"`
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
Form int64 `json:"form,omitempty"`
Found []NodeDirectory `json:"found,omitempty"`
Network *NetworkHealth `json:"network,omitempty"`
Node string `json:"node"`
Peers []PeerSeen `json:"peers,omitempty"`
Relogin []NodeAccount `json:"relogin,omitempty"`
Root []RootAccountVerdict `json:"root,omitempty"`
Units *UnitsHealth `json:"units,omitempty"`
V int64 `json:"v"`
}
// FindingsByKeyValue is one value of the state findings under the key <key>.
@@ -1827,7 +1849,9 @@ type FindingsByKeyValue struct {
// newest first, at most 10
Evidence []FindingEvidence `json:"evidence,omitempty"`
Explanation string `json:"explanation,omitempty"`
Headline string `json:"headline,omitempty"`
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
Form int64 `json:"form,omitempty"`
Headline string `json:"headline,omitempty"`
// scope.id.token
Key string `json:"key"`
Kind string `json:"kind"`
@@ -1859,9 +1883,274 @@ const (
// BoundsByWhatIDValue is one value of the state bounds under the key <what>.<id>.
type BoundsByWhatIDValue struct {
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
Form int64 `json:"form,omitempty"`
Module string `json:"module,omitempty"`
// when the wait began, RFC 3339
Since string `json:"since"`
// layout version, 1
V int64 `json:"v"`
}
// DecodeHandOverAnswer reads a HandOverAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
func DecodeHandOverAnswer(raw []byte) (HandOverAnswer, int, error) {
var v HandOverAnswer
if err := json.Unmarshal(raw, &v); err != nil {
return v, 0, err
}
return v, formRead(raw), nil
}
// DecodeAccessActAnswer reads a AccessActAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
func DecodeAccessActAnswer(raw []byte) (AccessActAnswer, int, error) {
var v AccessActAnswer
if err := json.Unmarshal(raw, &v); err != nil {
return v, 0, err
}
return v, formRead(raw), nil
}
// DecodeJudgeDirectoriesAnswer reads a JudgeDirectoriesAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
func DecodeJudgeDirectoriesAnswer(raw []byte) (JudgeDirectoriesAnswer, int, error) {
var v JudgeDirectoriesAnswer
if err := json.Unmarshal(raw, &v); err != nil {
return v, 0, err
}
return v, formRead(raw), nil
}
// DecodeSetuidSearchAnswer reads a SetuidSearchAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
func DecodeSetuidSearchAnswer(raw []byte) (SetuidSearchAnswer, int, error) {
var v SetuidSearchAnswer
if err := json.Unmarshal(raw, &v); err != nil {
return v, 0, err
}
return v, formRead(raw), nil
}
// DecodeRootFreeAnswer reads a RootFreeAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
func DecodeRootFreeAnswer(raw []byte) (RootFreeAnswer, int, error) {
var v RootFreeAnswer
if err := json.Unmarshal(raw, &v); err != nil {
return v, 0, err
}
return v, formRead(raw), nil
}
// DecodeActsAnswer reads a ActsAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
func DecodeActsAnswer(raw []byte) (ActsAnswer, int, error) {
var v ActsAnswer
if err := json.Unmarshal(raw, &v); err != nil {
return v, 0, err
}
return v, formRead(raw), nil
}
// DecodePackagesAnswer reads a PackagesAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
func DecodePackagesAnswer(raw []byte) (PackagesAnswer, int, error) {
var v PackagesAnswer
if err := json.Unmarshal(raw, &v); err != nil {
return v, 0, err
}
return v, formRead(raw), nil
}
// DecodeCompositionAnswer reads a CompositionAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
func DecodeCompositionAnswer(raw []byte) (CompositionAnswer, int, error) {
var v CompositionAnswer
if err := json.Unmarshal(raw, &v); err != nil {
return v, 0, err
}
return v, formRead(raw), nil
}
// DecodeCompositionDiffAnswer reads a CompositionDiffAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
func DecodeCompositionDiffAnswer(raw []byte) (CompositionDiffAnswer, int, error) {
var v CompositionDiffAnswer
if err := json.Unmarshal(raw, &v); err != nil {
return v, 0, err
}
return v, formRead(raw), nil
}
// DecodeComposeAnswer reads a ComposeAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
func DecodeComposeAnswer(raw []byte) (ComposeAnswer, int, error) {
var v ComposeAnswer
if err := json.Unmarshal(raw, &v); err != nil {
return v, 0, err
}
return v, formRead(raw), nil
}
// DecodeComposeCandidateAnswer reads a ComposeCandidateAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
func DecodeComposeCandidateAnswer(raw []byte) (ComposeCandidateAnswer, int, error) {
var v ComposeCandidateAnswer
if err := json.Unmarshal(raw, &v); err != nil {
return v, 0, err
}
return v, formRead(raw), nil
}
// DecodeManifestReadsAnswer reads a ManifestReadsAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
func DecodeManifestReadsAnswer(raw []byte) (ManifestReadsAnswer, int, error) {
var v ManifestReadsAnswer
if err := json.Unmarshal(raw, &v); err != nil {
return v, 0, err
}
return v, formRead(raw), nil
}
// DecodeApplyOrderAnswer reads a ApplyOrderAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
func DecodeApplyOrderAnswer(raw []byte) (ApplyOrderAnswer, int, error) {
var v ApplyOrderAnswer
if err := json.Unmarshal(raw, &v); err != nil {
return v, 0, err
}
return v, formRead(raw), nil
}
// DecodeSeatListAnswer reads a SeatListAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
func DecodeSeatListAnswer(raw []byte) (SeatListAnswer, int, error) {
var v SeatListAnswer
if err := json.Unmarshal(raw, &v); err != nil {
return v, 0, err
}
return v, formRead(raw), nil
}
// DecodeSeatListAgainAnswer reads a SeatListAgainAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
func DecodeSeatListAgainAnswer(raw []byte) (SeatListAgainAnswer, int, error) {
var v SeatListAgainAnswer
if err := json.Unmarshal(raw, &v); err != nil {
return v, 0, err
}
return v, formRead(raw), nil
}
// DecodeFirstViewsAnswer reads a FirstViewsAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
func DecodeFirstViewsAnswer(raw []byte) (FirstViewsAnswer, int, error) {
var v FirstViewsAnswer
if err := json.Unmarshal(raw, &v); err != nil {
return v, 0, err
}
return v, formRead(raw), nil
}
// DecodeFirstViewAgainAnswer reads a FirstViewAgainAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
func DecodeFirstViewAgainAnswer(raw []byte) (FirstViewAgainAnswer, int, error) {
var v FirstViewAgainAnswer
if err := json.Unmarshal(raw, &v); err != nil {
return v, 0, err
}
return v, formRead(raw), nil
}
// DecodeEntryAgainAnswer reads a EntryAgainAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
func DecodeEntryAgainAnswer(raw []byte) (EntryAgainAnswer, int, error) {
var v EntryAgainAnswer
if err := json.Unmarshal(raw, &v); err != nil {
return v, 0, err
}
return v, formRead(raw), nil
}
// DecodeProcessBuildsAnswer reads a ProcessBuildsAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
func DecodeProcessBuildsAnswer(raw []byte) (ProcessBuildsAnswer, int, error) {
var v ProcessBuildsAnswer
if err := json.Unmarshal(raw, &v); err != nil {
return v, 0, err
}
return v, formRead(raw), nil
}
// DecodeConvergedAnswer reads a ConvergedAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
func DecodeConvergedAnswer(raw []byte) (ConvergedAnswer, int, error) {
var v ConvergedAnswer
if err := json.Unmarshal(raw, &v); err != nil {
return v, 0, err
}
return v, formRead(raw), nil
}
// DecodeAskedEvent reads a AskedEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
func DecodeAskedEvent(raw []byte) (AskedEvent, int, error) {
var v AskedEvent
if err := json.Unmarshal(raw, &v); err != nil {
return v, 0, err
}
return v, formRead(raw), nil
}
// DecodeDoneEvent reads a DoneEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
func DecodeDoneEvent(raw []byte) (DoneEvent, int, error) {
var v DoneEvent
if err := json.Unmarshal(raw, &v); err != nil {
return v, 0, err
}
return v, formRead(raw), nil
}
// DecodeRefusedEvent reads a RefusedEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
func DecodeRefusedEvent(raw []byte) (RefusedEvent, int, error) {
var v RefusedEvent
if err := json.Unmarshal(raw, &v); err != nil {
return v, 0, err
}
return v, formRead(raw), nil
}
// DecodeManifestReadsChangedEvent reads a ManifestReadsChangedEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
func DecodeManifestReadsChangedEvent(raw []byte) (ManifestReadsChangedEvent, int, error) {
var v ManifestReadsChangedEvent
if err := json.Unmarshal(raw, &v); err != nil {
return v, 0, err
}
return v, formRead(raw), nil
}
// DecodeComposedEvent reads a ComposedEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
func DecodeComposedEvent(raw []byte) (ComposedEvent, int, error) {
var v ComposedEvent
if err := json.Unmarshal(raw, &v); err != nil {
return v, 0, err
}
return v, formRead(raw), nil
}
// DecodeRunningEvent reads a RunningEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
func DecodeRunningEvent(raw []byte) (RunningEvent, int, error) {
var v RunningEvent
if err := json.Unmarshal(raw, &v); err != nil {
return v, 0, err
}
return v, formRead(raw), nil
}
// DecodeWaitHeldEvent reads a WaitHeldEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
func DecodeWaitHeldEvent(raw []byte) (WaitHeldEvent, int, error) {
var v WaitHeldEvent
if err := json.Unmarshal(raw, &v); err != nil {
return v, 0, err
}
return v, formRead(raw), nil
}
// DecodeWaitEndedEvent reads a WaitEndedEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
func DecodeWaitEndedEvent(raw []byte) (WaitEndedEvent, int, error) {
var v WaitEndedEvent
if err := json.Unmarshal(raw, &v); err != nil {
return v, 0, err
}
return v, formRead(raw), nil
}
// formRead is the form a value says on the wire: 1 when it says none, or is no object.
func formRead(raw []byte) int {
var f struct {
Form int `json:"form"`
}
if json.Unmarshal(raw, &f) != nil || f.Form < 1 {
return 1
}
return f.Form
}