Providers and the provisioner client take the SDK that reads an ended assignment as a removed key (issue 1098)
mesh/repo-check head 68e3326d4cbc merged into trunk 44e7002d3c84 beside mesh-controller#378@b56c1d00 — pass: its merge-check.sh passed, each part in its to…
mesh/delivery-group group feat/chain-on-the-bus ready: every member ready, and composed together they pass
mesh/merge-gate head 68e3326d4cbc merged into trunk 44e7002d3c84 — pass: group feat/chain-on-the-bus composed: every machine composes with the change as it…
mesh/delivery superseded: a newer head of the same pull request

This commit is contained in:
2026-10-18 02:40:18 +02:00
parent 84af0ed180
commit 68e3326d4c
12 changed files with 40 additions and 47 deletions
@@ -14,6 +14,8 @@ import (
"github.com/nats-io/nats.go"
"github.com/nats-io/nats.go/jetstream"
"git.novox.be/novox/mesh-sdk/go/provider"
)
// The provisioner's client on one node (novox/hq ADR 0349 clauses 4 and 5, design 57 P5, issue 671).
@@ -447,7 +449,7 @@ func (c *Client) take(s *state, u update) []string {
case AssignmentsBucket:
// A value that is not a standing assignment (ended, or in a state: ADR 0408 clause 4) is read as a removed
// key, so the module leaves the machine as it does when the key goes (issue 1098).
gone = gone || !standingValue(e.Value())
gone = gone || !provider.Standing(e.Value())
// Whom it binds, whichever machine's it is: a provider here listing its consumers is filled again.
var providers []string
if takeBinds(s, key, e.Value(), gone) {
@@ -29,25 +29,6 @@ type Assignment struct {
Provisioning json.RawMessage `json:"provisioning,omitempty"`
}
// standingValue is whether an assignment's value is a standing assignment: neither `ended` (the module was taken off
// its node) nor `state` (a pending one) is set. A value that does not parse is not decided here: planOf refuses it.
func standingValue(value []byte) bool {
var v struct {
Ended json.RawMessage `json:"ended"`
State json.RawMessage `json:"state"`
}
if json.Unmarshal(value, &v) != nil {
return true
}
return !fieldSet(v.Ended) && !fieldSet(v.State)
}
// fieldSet is whether a field of an assignment's value carries something: not absent, null or empty.
func fieldSet(f json.RawMessage) bool {
s := strings.TrimSpace(string(f))
return s != "" && s != "null" && s != `""`
}
// Plan is one module's plan on this node.
type Plan struct {
Templates Templates `json:"templates"`