The node-engine seat's read verb converged (ADR 0683, design 33 control-verbs §10)

The holder of node-packet-filter refuses allow and disallow on an adopted node
and never assumes converged, so it asks the node-engine the node's convergence
state: adopted or converged, since when, and the found firewall's kind when
adopted. The composition answer gains withheld-parts, each part a compose kept
because its read did not answer, with why: the filter's node-packet-filter.allowed.
Packages generated again by seatgen (seatgen -check clean).

Builds: design 33 control-verbs §10; design 08 control-verbs §4; ADR 0683; H-A-316, H-A-321
This commit is contained in:
2026-11-21 21:02:53 +01:00
parent 87eab81be1
commit efcef83cf4
6 changed files with 181 additions and 25 deletions
+32 -1
View File
@@ -33,6 +33,7 @@ const (
VerbFirstViewAgain = "first-view-again"
VerbEntryAgain = "entry-again"
VerbProcessBuilds = "process-builds"
VerbConverged = "converged"
)
const (
@@ -48,7 +49,7 @@ const (
// Verbs is every verb the seat serves, in its definition's order: a new copy each call.
func Verbs() []string {
return []string{VerbHandOver, VerbAccessAct, VerbJudgeDirectories, VerbSetuidSearch, VerbRootFree, VerbActs, VerbPackages, VerbComposition, VerbCompose, VerbComposeCandidate, VerbManifestReads, VerbApplyOrder, VerbSeatList, VerbSeatListAgain, VerbFirstViews, VerbFirstViewAgain, VerbEntryAgain, VerbProcessBuilds}
return []string{VerbHandOver, VerbAccessAct, VerbJudgeDirectories, VerbSetuidSearch, VerbRootFree, VerbActs, VerbPackages, VerbComposition, VerbCompose, VerbComposeCandidate, VerbManifestReads, VerbApplyOrder, VerbSeatList, VerbSeatListAgain, VerbFirstViews, VerbFirstViewAgain, VerbEntryAgain, VerbProcessBuilds, VerbConverged}
}
// Events is every event published on the seat's subject: a new copy each call.
@@ -1296,6 +1297,14 @@ type CompositionAnswerWithheldItem struct {
Why string `json:"why"`
}
// CompositionAnswerWithheldPartsItem is a type of the contract.
type CompositionAnswerWithheldPartsItem struct {
// the read asked, as <seat>.<verb>
Part string `json:"part"`
// why it did not answer, naming the holder asked
Why string `json:"why"`
}
// CompositionAnswer is what composition answers.
type CompositionAnswer struct {
// the module's last apply that did not end running; absent when none
@@ -1323,6 +1332,8 @@ type CompositionAnswer struct {
Want *CompositionAnswerWant `json:"want,omitempty"`
// the module's marked subjects the grants part withholds from this node's runtime, each with why, read through mesh-grants' verb withheld (design 46 approval mark 6)
Withheld []CompositionAnswerWithheldItem `json:"withheld,omitempty"`
// each part a compose kept because its read did not answer, with why (design 08 control-verbs §4, H-A-321): for the packet filter's holder the part node-packet-filter.allowed, its filter file kept as it runs
WithheldParts []CompositionAnswerWithheldPartsItem `json:"withheld-parts,omitempty"`
// withheld unknown: the grants part does not answer, when its verb withheld did not answer
WithheldUnknown string `json:"withheld-unknown,omitempty"`
}
@@ -1568,6 +1579,26 @@ type ProcessBuildsInput struct {
// ProcessBuildsAnswer is what process-builds answers.
type ProcessBuildsAnswer = ProcessBuilds
// ConvergedInput is what converged takes.
type ConvergedInput struct {
}
// ConvergedAnswer is what converged answers.
type ConvergedAnswer struct {
// the kind of the firewall found, for an adopted node
Found string `json:"found,omitempty"`
// when the node became so, RFC 3339; absent where the engine recorded no time for it
Since string `json:"since,omitempty"`
// the node's mode: adopted (the found firewall's terms) or converged (the mesh's own filter)
State string `json:"state"`
}
// The values of ConvergedAnswer's state.
const (
ConvergedAnswerStateAdopted = "adopted"
ConvergedAnswerStateConverged = "converged"
)
// AskedEvent is the body of the event asked.
type AskedEvent = ActSaid
+6
View File
@@ -129,6 +129,12 @@ func TestFixtures(t *testing.T) {
decode: func(b []byte) (any, error) { var v CompositionAnswer; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
{name: "apply-order answers the changed wants in the order they are applied, with why and what each waits on", subject: "", given: "{\"order\":[{\"module\":\"mesh-broker\",\"position\":1,\"waits\":[],\"why\":\"the bus module is applied first\"},{\"module\":\"mesh-delivery-view\",\"pipeline\":\"main.2\",\"position\":2,\"rank\":2,\"waits\":[\"mesh-delivery-indexer\"],\"why\":\"rank 2 of main.2, after rank 1\"}]}", wire: "{\"order\":[{\"module\":\"mesh-broker\",\"position\":1,\"waits\":[],\"why\":\"the bus module is applied first\"},{\"module\":\"mesh-delivery-view\",\"pipeline\":\"main.2\",\"position\":2,\"rank\":2,\"waits\":[\"mesh-delivery-indexer\"],\"why\":\"rank 2 of main.2, after rank 1\"}]}",
decode: func(b []byte) (any, error) { var v ApplyOrderAnswer; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
{name: "converged answers an adopted node with its found firewall", subject: "", given: "{\"found\":\"ufw\",\"since\":\"2026-10-02T09:00:00Z\",\"state\":\"adopted\"}", wire: "{\"found\":\"ufw\",\"since\":\"2026-10-02T09:00:00Z\",\"state\":\"adopted\"}",
decode: func(b []byte) (any, error) { var v ConvergedAnswer; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
{name: "converged answers a converged node since it converged", subject: "", given: "{\"since\":\"2026-11-21T19:00:00Z\",\"state\":\"converged\"}", wire: "{\"since\":\"2026-11-21T19:00:00Z\",\"state\":\"converged\"}",
decode: func(b []byte) (any, error) { var v ConvergedAnswer; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
{name: "composition names the filter part kept because allowed did not answer", subject: "", given: "{\"composition\":{\"key\":\"\"},\"judged\":{\"judgement\":\"\",\"waits_for_yes\":false,\"words\":\"\"},\"module\":\"nftables\",\"node\":\"desk\",\"started\":true,\"withheld-parts\":[{\"part\":\"node-packet-filter.allowed\",\"why\":\"asked of the seat node-packet-filter's verb allowed on desk, which did not answer within 10s\"}]}", wire: "{\"composition\":{\"key\":\"\"},\"judged\":{\"judgement\":\"\",\"waits_for_yes\":false,\"words\":\"\"},\"module\":\"nftables\",\"node\":\"desk\",\"started\":true,\"withheld-parts\":[{\"part\":\"node-packet-filter.allowed\",\"why\":\"asked of the seat node-packet-filter's verb allowed on desk, which did not answer within 10s\"}]}",
decode: func(b []byte) (any, error) { var v CompositionAnswer; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
}
for _, c := range cases {
v, err := c.decode([]byte(c.given))