From bb2140c236a59a5585ac6e9f0d1212cf243e5638 Mon Sep 17 00:00:00 2001 From: jochen Date: Thu, 5 Nov 2026 15:43:25 +0100 Subject: [PATCH] =?UTF-8?q?Module=20assigner=20client:=20the=20operations?= =?UTF-8?q?=20of=20a=20proposal's=20change=20and=20the=20states=20of=20an?= =?UTF-8?q?=20open=20proposal,=20for=20its=20holder=20and=20for=20the=20en?= =?UTF-8?q?rolment=20that=20builds=20add-node=20(B7f=20finding=204;=20ADR?= =?UTF-8?q?=200634=20=C2=A74;=20issue=201966)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Claude-Session: https://claude.ai/code/session_01NcbgfFSnn24M3GcqttoU7i --- .../clients/meshmoduleassignerclient/ops.go | 39 +++++++++++++++++++ .../meshmoduleassignerclient/ops_test.go | 14 +++++++ 2 files changed, 53 insertions(+) create mode 100644 placement/go/clients/meshmoduleassignerclient/ops.go create mode 100644 placement/go/clients/meshmoduleassignerclient/ops_test.go diff --git a/placement/go/clients/meshmoduleassignerclient/ops.go b/placement/go/clients/meshmoduleassignerclient/ops.go new file mode 100644 index 0000000..0c85902 --- /dev/null +++ b/placement/go/clients/meshmoduleassignerclient/ops.go @@ -0,0 +1,39 @@ +package meshmoduleassignerclient + +// The operations a proposal's change names (novox/hq ADR 0567 §2), the words of a change's `op`. The seat's contract +// carries the field; its callers (the enrolment builds OpAddNode and OpRemoveNode) and its holder share the words here. +const ( + // OpPlace places a module on a node, with its host ports and bindings. + OpPlace = "place" + // OpTakeOff takes a module off a node. + OpTakeOff = "take-off" + // OpPin pins the provider of a provision on a node; OpUnpin removes a pin. + OpPin = "pin" + OpUnpin = "unpin" + // OpHold says a module placed on the node holds a seat; OpUnhold, that it holds it no more. + OpHold = "hold" + OpUnhold = "unhold" + // OpDecide sets a decided field of the node (NodeDecided by its JSON name), its address among them. + OpDecide = "decide" + // OpConfig sets a module's config placement or values on the node. + OpConfig = "config" + // OpSeed is the node's whole placement: the take-over (adopt, §7), never given by a caller. + OpSeed = "seed" + // OpAddNode adds a joining node with its decided fields and the public halves of its keys, on the warrant of the + // enrolment that issued its token (novox/hq ADR 0587 §7): the enroller's alone, the proposal's one change. + OpAddNode = "add-node" + // OpRemoveNode takes a joining node off placement again when its enrolment ends unconfirmed, revoked or expired: the + // enroller's alone, on the same warrant, the proposal's one change, of a node with no module and no holding. + OpRemoveNode = "remove-node" +) + +// The states of an open proposal (the field `state` of the state `proposals`). +const ( + // ProposalAnswering: its candidates are written and the nodes it must hear from have not all answered. + ProposalAnswering = "answering" + // ProposalFailed: its verdict failed; it stays open, for its proposer to read and withdraw, or for a node's later + // answer to judge it again. + ProposalFailed = "failed" + // ProposalAsked: its verdict passed and the operator is asked to approve it. + ProposalAsked = "asked" +) diff --git a/placement/go/clients/meshmoduleassignerclient/ops_test.go b/placement/go/clients/meshmoduleassignerclient/ops_test.go new file mode 100644 index 0000000..d935baa --- /dev/null +++ b/placement/go/clients/meshmoduleassignerclient/ops_test.go @@ -0,0 +1,14 @@ +package meshmoduleassignerclient + +import "testing" + +// The words are the wire's: a holder and a caller that spell one differently refuse each other's proposals. +func TestOpsAndProposalStatesAreTheWire(t *testing.T) { + for got, want := range map[string]string{OpPlace: "place", OpTakeOff: "take-off", OpPin: "pin", OpUnpin: "unpin", OpHold: "hold", + OpUnhold: "unhold", OpDecide: "decide", OpConfig: "config", OpSeed: "seed", OpAddNode: "add-node", OpRemoveNode: "remove-node", + ProposalAnswering: "answering", ProposalFailed: "failed", ProposalAsked: "asked"} { + if got != want { + t.Errorf("%q, want %q", got, want) + } + } +}