Raise the declaration's Version to 2 for drain-bound; manifests state the Version read and written

Version is the declaration's form: drain-bound raises it by one, and a
node-engine refuses only a higher one, so it still takes what a composer
of version 1 writes. A manifest says declaration-reads (the node-engine's)
and declaration-writes (the composer's), so the delivery plan can order
the writer of a Version after every engine that reads it.

Builds: design 47 H2 §813 (12), H-A-388 (2), H-A-358
This commit is contained in:
2026-11-22 00:19:52 +01:00
parent 484e2bba3c
commit 134b111e3f
4 changed files with 30 additions and 6 deletions
+15 -1
View File
@@ -2,6 +2,7 @@ package declaration
import (
"errors"
"fmt"
"strings"
"testing"
)
@@ -92,9 +93,22 @@ func testAnUnknownVersionIsRefusedWhole(t *testing.T) {
{"id":"a","type":"directory","path":"/etc/mesh"}
]}`)
joined := strings.Join(refusal.Problems, "\n")
if !strings.Contains(joined, "99") || !strings.Contains(joined, "version 1") {
if !strings.Contains(joined, "99") || !strings.Contains(joined, "version 2") {
t.Errorf("the version mismatch was not stated plainly: %v", refusal.Problems)
}
// Design 47 H2 §813 (12), H-A-388: Version is the declaration's form, raised to 2 by drain-bound; a lower one is a
// part of this vocabulary and is read, so a node-engine that reads 2 takes what a composer of 1 still writes.
for _, v := range []int{1, Version} {
if _, err := Parse([]byte(fmt.Sprintf(`{"declaration":%d,"resources":[{"id":"a","type":"directory","path":"/etc/mesh"}]}`, v))); err != nil {
t.Errorf("a declaration of version %d was refused: %v", v, err)
}
}
if Version != 2 {
t.Errorf("the declaration's Version is %d, want 2 (H-A-388)", Version)
}
if r := refusalFor(t, `{"declaration":0,"resources":[]}`); !strings.Contains(strings.Join(r.Problems, " "), "version 0") {
t.Errorf("a declaration of version 0 was refused as %v", r.Problems)
}
// Nothing else is reported, because everything else assumes a vocabulary this host does
// not have — a list of complaints derived from the wrong grammar is noise.
if len(refusal.Problems) != 1 {