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:
@@ -24,8 +24,8 @@ func TestComposeCandidateRoundTripsAndRefuses(t *testing.T) {
|
||||
if a, err := DecodeAsk(raw); err != nil || a.Candidate != key || !a.Input {
|
||||
t.Fatalf("ask round trip: %v, %+v", err, a)
|
||||
}
|
||||
if _, err := DecodeAsk([]byte(`{"candidate":"` + key + `","other":1}`)); err == nil {
|
||||
t.Error("an ask with an unknown key was read")
|
||||
if a, err := DecodeAsk([]byte(`{"candidate":"` + key + `","other":1}`)); err != nil || a.Candidate != key {
|
||||
t.Errorf("an ask with an unknown key is refused (§780 reads it tolerantly): %+v, %v", a, err)
|
||||
}
|
||||
if _, err := EncodeAsk(seat.ComposeCandidateInput{Candidate: "nope"}); err == nil {
|
||||
t.Error("an ask naming no candidate key was encoded")
|
||||
@@ -46,8 +46,8 @@ func TestComposeCandidateRoundTripsAndRefuses(t *testing.T) {
|
||||
if err != nil || back.Verdict != Refused || len(back.Modules) != 3 || !reflect.DeepEqual(back.Input, good.Input) {
|
||||
t.Fatalf("answer round trip: %v, %+v", err, back)
|
||||
}
|
||||
if _, err := DecodeAnswer([]byte(strings.Replace(string(raw), `"took"`, `"other":1,"took"`, 1))); err == nil {
|
||||
t.Error("an answer with an unknown key was read")
|
||||
if _, err := DecodeAnswer([]byte(strings.Replace(string(raw), `"took"`, `"other":1,"took"`, 1))); err != nil {
|
||||
t.Errorf("an answer with an unknown key is refused (§780 reads it tolerantly): %v", err)
|
||||
}
|
||||
if _, err := DecodeAnswer([]byte(strings.Replace(string(raw), `"v":1`, `"v":2`, 1))); !errors.Is(err, ErrUnknownVersion) {
|
||||
t.Errorf("an answer at another version read as %v", err)
|
||||
|
||||
Reference in New Issue
Block a user