MH-1: the node-engine states that it reads a want by version; want-parts goes
The record's capabilities no longer hold want-parts; manifest-reads holds the word want:version, stated at the first reading and said by manifest-reads-changed. Builds: design 47 H §772, §764; H-A-45 Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
This commit is contained in:
@@ -368,13 +368,17 @@ func TestTheNodeKeyCarriesTheNodesFacts(t *testing.T) {
|
|||||||
t.Fatalf("the node key holds no record: %+v, %v", got, err)
|
t.Fatalf("the node key holds no record: %+v, %v", got, err)
|
||||||
}
|
}
|
||||||
wantRecord := nodeengine.NodeRecord{V: sdkkeys.Version, Node: "n1", TunnelKey: "tk", SealingKey: "sk", ServingKey: "pk",
|
wantRecord := nodeengine.NodeRecord{V: sdkkeys.Version, Node: "n1", TunnelKey: "tk", SealingKey: "sk", ServingKey: "pk",
|
||||||
Certificate: "cert", Trusts: keys.Trusts, Capabilities: []string{"apt", "bus-state-calls", "ledger-calls", "systemd", CapabilityWantParts}, OutwardLinks: []string{"eth0"}, NetworksSaid: true,
|
Certificate: "cert", Trusts: keys.Trusts, Capabilities: []string{"apt", "bus-state-calls", "ledger-calls", "systemd"}, OutwardLinks: []string{"eth0"}, NetworksSaid: true,
|
||||||
Networks: []nodeengine.AttachedNetwork{{Link: "eth0", Network: "192.0.2.0/24"}}, Contract: NodeKeyContract,
|
Networks: []nodeengine.AttachedNetwork{{Link: "eth0", Network: "192.0.2.0/24"}}, Contract: NodeKeyContract,
|
||||||
ManifestReads: catalogue.ManifestReads(), // what it reads of a manifest: its contract's (ADR 0614 §4)
|
ManifestReads: statedReads(), // what it reads of a manifest: its contract's (ADR 0614 §4) and that it reads a want by version (H §772)
|
||||||
RunnerCapabilities: []string{"bus-state-calls", "ledger-calls"}, RunnerFingerprint: "sha256:runner"}
|
RunnerCapabilities: []string{"bus-state-calls", "ledger-calls"}, RunnerFingerprint: "sha256:runner"}
|
||||||
if !nodeengineclient.SameNodeRecord(*got.Record, wantRecord) {
|
if !nodeengineclient.SameNodeRecord(*got.Record, wantRecord) {
|
||||||
t.Errorf("record = %+v, want %+v", *got.Record, wantRecord)
|
t.Errorf("record = %+v, want %+v", *got.Record, wantRecord)
|
||||||
}
|
}
|
||||||
|
// A node-engine of H1 reads a want by its version alone and says so in its manifest-reads, not in its capabilities (H §772, §764).
|
||||||
|
if !slices.Contains(got.Record.ManifestReads, nodeengine.ManifestReadWordWantVersion) || slices.Contains(got.Record.Capabilities, "want-parts") {
|
||||||
|
t.Errorf("the record states reads %v and capabilities %v, want the word want:version and no want-parts", got.Record.ManifestReads, got.Record.Capabilities)
|
||||||
|
}
|
||||||
// Among them, that it fills a seat's reach from the seat holder's listen (ADR 0632 §1).
|
// Among them, that it fills a seat's reach from the seat holder's listen (ADR 0632 §1).
|
||||||
// And the words and forms it builds (design 42 zfs-owns-zfs §4, answer A-13).
|
// And the words and forms it builds (design 42 zfs-owns-zfs §4, answer A-13).
|
||||||
for _, read := range []string{catalogue.ReadForm + catalogue.ReferenceFormSeatReach, "word:resources.if-config",
|
for _, read := range []string{catalogue.ReadForm + catalogue.ReferenceFormSeatReach, "word:resources.if-config",
|
||||||
@@ -401,7 +405,7 @@ func TestTheNodeKeyCarriesTheNodesFacts(t *testing.T) {
|
|||||||
}
|
}
|
||||||
l.statedErr, l.stated = nil, map[string]string{}
|
l.statedErr, l.stated = nil, map[string]string{}
|
||||||
q.SayFacts(context.Background(), rep)
|
q.SayFacts(context.Background(), rep)
|
||||||
if got, _ = nodeengineclient.DecodeHaveNode(l.kv["n1.node"].value); l.kv["n1.node"].rev != at+1 || !slices.Equal(got.Record.Capabilities, []string{"apt", "systemd", "want-parts"}) {
|
if got, _ = nodeengineclient.DecodeHaveNode(l.kv["n1.node"].value); l.kv["n1.node"].rev != at+1 || !slices.Equal(got.Record.Capabilities, []string{"apt", "systemd"}) {
|
||||||
t.Errorf("a runner stating no calls: revision %d (was %d), capabilities %v", l.kv["n1.node"].rev, at, got.Record.Capabilities)
|
t.Errorf("a runner stating no calls: revision %d (was %d), capabilities %v", l.kv["n1.node"].rev, at, got.Record.Capabilities)
|
||||||
}
|
}
|
||||||
at++
|
at++
|
||||||
@@ -447,7 +451,7 @@ func TestTheNodeKeyCarriesTheNodesFacts(t *testing.T) {
|
|||||||
}
|
}
|
||||||
catalogue.UseSeats(all)
|
catalogue.UseSeats(all)
|
||||||
q.RestateReads(context.Background())
|
q.RestateReads(context.Background())
|
||||||
if got, _ = nodeengineclient.DecodeHaveNode(l.kv["n1.node"].value); !slices.Equal(got.Record.ManifestReads, catalogue.ManifestReads()) {
|
if got, _ = nodeengineclient.DecodeHaveNode(l.kv["n1.node"].value); !slices.Equal(got.Record.ManifestReads, statedReads()) {
|
||||||
t.Errorf("the list back whole: the record states %v, want its contract's", got.Record.ManifestReads)
|
t.Errorf("the list back whole: the record states %v, want its contract's", got.Record.ManifestReads)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1045,3 +1049,8 @@ func slicesIndex(rs []ResourceHealth, id string) int {
|
|||||||
}
|
}
|
||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// statedReads is the contract's reads with the word that the engine reads a want by its version (design 47 H §772).
|
||||||
|
func statedReads() []string {
|
||||||
|
return slices.Sorted(slices.Values(append(catalogue.ManifestReads(), nodeengine.ManifestReadWordWantVersion)))
|
||||||
|
}
|
||||||
|
|||||||
@@ -40,16 +40,13 @@ type RecordKeys struct {
|
|||||||
|
|
||||||
// buildReads are the words and forms this engine reads of a manifest (novox/hq ADR 0614 §4): the reader capabilities of
|
// buildReads are the words and forms this engine reads of a manifest (novox/hq ADR 0614 §4): the reader capabilities of
|
||||||
// the mesh-sdk it is built with, its seats left out. Computed once: they are the build's, and never change while it runs.
|
// the mesh-sdk it is built with, its seats left out. Computed once: they are the build's, and never change while it runs.
|
||||||
// CapabilityWantParts is the capability a node-engine states in its node record when it reads the want's version, parts and
|
|
||||||
// kept-on (design 47 G §525); the assigner writes them into a node's want only while the record states it.
|
|
||||||
const CapabilityWantParts = "want-parts"
|
|
||||||
|
|
||||||
var buildReads = sync.OnceValue(func() []string {
|
var buildReads = sync.OnceValue(func() []string {
|
||||||
return slices.DeleteFunc(catalogue.ManifestReads(), func(r string) bool { return strings.HasPrefix(r, catalogue.ReadSeat) })
|
return slices.DeleteFunc(catalogue.ManifestReads(), func(r string) bool { return strings.HasPrefix(r, catalogue.ReadSeat) })
|
||||||
})
|
})
|
||||||
|
|
||||||
// readsNow is what this engine reads of a manifest now: its build's words and forms, and the seats of the seat list it
|
// readsNow is what this engine reads of a manifest now: its build's words and forms, the word that it reads a want by its
|
||||||
// holds now (catalogue.Seats, which the engine's reader of the list gives catalogue: bootstrapped or read; ADR 0636).
|
// version alone (nodeengine.ManifestReadWordWantVersion; design 47 H §772, H-A-45, said by the event manifest-reads-changed,
|
||||||
|
// never in the capabilities), and the seats of the seat list it holds now (catalogue.Seats, which the engine's reader of the list gives catalogue: bootstrapped or read; ADR 0636).
|
||||||
func readsNow() []string {
|
func readsNow() []string {
|
||||||
set := map[string]bool{}
|
set := map[string]bool{}
|
||||||
for _, r := range buildReads() {
|
for _, r := range buildReads() {
|
||||||
@@ -59,6 +56,7 @@ func readsNow() []string {
|
|||||||
set[catalogue.ReadSeat+seat.Name] = true
|
set[catalogue.ReadSeat+seat.Name] = true
|
||||||
}
|
}
|
||||||
out := make([]string, 0, len(set))
|
out := make([]string, 0, len(set))
|
||||||
|
set[nodeengine.ManifestReadWordWantVersion] = true
|
||||||
for r := range set {
|
for r := range set {
|
||||||
out = append(out, r)
|
out = append(out, r)
|
||||||
}
|
}
|
||||||
@@ -132,8 +130,6 @@ func recordOf(node string, r Report, keys RecordKeys) *nodeengine.NodeRecord {
|
|||||||
rec.Capabilities = append(rec.Capabilities, c.Name)
|
rec.Capabilities = append(rec.Capabilities, c.Name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// A node-engine of G states that it reads the want's new fields: version, parts and where a kept build is kept (design 47 G §525).
|
|
||||||
rec.Capabilities = append(rec.Capabilities, CapabilityWantParts)
|
|
||||||
for _, c := range keys.Stated {
|
for _, c := range keys.Stated {
|
||||||
if c != "" && !slices.Contains(rec.Capabilities, c) {
|
if c != "" && !slices.Contains(rec.Capabilities, c) {
|
||||||
rec.Capabilities = append(rec.Capabilities, c)
|
rec.Capabilities = append(rec.Capabilities, c)
|
||||||
|
|||||||
Reference in New Issue
Block a user