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
+3 -5
View File
@@ -289,16 +289,14 @@ func EncodeComposition(c Composition) ([]byte, error) {
return json.Marshal(w)
}
// DecodeComposition reads a composition; it refuses an unknown version (keys.ErrUnknownVersion), a field it does not
// know, and what EncodeComposition refuses.
// DecodeComposition reads a composition tolerantly, keeping a field it does not know (design 47 H2 §780); it refuses an
// unknown version (keys.ErrUnknownVersion) and what EncodeComposition refuses.
func DecodeComposition(data []byte) (Composition, error) {
if err := keys.CheckVersion(data); err != nil {
return Composition{}, err
}
var w composedWire
d := json.NewDecoder(bytes.NewReader(data))
d.DisallowUnknownFields()
if err := d.Decode(&w); err != nil {
if err := json.Unmarshal(data, &w); err != nil {
return Composition{}, fmt.Errorf("node-engine: a composition does not fit its shape: %w", err)
}
c := Composition{V: w.V, Node: w.Node, Module: w.Module, FP: w.FP, Data: w.Data, Resources: w.Resources,