The switch exception skips the record hold only for a composition the controller judges unchanged; pin mesh-sdk d7a9b96 (issue 1906, ADR 0540 §9)
This commit is contained in:
@@ -3,7 +3,7 @@ module mesh-delivery-assigner
|
||||
go 1.26.0
|
||||
|
||||
require (
|
||||
git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261024183824-7f9cc0e55c37
|
||||
git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261024191714-d7a9b9688b76
|
||||
github.com/nats-io/nats-server/v2 v2.11.17
|
||||
github.com/nats-io/nats.go v1.54.0
|
||||
)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261024183824-7f9cc0e55c37 h1:OdAK+TTR/JQJu1WyNXgjursdIj8zStTXovRxbcf3h/s=
|
||||
git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261024183824-7f9cc0e55c37/go.mod h1:ouERNpZizzwZ0HLEtAypsY9FR20FyUgUYRni6J7kVCY=
|
||||
git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261024191714-d7a9b9688b76 h1:2Fw4O4C7CJitkY0qYHVHmLKaj4H8humeIQ1esHEbsFk=
|
||||
git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261024191714-d7a9b9688b76/go.mod h1:ouERNpZizzwZ0HLEtAypsY9FR20FyUgUYRni6J7kVCY=
|
||||
github.com/antithesishq/antithesis-sdk-go v0.7.0-default-no-op h1:Z/MZK75wC/NSrkgqeNIa7jexam9uWzhLmFTSCPI/kn0=
|
||||
github.com/antithesishq/antithesis-sdk-go v0.7.0-default-no-op/go.mod h1:FQyySiasQQM8735Ddel3MRojmy4dA1IqCeyJ5jmPMbI=
|
||||
github.com/google/go-tpm v0.9.8 h1:slArAR9Ft+1ybZu0lBwpSmpwhRXaa85hWtMinMyRAWo=
|
||||
|
||||
@@ -275,9 +275,10 @@ func (m Module) mustAsk(node string, before delivery.Want, had, ran bool, runnin
|
||||
return nil, false
|
||||
}
|
||||
// Right after the switch no node has a readable want, and a have from the old node-engine names a fingerprint and no composition
|
||||
// (ADR 0539 §9, §11): a node running this fingerprint is given its want at it with no hold, whatever the controller could not judge,
|
||||
// since the node agent applies nothing when the composition equals the declaration it kept. A new fingerprint still waits.
|
||||
if !had && ran && running == m.FP && haveNamesNoComposition {
|
||||
// (ADR 0539 §9, §11): a node running this fingerprint is given its want at it with no hold when the controller judges the composition
|
||||
// unchanged, equal to the declaration the node last applied (ADR 0540 §9), since the node agent then applies nothing. A composition that
|
||||
// differs from it (a changed setting or secret), or that the controller could not judge, waits for the ask. A new fingerprint still waits.
|
||||
if !had && ran && running == m.FP && haveNamesNoComposition && d.Judgement == delivery.JudgedUnchanged {
|
||||
return nil, false
|
||||
}
|
||||
// The fingerprint the bus ran before: its want's, or with no readable want the one its have names (ADR 0539 §15 bars a new one).
|
||||
@@ -288,7 +289,7 @@ func (m Module) mustAsk(node string, before delivery.Want, had, ran bool, runnin
|
||||
if catalogue.ProvidesBus(m.Manifest) && prev != m.FP {
|
||||
return nil, true // the bus is never moved by the assigner; the operator writes its want (§15)
|
||||
}
|
||||
if !m.recorded(d) || d.Judgement == delivery.JudgedNeither {
|
||||
if !m.recorded(d) || d.Judgement == delivery.JudgedNeither || d.Judgement == delivery.JudgedUnchanged {
|
||||
return nil, false
|
||||
}
|
||||
if m.Allowed != nil && m.Allowed(node, d.Digest) {
|
||||
|
||||
@@ -461,12 +461,17 @@ func TestAUserListOnlyRevisionOfTheBusIsWrittenAtOnceBeforeTheRecordHold(t *test
|
||||
// declaration it kept); a new fingerprint still waits for its ask.
|
||||
func TestAHaveFromBeforeTheSwitchGetsItsWantWithNoRecordHold(t *testing.T) {
|
||||
for name, bus := range map[string]bool{"a record module": false, "the bus": true} {
|
||||
// only a composition the controller judged unchanged (it equals the declaration the node last applied, ADR 0540 §9) skips the hold
|
||||
unchanged := func(node, fp string) (delivery.ComposedDigest, bool) {
|
||||
return delivery.ComposedDigest{Digest: dig(fp), Judgement: delivery.JudgedUnchanged}, true
|
||||
}
|
||||
m, n, _ := movingTo(delivery.JudgedCannot)
|
||||
recording(&m)
|
||||
m.Nodes = []string{"ace"}
|
||||
if bus {
|
||||
m.Manifest.Provides = []catalogue.Offer{{Name: "mesh-bus"}}
|
||||
}
|
||||
m.Composed = unchanged
|
||||
n.Haves["ace"]["mail"] = delivery.Have{FP: fNew, Phase: delivery.PhaseRunning, Health: delivery.HealthOK} // no composition named
|
||||
out := Wants(m, n, nil, nil)
|
||||
if w := out.Wants["ace"]; w.FP != fNew || w.Composed != dig(fNew) {
|
||||
@@ -475,9 +480,33 @@ func TestAHaveFromBeforeTheSwitchGetsItsWantWithNoRecordHold(t *testing.T) {
|
||||
if len(out.Record) != 0 {
|
||||
t.Errorf("%s: asked at the switch: %+v", name, out.Record)
|
||||
}
|
||||
// a composition that differs from the declaration the node kept (a changed setting or secret), and one the controller did not judge,
|
||||
// still wait for the ask
|
||||
for what, j := range map[string]delivery.Judgement{"differing": delivery.JudgedRecreates, "unjudged": delivery.JudgedCannot, "judged neither": delivery.JudgedNeither} {
|
||||
m2, n2, _ := movingTo(j)
|
||||
recording(&m2)
|
||||
m2.Nodes = []string{"ace"}
|
||||
if bus {
|
||||
m2.Manifest.Provides = []catalogue.Offer{{Name: "mesh-bus"}}
|
||||
}
|
||||
n2.Haves["ace"]["mail"] = delivery.Have{FP: fNew, Phase: delivery.PhaseRunning, Health: delivery.HealthOK}
|
||||
out := Wants(m2, n2, nil, nil)
|
||||
if j == delivery.JudgedNeither {
|
||||
if out.Wants["ace"].FP != fNew || len(out.Record) != 0 {
|
||||
t.Errorf("%s, %s: %+v", name, what, out)
|
||||
}
|
||||
continue
|
||||
}
|
||||
if w, ok := out.Wants["ace"]; ok || len(out.Record) == 0 {
|
||||
t.Errorf("%s, %s: written at the switch with no yes: %+v %+v", name, what, w, out.Record)
|
||||
}
|
||||
}
|
||||
// a have that names a composition is judged as before
|
||||
m.Composed = func(node, fp string) (delivery.ComposedDigest, bool) {
|
||||
return delivery.ComposedDigest{Digest: dig(fp), Judgement: delivery.JudgedRecreates, Against: dig(fOld), Words: "judged"}, true
|
||||
}
|
||||
n.Haves["ace"]["mail"] = delivery.Have{FP: fNew, Composed: dig(fOld), Phase: delivery.PhaseRunning, Health: delivery.HealthOK}
|
||||
if out := Wants(m, n, nil, nil); out.Wants["ace"].FP == fNew && !bus && len(out.Record) == 0 {
|
||||
if out := Wants(m, n, nil, nil); out.Wants["ace"].FP == fNew && len(out.Record) == 0 {
|
||||
t.Errorf("%s: a have naming a composition skipped the hold: %+v", name, out)
|
||||
}
|
||||
// a new fingerprint still asks (the bus is barred instead)
|
||||
|
||||
@@ -3,7 +3,7 @@ module mesh-delivery-view
|
||||
go 1.26.0
|
||||
|
||||
require (
|
||||
git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261024183824-7f9cc0e55c37
|
||||
git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261024191714-d7a9b9688b76
|
||||
github.com/nats-io/nats-server/v2 v2.11.17
|
||||
github.com/nats-io/nats.go v1.54.0
|
||||
)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261024183824-7f9cc0e55c37 h1:OdAK+TTR/JQJu1WyNXgjursdIj8zStTXovRxbcf3h/s=
|
||||
git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261024183824-7f9cc0e55c37/go.mod h1:ouERNpZizzwZ0HLEtAypsY9FR20FyUgUYRni6J7kVCY=
|
||||
git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261024191714-d7a9b9688b76 h1:2Fw4O4C7CJitkY0qYHVHmLKaj4H8humeIQ1esHEbsFk=
|
||||
git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261024191714-d7a9b9688b76/go.mod h1:ouERNpZizzwZ0HLEtAypsY9FR20FyUgUYRni6J7kVCY=
|
||||
github.com/antithesishq/antithesis-sdk-go v0.7.0-default-no-op h1:Z/MZK75wC/NSrkgqeNIa7jexam9uWzhLmFTSCPI/kn0=
|
||||
github.com/antithesishq/antithesis-sdk-go v0.7.0-default-no-op/go.mod h1:FQyySiasQQM8735Ddel3MRojmy4dA1IqCeyJ5jmPMbI=
|
||||
github.com/google/go-tpm v0.9.8 h1:slArAR9Ft+1ybZu0lBwpSmpwhRXaa85hWtMinMyRAWo=
|
||||
|
||||
@@ -3,7 +3,7 @@ module mesh-delivery-watchman
|
||||
go 1.26.0
|
||||
|
||||
require (
|
||||
git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261024183824-7f9cc0e55c37
|
||||
git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261024191714-d7a9b9688b76
|
||||
github.com/nats-io/nats-server/v2 v2.11.17
|
||||
github.com/nats-io/nats.go v1.54.0
|
||||
)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261024183824-7f9cc0e55c37 h1:OdAK+TTR/JQJu1WyNXgjursdIj8zStTXovRxbcf3h/s=
|
||||
git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261024183824-7f9cc0e55c37/go.mod h1:ouERNpZizzwZ0HLEtAypsY9FR20FyUgUYRni6J7kVCY=
|
||||
git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261024191714-d7a9b9688b76 h1:2Fw4O4C7CJitkY0qYHVHmLKaj4H8humeIQ1esHEbsFk=
|
||||
git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261024191714-d7a9b9688b76/go.mod h1:ouERNpZizzwZ0HLEtAypsY9FR20FyUgUYRni6J7kVCY=
|
||||
github.com/antithesishq/antithesis-sdk-go v0.8.0-default-no-op h1:1BOWQJweNyvZMlpAHXGLiZQn9S+QXGcz3xh94lC0w6E=
|
||||
github.com/antithesishq/antithesis-sdk-go v0.8.0-default-no-op/go.mod h1:FQyySiasQQM8735Ddel3MRojmy4dA1IqCeyJ5jmPMbI=
|
||||
github.com/google/go-tpm v0.9.8 h1:slArAR9Ft+1ybZu0lBwpSmpwhRXaa85hWtMinMyRAWo=
|
||||
|
||||
Reference in New Issue
Block a user