E5: answer the node-engine seat's composition-diff
The node-engine serves seat verbs and no tools bundle, so composed values read by resource are a read verb beside composition: per resource, the entries that differ between what runs and a revision or digest of its composition key, environment entries by name, a secret's value masked. Builds: design 47 H2 §813 (3); H-A-349 DQ-12b
This commit is contained in:
@@ -1949,6 +1949,29 @@ func TestTheNodesOwnCompositionIsAppliedWhenItDiffersAndARecordMoveWaitsForAYes(
|
||||
if _, err := b.ag.Composition(context.Background(), "db", "sha256:"+strings.Repeat("0", 64), false); err == nil {
|
||||
t.Error("a digest no revision has was answered")
|
||||
}
|
||||
// Design 47 H2 §813 (3): composition-diff answers, by resource, the entries that differ between what runs and the
|
||||
// revision asked, by its digest or its revision; a secret's value is masked, an environment entry named by its name.
|
||||
if d, err := b.ag.CompositionDiff(context.Background(), "db", 0, ddigMoved); err != nil || d.Running != ddig || d.Other == nil ||
|
||||
d.Other.Digest != ddigMoved || len(d.Resources) != 1 || d.Resources[0].Resource != "db.server" || len(d.Resources[0].Entries) != 1 ||
|
||||
d.Resources[0].Entries[0] != (nodeengine.CompositionDiffEntry{Name: "image", Running: "db@sha256:" + strings.Repeat("1", 64),
|
||||
Other: "db@sha256:" + strings.Repeat("7", 64)}) {
|
||||
t.Errorf("composition-diff of db's waiting revision reads %+v (%v)", d, err)
|
||||
}
|
||||
if d, err := b.ag.CompositionDiff(context.Background(), "db", int64(view.Revisions[0].Revision), ""); err != nil ||
|
||||
d.Other == nil || d.Other.Digest != ddig || len(d.Resources) != 0 {
|
||||
t.Errorf("composition-diff of db's running revision, by its revision, reads %+v (%v)", d, err)
|
||||
}
|
||||
if _, err := b.ag.CompositionDiff(context.Background(), "db", 0, ""); err == nil {
|
||||
t.Error("composition-diff with neither a revision nor a digest was answered")
|
||||
}
|
||||
if got := DiffResources([]json.RawMessage{json.RawMessage(`{"id":"web.key","type":"file","sealed":"a","content":"x"}`),
|
||||
json.RawMessage(`{"id":"web.run","type":"process","env":{"MODE":"a","GONE":"1"}}`)},
|
||||
[]json.RawMessage{json.RawMessage(`{"id":"web.key","type":"file","sealed":"b","content":"y"}`),
|
||||
json.RawMessage(`{"id":"web.run","type":"process","env":{"MODE":"b"}}`)}); len(got) != 2 ||
|
||||
!slices.Equal(got[0].Entries, []nodeengine.CompositionDiffEntry{{Name: "content", Masked: true}, {Name: "sealed", Masked: true}}) ||
|
||||
!slices.Equal(got[1].Entries, []nodeengine.CompositionDiffEntry{{Name: "env.GONE", Running: "1"}, {Name: "env.MODE", Running: "a", Other: "b"}}) {
|
||||
t.Errorf("the entries that differ, a secret masked, read %+v", got)
|
||||
}
|
||||
// Issue 774 (ace, 2026-11-04 01:29): the node's own revision shows its own fields, the provisioner client's account
|
||||
// and the adoption among them, and what the composer's last pass held.
|
||||
ownKey, ownRaw, ownDig := encodedAs(t, compositions.Composed{Node: node, Own: compositions.NodeOwn{Provisioner: "mesh-provisioner-client",
|
||||
|
||||
Reference in New Issue
Block a user