Merge pull request 'Design 47 H1: the seat definitions' source (checker gone, callers API gone, mesh-wants and runner forms)' (#17) from feat/47-H1-seats into main

This commit was merged in pull request #17.
This commit is contained in:
2026-11-20 07:12:49 +00:00
29 changed files with 226 additions and 518 deletions
+6
View File
@@ -358,6 +358,12 @@
"chunks": {
"type": "boolean",
"description": "the holder's process sends the answer's file in chunks on mesh.seat.<seat>.chunk.<verb>.<call>.<n>, each acknowledged by the caller on mesh.seat.<seat>.ack.<verb>.<call>.<n>; only with by-caller (design 47 G 681)"
},
"timeout": {
"type": "integer",
"minimum": 1,
"maximum": 600,
"description": "the most whole seconds a caller and the serving tool runner wait for the verb's answer; absent, the tool runner's own call-timeout (design 47 H 760, H-A-43)"
}
}
},
-83
View File
@@ -1,83 +0,0 @@
// Package meshconfigclient is the logic every reader of the seat mesh-config's state kept shares (novox/hq ADR 0565
// clause 5, ADR 0634 §4): the checker and the assigner's composition check lay a pull request's own held values over its
// modules' values. The layout of a value is the seat's contract's; this holds what the readers share over it: a pull
// request's key, a held value's key and the rule that a value is the one its key names.
package meshconfigclient
import (
"encoding/json"
"fmt"
"strings"
seat "git.novox.be/novox/mesh-contracts/go/seats/meshconfig"
)
// PullKey is a pull request's key, `owner/repository#number` with `/` and `#` as dots, the form the seat keeps a pull
// request's values under. The three parts hold no dot, star, angle bracket or space.
func PullKey(pull string) (string, error) {
owner, repository, number, err := splitPull(pull)
if err != nil {
return "", err
}
return owner + "." + repository + "." + number, nil
}
func splitPull(pull string) (owner, repository, number string, err error) {
owner, rest, ok := strings.Cut(strings.TrimSpace(pull), "/")
repository, number, ok2 := strings.Cut(rest, "#")
if !ok || !ok2 || owner == "" || repository == "" || number == "" || strings.ContainsAny(owner+repository+number, ".*> ") {
return "", "", "", fmt.Errorf("meshconfig: %q is not a pull request, owner/repository#number", pull)
}
return owner, repository, number, nil
}
// HeldValueKey is a held value's key in the state kept: the pull request's key, the node, the module and the config key,
// joined by dots.
func HeldValueKey(pull, node, module, key string) (string, error) {
owner, repository, number, err := splitPull(pull)
if err != nil {
return "", err
}
if node == "" || module == "" || key == "" {
return "", fmt.Errorf("meshconfig: a held value names a node, a module and a key")
}
return seat.KeptByOwnerRepositoryNumberNodeModuleKeyKey(owner, repository, number, node, module, key), nil
}
// Kept is one held value, as the seat types it.
type Kept = seat.KeptByOwnerRepositoryNumberNodeModuleKeyValue
// CheckKept refuses a held value that names no pull request, head, declaration, node, module or key.
func CheckKept(v Kept) error {
if _, err := PullKey(v.Pull); err != nil {
return err
}
if v.Head == "" || v.Declaration == "" || v.Node == "" || v.Module == "" || v.Key == "" {
return fmt.Errorf("meshconfig: a held value of %s names a head, a declaration, a node, a module and a key", v.Pull)
}
return nil
}
// DecodeKept reads a value of the state kept under its key: the value the seat types, checked, and the one its key
// names. A value kept under another key than its own fields make is refused, so a reader never lays a value over the
// wrong pull request or module.
func DecodeKept(key string, raw []byte) (Kept, error) {
v, err := seat.DecodeKeptByOwnerRepositoryNumberNodeModuleKeyValue(raw)
if err != nil {
return Kept{}, fmt.Errorf("meshconfig: the held value %s is not one: %w", key, err)
}
if err := CheckKept(v); err != nil {
return Kept{}, err
}
want, err := HeldValueKey(v.Pull, v.Node, v.Module, v.Key)
if err != nil {
return Kept{}, err
}
if want != key {
return Kept{}, fmt.Errorf("meshconfig: the held value kept under %s names %s", key, want)
}
return v, nil
}
// ValueOf is the value held, as the operator approved it, in its JSON form.
func ValueOf(v Kept) (json.RawMessage, error) { return json.Marshal(v.Value) }
@@ -1,45 +0,0 @@
package meshconfigclient
import (
"strings"
"testing"
)
// The keys are the earlier form of go/delivery's HeldValueKey and ConfigCandidateKey (golden), which the holder writes.
func TestKeysAreTheEarlierForm(t *testing.T) {
if k, err := HeldValueKey("novox/mesh-catalog#42", "novox", "mail", "quota"); k != "novox.mesh-catalog.42.novox.mail.quota" || err != nil {
t.Errorf("a held value's key is %q, %v", k, err)
}
for pull, want := range map[string]string{"novox/mesh-catalog#42": "novox.mesh-catalog.42", "x#1": "", "a/b": "", "a/b.c#1": ""} {
if got, err := PullKey(pull); got != want || (want == "") != (err != nil) {
t.Errorf("%s keyed %q, %v", pull, got, err)
}
}
if _, err := HeldValueKey("novox/mesh-catalog#42", "", "mail", "quota"); err == nil {
t.Error("a held value without a node was keyed")
}
}
const held = `{"pull":"novox/mesh-catalog#434","head":"abc1234def","declaration":"sha256:3a7b","node":"ace","module":"n8n","key":"media-gid","value":2000,"by":"the operator","approved":"operator@telegram","at":"2026-11-05T12:30:00Z"}`
func TestAHeldValueIsTheOneItsKeyNames(t *testing.T) {
key := "novox.mesh-catalog.434.ace.n8n.media-gid"
v, err := DecodeKept(key, []byte(held))
if err != nil || v.Node != "ace" || v.Value != float64(2000) {
t.Fatalf("read %+v, %v", v, err)
}
if raw, err := ValueOf(v); err != nil || string(raw) != "2000" {
t.Errorf("the value is %s, %v", raw, err)
}
for name, c := range map[string]struct{ key, raw string }{
"another pull request's key": {"novox.mesh-catalog.435.ace.n8n.media-gid", held},
"another module's key": {"novox.mesh-catalog.434.ace.plex.media-gid", held},
"no head": {key, strings.Replace(held, `"head":"abc1234def",`, "", 1)},
"a field it does not know": {key, strings.Replace(held, `"by"`, `"extra":1,"by"`, 1)},
"a pull that is not one": {key, strings.Replace(held, "novox/mesh-catalog#434", "novox", 1)},
} {
if _, err := DecodeKept(c.key, []byte(c.raw)); err == nil {
t.Errorf("%s was read", name)
}
}
}
-5
View File
@@ -1,5 +0,0 @@
module git.novox.be/novox/mesh-contracts/go/clients/meshconfigclient
go 1.26.0
require git.novox.be/novox/mesh-contracts/go/seats/meshconfig v0.0.0-00010101000000-000000000000
-86
View File
@@ -8,7 +8,6 @@ import (
"encoding/json"
"errors"
"strings"
"time"
)
// Seat is the seat's name.
@@ -48,7 +47,6 @@ func HolderSubjectRetired(holder string) string { return "mesh.stream." + holder
const (
StateResolved = "resolved"
StateKept = "kept"
)
// ResolvedByNodeModuleKeyKey is the key of one value of the state resolved under the form "<node>.<module>.<key>".
@@ -94,64 +92,6 @@ func DecodeResolvedByNodeModuleKeyValue(raw []byte) (ResolvedByNodeModuleKeyValu
return v, nil
}
// KeptByOwnerRepositoryNumberNodeModuleKeyKey is the key of one value of the state kept under the form "<owner>.<repository>.<number>.<node>.<module>.<key>".
func KeptByOwnerRepositoryNumberNodeModuleKeyKey(owner, repository, number, node, module, key string) string {
return owner + "." + repository + "." + number + "." + node + "." + module + "." + key
}
// ParseKeptByOwnerRepositoryNumberNodeModuleKeyKey reads the parts of a key of the form "<owner>.<repository>.<number>.<node>.<module>.<key>", in the order of the form; the last result is false for a key of another form.
func ParseKeptByOwnerRepositoryNumberNodeModuleKeyKey(key string) (string, string, string, string, string, string, bool) {
rest := key
v0, after0, found0 := strings.Cut(rest, ".")
if !found0 || v0 == "" {
return "", "", "", "", "", "", false
}
rest = after0
v2, after2, found2 := strings.Cut(rest, ".")
if !found2 || v2 == "" {
return "", "", "", "", "", "", false
}
rest = after2
v4, after4, found4 := strings.Cut(rest, ".")
if !found4 || v4 == "" {
return "", "", "", "", "", "", false
}
rest = after4
v6, after6, found6 := strings.Cut(rest, ".")
if !found6 || v6 == "" {
return "", "", "", "", "", "", false
}
rest = after6
v8, after8, found8 := strings.Cut(rest, ".")
if !found8 || v8 == "" {
return "", "", "", "", "", "", false
}
rest = after8
if rest == "" {
return "", "", "", "", "", "", false
}
v10 := rest
rest = ""
if rest != "" {
return "", "", "", "", "", "", false
}
return v0, v2, v4, v6, v8, v10, true
}
// DecodeKeptByOwnerRepositoryNumberNodeModuleKeyValue reads one value of the state kept under the form "<owner>.<repository>.<number>.<node>.<module>.<key>", refusing a field KeptByOwnerRepositoryNumberNodeModuleKeyValue does not know and any text after the value.
func DecodeKeptByOwnerRepositoryNumberNodeModuleKeyValue(raw []byte) (KeptByOwnerRepositoryNumberNodeModuleKeyValue, error) {
var v KeptByOwnerRepositoryNumberNodeModuleKeyValue
dec := json.NewDecoder(bytes.NewReader(raw))
dec.DisallowUnknownFields()
if err := dec.Decode(&v); err != nil {
return v, err
}
if dec.More() {
return v, errors.New("text after the value")
}
return v, nil
}
// ConfigInput is what config takes.
type ConfigInput struct {
// list (when not given), set, clear or history
@@ -257,29 +197,3 @@ type ResolvedByNodeModuleKeyValue struct {
Trusted bool `json:"trusted,omitempty"`
Value any `json:"value,omitempty"`
}
// KeptByOwnerRepositoryNumberNodeModuleKeyValue is one value of the state kept under the key <owner>.<repository>.<number>.<node>.<module>.<key>.
type KeptByOwnerRepositoryNumberNodeModuleKeyValue struct {
// who approved it, as the proposal kept it
Approved string `json:"approved,omitempty"`
// when it was kept
At *time.Time `json:"at,omitempty"`
By string `json:"by,omitempty"`
// the digest of what the declaration holds the value to; the value stays only while it is the same
Declaration string `json:"declaration"`
// the head the declaration was read at
Head string `json:"head"`
// the config key
Key string `json:"key"`
Module string `json:"module"`
Node string `json:"node"`
// the proposal's id
Proposal string `json:"proposal,omitempty"`
// the pull request, owner/repository#number
Pull string `json:"pull"`
// the value held, as the operator approved it
Value any `json:"value"`
// where the value was proposed from
Via string `json:"via,omitempty"`
Why string `json:"why,omitempty"`
}
-6
View File
@@ -37,12 +37,6 @@ func TestFixtures(t *testing.T) {
err := json.Unmarshal(b, &v)
return v, err
}, subjectIs: nil},
{name: "a held value, as mesh-config writes it (the holder's own test values)", subject: "", given: "{\"approved\":\"operator@telegram\",\"at\":\"2026-11-05T12:30:00Z\",\"by\":\"the operator\",\"declaration\":\"sha256:3a7bd3e2360a3d29eea436fcfb7e44c735d117c42d1c1835420b6b9942dd4f1b\",\"head\":\"abc1234def\",\"key\":\"media-gid\",\"module\":\"n8n\",\"node\":\"ace\",\"proposal\":\"p-1\",\"pull\":\"novox/mesh-catalog#434\",\"value\":2000,\"via\":\"telegram\",\"why\":\"the group the media share is owned by\"}", wire: "{\"approved\":\"operator@telegram\",\"at\":\"2026-11-05T12:30:00Z\",\"by\":\"the operator\",\"declaration\":\"sha256:3a7bd3e2360a3d29eea436fcfb7e44c735d117c42d1c1835420b6b9942dd4f1b\",\"head\":\"abc1234def\",\"key\":\"media-gid\",\"module\":\"n8n\",\"node\":\"ace\",\"proposal\":\"p-1\",\"pull\":\"novox/mesh-catalog#434\",\"value\":2000,\"via\":\"telegram\",\"why\":\"the group the media share is owned by\"}",
decode: func(b []byte) (any, error) {
var v KeptByOwnerRepositoryNumberNodeModuleKeyValue
err := json.Unmarshal(b, &v)
return v, err
}, subjectIs: nil},
{name: "renames answers the open windows", subject: "", given: "{\"renames\":[{\"at\":\"2026-11-04T12:00:00Z\",\"from\":\"old-key\",\"module\":\"messenger\",\"open\":[\"g14\"],\"to\":\"new-key\"}]}", wire: "{\"renames\":[{\"at\":\"2026-11-04T12:00:00Z\",\"from\":\"old-key\",\"module\":\"messenger\",\"open\":[\"g14\"],\"to\":\"new-key\"}]}",
decode: func(b []byte) (any, error) { var v RenamesAnswer; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
}
+5 -3
View File
@@ -412,8 +412,10 @@ type Holding struct {
// ModulePlacement is the nodes that run a module from one watched branch.
type ModulePlacement struct {
Branch string `json:"branch"`
Nodes []string `json:"nodes"`
Branch string `json:"branch"`
// the fingerprint of the build these nodes run from the branch; absent, the newest delivered of the branch (design 47 H 750, H-A-39): one row per branch and build
Build string `json:"build,omitempty"`
Nodes []string `json:"nodes"`
}
// NodeDecided is what a person decides of a node; no secret and no key material.
@@ -647,7 +649,7 @@ type PlacementInput struct {
// PlacementAnswer is what placement answers.
type PlacementAnswer struct {
// one per branch, the nodes that run the module from it
// one per branch and build, the nodes that run the module from it
Placements []ModulePlacement `json:"placements"`
}
@@ -79,6 +79,8 @@ func TestFixtures(t *testing.T) {
err := json.Unmarshal(b, &v)
return v, err
}, subjectIs: nil},
{name: "placement answers a row per branch and build, the build beside the branch", subject: "", given: "{\"placements\":[{\"branch\":\"main\",\"build\":\"0123456789ab\",\"nodes\":[\"workstation\"]},{\"branch\":\"main\",\"nodes\":[\"laptop\"]}]}", wire: "{\"placements\":[{\"branch\":\"main\",\"build\":\"0123456789ab\",\"nodes\":[\"workstation\"]},{\"branch\":\"main\",\"nodes\":[\"laptop\"]}]}",
decode: func(b []byte) (any, error) { var v PlacementAnswer; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
}
for _, c := range cases {
v, err := c.decode([]byte(c.given))
+38 -2
View File
@@ -26,6 +26,7 @@ const (
VerbCompose = "compose"
VerbComposeCandidate = "compose-candidate"
VerbManifestReads = "manifest-reads"
VerbApplyOrder = "apply-order"
VerbSeatList = "seat-list"
VerbSeatListAgain = "seat-list-again"
VerbFirstViews = "first-views"
@@ -47,7 +48,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, 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}
}
// Events is every event published on the seat's subject: a new copy each call.
@@ -705,6 +706,14 @@ type LoginFallback struct {
Why string `json:"why"`
}
// ManifestReadWord is the word a node-engine states in manifest-reads when it reads a want by version and not by digests (design 47 H 772, H-A-45); the assigner holds a node whose engine does not state it. Other words in manifest-reads are free.
type ManifestReadWord = string
// The values of ManifestReadWord.
const (
ManifestReadWordWantVersion = "want:version"
)
// ManifestReadsChanged is what a node-engine says when what it reads changed or its node returned (ADR 0618 §4).
type ManifestReadsChanged struct {
// when it says it, RFC 3339
@@ -1055,7 +1064,7 @@ type Wait struct {
// why it holds, such as restore point missing, entry-missing, parts-differ, node away or build no longer kept (design 47 G 541, 499)
Reason string `json:"reason,omitempty"`
Since time.Time `json:"since"`
// compose: a hold of the composition (a restore point missing, an entry missing, parts that differ, a recovery that waits); kept-build: waiting for a kept build (design 47 G 499, 541)
// compose: a hold of the composition (a restore point missing, an entry missing, parts that differ, a recovery that waits); kept-build: waiting for a kept build (design 47 G 499, 541); placing: a want of a higher rank held behind a lower one (design 47 H 771, H-A-67)
Step string `json:"step"`
// the wait said in words
Words string `json:"words,omitempty"`
@@ -1065,6 +1074,7 @@ type Wait struct {
const (
WaitStepCompose = "compose"
WaitStepKeptBuild = "kept-build"
WaitStepPlacing = "placing"
)
// HandOverInput is what hand-over takes.
@@ -1404,6 +1414,32 @@ type ManifestReadsAnswer struct {
V int64 `json:"v"`
}
// ApplyOrderInput is what apply-order takes.
type ApplyOrderInput struct {
}
// ApplyOrderAnswerOrderItem is a type of the contract.
type ApplyOrderAnswerOrderItem struct {
// the module whose want waits to be applied
Module string `json:"module"`
// the want's pipeline (its key); absent for a want in none
Pipeline string `json:"pipeline,omitempty"`
// its place in the order, the first applied being 1
Position int64 `json:"position"`
// the mover's tier in its pipeline; absent for a want in none
Rank int64 `json:"rank,omitempty"`
// the modules it waits on; empty when it waits for nothing
Waits []string `json:"waits"`
// why it stands there, in one sentence
Why string `json:"why"`
}
// ApplyOrderAnswer is what apply-order answers.
type ApplyOrderAnswer struct {
// one row per unapplied changed want, in the order it will be applied
Order []ApplyOrderAnswerOrderItem `json:"order"`
}
// SeatListInput is what seat-list takes.
type SeatListInput struct {
}
+2
View File
@@ -127,6 +127,8 @@ 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: "composition says withheld unknown when the grants part does not answer", subject: "", given: "{\"composition\":{\"key\":\"\"},\"judged\":{\"judgement\":\"\",\"waits_for_yes\":false,\"words\":\"\"},\"module\":\"zsh\",\"node\":\"workstation\",\"started\":false,\"withheld-unknown\":\"withheld unknown: the grants part does not answer\"}", wire: "{\"composition\":{\"key\":\"\"},\"judged\":{\"judgement\":\"\",\"waits_for_yes\":false,\"words\":\"\"},\"module\":\"zsh\",\"node\":\"workstation\",\"started\":false,\"withheld-unknown\":\"withheld unknown: the grants part does not answer\"}",
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},
}
for _, c := range cases {
v, err := c.decode([]byte(c.given))
@@ -46,11 +46,6 @@
"name": "withheld",
"description": "The marked subjects withheld from each module a node's runtime carries, and why: where its tool runner does not state approval-mark/1, or its reading is not the running runner's (design 46 approval mark 6).",
"class": "read",
"callers": [
"seat:node-engine",
"persons",
"operator"
],
"input": {
"type": "object",
"properties": {
-8
View File
@@ -4,14 +4,6 @@
"slug": "contracts",
"build": {
"artifacts": [
{
"name": "go-meshconfigclient",
"kind": "package",
"language": "go",
"paths": [
"go/clients/meshconfigclient"
]
},
{
"name": "go-nodeengineclient",
"kind": "package",
@@ -15,12 +15,11 @@ import (
const Seat = "operator-channel"
const (
VerbOpen = "open"
VerbHistory = "history"
VerbNotify = "notify"
VerbTell = "tell"
VerbAsks = "asks"
VerbAskAgain = "ask-again"
VerbOpen = "open"
VerbHistory = "history"
VerbNotify = "notify"
VerbTell = "tell"
VerbAsks = "asks"
)
const (
@@ -35,7 +34,7 @@ const (
// Verbs is every verb the seat serves, in its definition's order: a new copy each call.
func Verbs() []string {
return []string{VerbOpen, VerbHistory, VerbNotify, VerbTell, VerbAsks, VerbAskAgain}
return []string{VerbOpen, VerbHistory, VerbNotify, VerbTell, VerbAsks}
}
// Events is every event published on the seat's subject: a new copy each call.
@@ -436,17 +435,15 @@ type AsksInput struct {
Key string `json:"key,omitempty"`
// only the asks opened at or after this time, RFC 3339
Since string `json:"since,omitempty"`
// open (open, held and held-back), ended or all; none is open when no key or since is given, else all
// open (open and held), ended or all; none is open when no key or since is given, else all
State string `json:"state,omitempty"`
}
// AsksAnswerAsksItem is a type of the contract.
type AsksAnswerAsksItem struct {
// when the ask was held back, RFC 3339; present while its state is held-back
HeldSince string `json:"held-since,omitempty"`
// <asker>.<id>
Key string `json:"key"`
// how the ask stands: open, held (no ready channel), held-back (kept open behind the asker's newer asks, ADR 0666 §12), or how it ended (answered, expired, cancelled)
// how the ask stands: open, held (no ready channel), or how it ended (answered, expired, cancelled)
State string `json:"state"`
}
@@ -460,19 +457,6 @@ type AsksAnswer struct {
Matched int64 `json:"matched,omitempty"`
}
// AskAgainInput is what ask-again takes.
type AskAgainInput struct {
// <asker>.<id> of the held-back ask
Key string `json:"key"`
}
// AskAgainAnswer is what ask-again answers.
type AskAgainAnswer struct {
// why it was not offered; set alone
Error string `json:"error,omitempty"`
State string `json:"state,omitempty"`
}
// AskAccept is the body of ask.
type AskAccept = Ask
@@ -532,15 +516,13 @@ type AsksByAskerIDValue struct {
Expires string `json:"expires"`
// its headline
Headline string `json:"headline"`
// when the ask was held back, RFC 3339; present while its state is held-back
HeldSince string `json:"held-since,omitempty"`
// <asker>.<id>
Key string `json:"key"`
// the channels it was offered on
OfferedOn []string `json:"offered_on,omitempty"`
// when it was opened, RFC 3339
Opened string `json:"opened"`
// how it stands: open, held-back (kept open behind the asker's newer asks, ADR 0666 §12), chosen, expired, cancelled, replaced or refused
// how it stands: open, chosen, expired, cancelled, replaced or refused
State string `json:"state"`
Warrant *Warrant `json:"warrant,omitempty"`
}
@@ -35,8 +35,6 @@ func TestFixtures(t *testing.T) {
decode: func(b []byte) (any, error) { var v AsksByAskerIDValue; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
{name: "an ask its asker took back (captured)", subject: "", given: "{\"answer\":\"cancelled: its asker took it back\",\"asker\":\"mesh-delivery-teller\",\"asker_told\":true,\"expires\":\"2026-11-06T10:04:01Z\",\"headline\":\"Check failed - merge into main\",\"key\":\"mesh-delivery-teller.merge-feat_registry_milestone-3a038b9f8b4d-4-4da6ee3cd9d5\",\"offered_on\":[\"telegram\"],\"opened\":\"2026-11-05T10:14:04Z\",\"state\":\"cancelled\"}", wire: "{\"answer\":\"cancelled: its asker took it back\",\"asker\":\"mesh-delivery-teller\",\"asker_told\":true,\"expires\":\"2026-11-06T10:04:01Z\",\"headline\":\"Check failed - merge into main\",\"key\":\"mesh-delivery-teller.merge-feat_registry_milestone-3a038b9f8b4d-4-4da6ee3cd9d5\",\"offered_on\":[\"telegram\"],\"opened\":\"2026-11-05T10:14:04Z\",\"state\":\"cancelled\"}",
decode: func(b []byte) (any, error) { var v AsksByAskerIDValue; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
{name: "a fourth ask, the asker's oldest held back behind newer ones", subject: "", given: "{\"asker\":\"mesh-delivery-teller\",\"expires\":\"2026-11-11T10:00:00Z\",\"headline\":\"Check failed - merge into main\",\"held-since\":\"2026-11-10T10:30:00Z\",\"key\":\"mesh-delivery-teller.b-1\",\"opened\":\"2026-11-10T10:00:00Z\",\"state\":\"held-back\"}", wire: "{\"asker\":\"mesh-delivery-teller\",\"expires\":\"2026-11-11T10:00:00Z\",\"headline\":\"Check failed - merge into main\",\"held-since\":\"2026-11-10T10:30:00Z\",\"key\":\"mesh-delivery-teller.b-1\",\"opened\":\"2026-11-10T10:00:00Z\",\"state\":\"held-back\"}",
decode: func(b []byte) (any, error) { var v AsksByAskerIDValue; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
{name: "an ask the router refused at take-in, closed (design 47 G 570)", subject: "", given: "{\"answer\":\"refused: its expiry passes the bound of its highest option level\",\"asker\":\"nats\",\"asker_told\":true,\"at\":\"2026-11-11T10:00:01Z\",\"expires\":\"2026-11-12T10:00:00Z\",\"headline\":\"Recreate a bus entry\",\"key\":\"nats.r-1\",\"opened\":\"2026-11-11T10:00:00Z\",\"state\":\"refused\"}", wire: "{\"answer\":\"refused: its expiry passes the bound of its highest option level\",\"asker\":\"nats\",\"asker_told\":true,\"at\":\"2026-11-11T10:00:01Z\",\"expires\":\"2026-11-12T10:00:00Z\",\"headline\":\"Recreate a bus entry\",\"key\":\"nats.r-1\",\"opened\":\"2026-11-11T10:00:00Z\",\"state\":\"refused\"}",
decode: func(b []byte) (any, error) { var v AsksByAskerIDValue; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
{name: "an ask chosen, with its warrant in the router's record (design 47 G 700, A-91)", subject: "", given: "{\"asker\":\"mesh-delivery-pipeline\",\"expires\":\"2026-11-12T10:00:00Z\",\"headline\":\"Deliver a module?\",\"key\":\"mesh-delivery-pipeline.approval-1\",\"opened\":\"2026-11-11T10:00:00Z\",\"state\":\"chosen\",\"warrant\":{\"about\":\"mod.main\",\"ask\":\"approval-1\",\"ask-digest\":\"sha256:eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\",\"asker\":\"mesh-delivery-pipeline\",\"at\":\"2026-11-11T10:05:00Z\",\"option\":\"approve\",\"outcome\":\"chosen\"}}", wire: "{\"asker\":\"mesh-delivery-pipeline\",\"expires\":\"2026-11-12T10:00:00Z\",\"headline\":\"Deliver a module?\",\"key\":\"mesh-delivery-pipeline.approval-1\",\"opened\":\"2026-11-11T10:00:00Z\",\"state\":\"chosen\",\"warrant\":{\"about\":\"mod.main\",\"ask\":\"approval-1\",\"ask-digest\":\"sha256:eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\",\"asker\":\"mesh-delivery-pipeline\",\"at\":\"2026-11-11T10:05:00Z\",\"option\":\"approve\",\"outcome\":\"chosen\"}}",
@@ -33,19 +33,6 @@
"state": "cancelled"
}
},
{
"name": "a fourth ask, the asker's oldest held back behind newer ones",
"of": "state:asks/<asker>.<id>",
"given": {
"asker": "mesh-delivery-teller",
"expires": "2026-11-11T10:00:00Z",
"headline": "Check failed - merge into main",
"held-since": "2026-11-10T10:30:00Z",
"key": "mesh-delivery-teller.b-1",
"opened": "2026-11-10T10:00:00Z",
"state": "held-back"
}
},
{
"name": "an ask the router refused at take-in, closed (design 47 G 570)",
"of": "state:asks/<asker>.<id>",
@@ -130,7 +130,7 @@
},
"state": {
"type": "string",
"description": "open (open, held and held-back), ended or all; none is open when no key or since is given, else all"
"description": "open (open and held), ended or all; none is open when no key or since is given, else all"
},
"since": {
"type": "string",
@@ -158,11 +158,7 @@
},
"state": {
"type": "string",
"description": "how the ask stands: open, held (no ready channel), held-back (kept open behind the asker's newer asks, ADR 0666 §12), or how it ended (answered, expired, cancelled)"
},
"held-since": {
"type": "string",
"description": "when the ask was held back, RFC 3339; present while its state is held-back"
"description": "how the ask stands: open, held (no ready channel), or how it ended (answered, expired, cancelled)"
}
},
"required": [
@@ -184,37 +180,6 @@
"asks"
]
}
},
{
"name": "ask-again",
"description": "Offer a held-back ask now, on a channel that is ready: the asker's ask kept open behind its newer asks (design 47 G 83, 394).",
"class": "act",
"input": {
"type": "object",
"properties": {
"key": {
"type": "string",
"description": "<asker>.<id> of the held-back ask"
}
},
"required": [
"key"
],
"additionalProperties": false
},
"answer": {
"type": "object",
"description": "where the ask stands after it was offered",
"properties": {
"state": {
"type": "string"
},
"error": {
"type": "string",
"description": "why it was not offered; set alone"
}
}
}
}
],
"accepts": [
@@ -287,7 +252,7 @@
},
"state": {
"type": "string",
"description": "how it stands: open, held-back (kept open behind the asker's newer asks, ADR 0666 §12), chosen, expired, cancelled, replaced or refused"
"description": "how it stands: open, chosen, expired, cancelled, replaced or refused"
},
"opened": {
"type": "string",
@@ -308,10 +273,6 @@
"type": "boolean",
"description": "its asker has been told how it ended"
},
"held-since": {
"type": "string",
"description": "when the ask was held back, RFC 3339; present while its state is held-back"
},
"warrant": {
"$ref": "#/defs/Warrant"
},
@@ -10,7 +10,6 @@ export declare const verbs: {
readonly notify: "notify";
readonly tell: "tell";
readonly asks: "asks";
readonly askAgain: "ask-again";
};
export declare const accepts: {
@@ -346,16 +345,14 @@ export interface AsksInput {
"key"?: string;
/** only the asks opened at or after this time, RFC 3339 */
"since"?: string;
/** open (open, held and held-back), ended or all; none is open when no key or since is given, else all */
/** open (open and held), ended or all; none is open when no key or since is given, else all */
"state"?: string;
}
export interface AsksAnswerAsksItem {
/** when the ask was held back, RFC 3339; present while its state is held-back */
"held-since"?: string;
/** <asker>.<id> */
"key": string;
/** how the ask stands: open, held (no ready channel), held-back (kept open behind the asker's newer asks, ADR 0666 §12), or how it ended (answered, expired, cancelled) */
/** how the ask stands: open, held (no ready channel), or how it ended (answered, expired, cancelled) */
"state": string;
}
@@ -369,19 +366,6 @@ export interface AsksAnswer {
"matched"?: number;
}
/** is what ask-again takes. */
export interface AskAgainInput {
/** <asker>.<id> of the held-back ask */
"key": string;
}
/** is what ask-again answers. */
export interface AskAgainAnswer {
/** why it was not offered; set alone */
"error"?: string;
"state"?: string;
}
/** is the body of ask. */
export type AskAccept = Ask;
@@ -432,15 +416,13 @@ export interface AsksByAskerIDValue {
"expires": string;
/** its headline */
"headline": string;
/** when the ask was held back, RFC 3339; present while its state is held-back */
"held-since"?: string;
/** <asker>.<id> */
"key": string;
/** the channels it was offered on */
"offered_on"?: string[];
/** when it was opened, RFC 3339 */
"opened": string;
/** how it stands: open, held-back (kept open behind the asker's newer asks, ADR 0666 §12), chosen, expired, cancelled, replaced or refused */
/** how it stands: open, chosen, expired, cancelled, replaced or refused */
"state": string;
"warrant"?: Warrant;
}
@@ -10,7 +10,6 @@ export const verbs = {
notify: "notify",
tell: "tell",
asks: "asks",
askAgain: "ask-again",
};
export const accepts = {
-20
View File
@@ -21,25 +21,5 @@
"source": "module",
"value": 500
}
},
{
"name": "a held value, as mesh-config writes it (the holder's own test values)",
"of": "state:kept/<owner>.<repository>.<number>.<node>.<module>.<key>",
"why": "no tool reads the state kept; the values are the holder's test (modules/mesh-config pulls_test.go): key novox.mesh-catalog.434.ace.n8n.media-gid",
"given": {
"pull": "novox/mesh-catalog#434",
"head": "abc1234def",
"declaration": "sha256:3a7bd3e2360a3d29eea436fcfb7e44c735d117c42d1c1835420b6b9942dd4f1b",
"node": "ace",
"module": "n8n",
"key": "media-gid",
"value": 2000,
"by": "the operator",
"via": "telegram",
"why": "the group the media share is owned by",
"approved": "operator@telegram",
"proposal": "p-1",
"at": "2026-11-05T12:30:00Z"
}
}
]
-74
View File
@@ -266,80 +266,6 @@
}
],
"description": "the value each module on each node takes for each config key, built from the sources alone"
},
{
"name": "kept",
"template": "state",
"key-forms": [
{
"key": "<owner>.<repository>.<number>.<node>.<module>.<key>",
"value": {
"type": "object",
"description": "an approved held value, kept apart from the values mesh-config resolves, laid only over the composition of its own pull request at its head (ADR 0565 clause 5)",
"properties": {
"pull": {
"type": "string",
"description": "the pull request, owner/repository#number"
},
"head": {
"type": "string",
"description": "the head the declaration was read at"
},
"declaration": {
"type": "string",
"description": "the digest of what the declaration holds the value to; the value stays only while it is the same"
},
"node": {
"type": "string"
},
"module": {
"type": "string"
},
"key": {
"type": "string",
"description": "the config key"
},
"value": {
"description": "the value held, as the operator approved it"
},
"by": {
"type": "string"
},
"via": {
"type": "string",
"description": "where the value was proposed from"
},
"why": {
"type": "string"
},
"approved": {
"type": "string",
"description": "who approved it, as the proposal kept it"
},
"proposal": {
"type": "string",
"description": "the proposal's id"
},
"at": {
"type": "string",
"format": "date-time",
"description": "when it was kept"
}
},
"required": [
"pull",
"head",
"declaration",
"node",
"module",
"key",
"value"
]
},
"description": "one held value: the pull request (owner, repository and number, none holding a dot), the node, the module and the config key, which may hold dots"
}
],
"description": "the approved held values of open pull requests, read by the checker and the assigner's composition check"
}
]
}
@@ -0,0 +1,23 @@
[
{
"name": "placement answers a row per branch and build, the build beside the branch",
"of": "verb:placement.answer",
"given": {
"placements": [
{
"branch": "main",
"build": "0123456789ab",
"nodes": [
"workstation"
]
},
{
"branch": "main",
"nodes": [
"laptop"
]
}
]
}
}
]
+5 -1
View File
@@ -178,7 +178,7 @@
"items": {
"$ref": "#/defs/ModulePlacement"
},
"description": "one per branch, the nodes that run the module from it"
"description": "one per branch and build, the nodes that run the module from it"
}
},
"required": [
@@ -1057,6 +1057,10 @@
"branch": {
"type": "string"
},
"build": {
"type": "string",
"description": "the fingerprint of the build these nodes run from the branch; absent, the newest delivered of the branch (design 47 H 750, H-A-39): one row per branch and build"
},
"nodes": {
"type": "array",
"items": {
+24
View File
@@ -259,5 +259,29 @@
},
"withheld-unknown": "withheld unknown: the grants part does not answer"
}
},
{
"name": "apply-order answers the changed wants in the order they are applied, with why and what each waits on",
"of": "verb:apply-order.answer",
"given": {
"order": [
{
"module": "mesh-broker",
"position": 1,
"why": "the bus module is applied first",
"waits": []
},
{
"module": "mesh-delivery-view",
"pipeline": "main.2",
"rank": 2,
"position": 2,
"why": "rank 2 of main.2, after rank 1",
"waits": [
"mesh-delivery-indexer"
]
}
]
}
}
]
+71 -2
View File
@@ -724,6 +724,67 @@
},
"class": "read"
},
{
"name": "apply-order",
"optional": true,
"description": "The order this machine's engine will apply its changed wants in, with why: one row per unapplied changed want, the bus module and the backup holder first, then each pipeline's wants by rank, then the rest by name, its own want last, a reverted module first (design 47 H 771, H-A-46). Read-only. Answered by this machine's engine alone.",
"input": {
"type": "object",
"properties": {}
},
"answer": {
"type": "object",
"properties": {
"order": {
"type": "array",
"items": {
"type": "object",
"properties": {
"module": {
"type": "string",
"description": "the module whose want waits to be applied"
},
"pipeline": {
"type": "string",
"description": "the want's pipeline (its key); absent for a want in none"
},
"rank": {
"type": "integer",
"description": "the mover's tier in its pipeline; absent for a want in none"
},
"position": {
"type": "integer",
"description": "its place in the order, the first applied being 1"
},
"why": {
"type": "string",
"description": "why it stands there, in one sentence"
},
"waits": {
"type": "array",
"items": {
"type": "string"
},
"description": "the modules it waits on; empty when it waits for nothing"
}
},
"required": [
"module",
"position",
"why",
"waits"
]
},
"description": "one row per unapplied changed want, in the order it will be applied"
}
},
"required": [
"order"
],
"description": "the order this machine's engine applies its changed wants in"
},
"class": "read"
},
{
"name": "seat-list",
"description": "The seat list this engine holds and what it waits for (novox/hq ADR 0636 §7): each seat's source (trunk or bootstrap) and digest, the seats held from the bootstrap alone, the definitions refused, the last error and whether the seat mesh-catalog has answered. Read-only.",
@@ -1855,6 +1916,13 @@
],
"description": "the answer of an act the operator is asked"
},
"ManifestReadWord": {
"type": "string",
"enum": [
"want:version"
],
"description": "the word a node-engine states in manifest-reads when it reads a want by version and not by digests (design 47 H 772, H-A-45); the assigner holds a node whose engine does not state it. Other words in manifest-reads are free"
},
"ManifestReadsChanged": {
"type": "object",
"properties": {
@@ -3215,9 +3283,10 @@
"type": "string",
"enum": [
"compose",
"kept-build"
"kept-build",
"placing"
],
"description": "compose: a hold of the composition (a restore point missing, an entry missing, parts that differ, a recovery that waits); kept-build: waiting for a kept build (design 47 G 499, 541)"
"description": "compose: a hold of the composition (a restore point missing, an entry missing, parts that differ, a recovery that waits); kept-build: waiting for a kept build (design 47 G 499, 541); placing: a want of a higher rank held behind a lower one (design 47 H 771, H-A-67)"
},
"node": {
"type": "string",
-33
View File
@@ -26,7 +26,6 @@ export declare function retiredHolderSubject(holder: string): string;
export declare const states: {
readonly resolved: "resolved";
readonly kept: "kept";
};
/** The key of one value of the state resolved under the form "<node>.<module>.<key>". */
@@ -35,12 +34,6 @@ export declare function resolvedByNodeModuleKeyKey(node: string, module: string,
/** The parts of a key of the form "<node>.<module>.<key>", or undefined for a key of another form. */
export declare function parseResolvedByNodeModuleKeyKey(_key: string): { node: string; module: string; key: string } | undefined;
/** The key of one value of the state kept under the form "<owner>.<repository>.<number>.<node>.<module>.<key>". */
export declare function keptByOwnerRepositoryNumberNodeModuleKeyKey(owner: string, repository: string, number: string, node: string, module: string, key: string): string;
/** The parts of a key of the form "<owner>.<repository>.<number>.<node>.<module>.<key>", or undefined for a key of another form. */
export declare function parseKeptByOwnerRepositoryNumberNodeModuleKeyKey(_key: string): { owner: string; repository: string; number: string; node: string; module: string; key: string } | undefined;
/** is what config takes. */
export interface ConfigInput {
/** list (when not given), set, clear or history */
@@ -140,29 +133,3 @@ export interface ResolvedByNodeModuleKeyValue {
"value"?: unknown;
}
/** is one value of the state kept under the key <owner>.<repository>.<number>.<node>.<module>.<key>. */
export interface KeptByOwnerRepositoryNumberNodeModuleKeyValue {
/** who approved it, as the proposal kept it */
"approved"?: string;
/** when it was kept */
"at"?: string;
"by"?: string;
/** the digest of what the declaration holds the value to; the value stays only while it is the same */
"declaration": string;
/** the head the declaration was read at */
"head": string;
/** the config key */
"key": string;
"module": string;
"node": string;
/** the proposal's id */
"proposal"?: string;
/** the pull request, owner/repository#number */
"pull": string;
/** the value held, as the operator approved it */
"value": unknown;
/** where the value was proposed from */
"via"?: string;
"why"?: string;
}
-36
View File
@@ -34,7 +34,6 @@ export function retiredHolderSubject(holder) {
export const states = {
resolved: "resolved",
kept: "kept",
};
/** The key of one value of the state resolved under the form "<node>.<module>.<key>". */
@@ -60,38 +59,3 @@ export function parseResolvedByNodeModuleKeyKey(_key) {
return { node, module, key };
}
/** The key of one value of the state kept under the form "<owner>.<repository>.<number>.<node>.<module>.<key>". */
export function keptByOwnerRepositoryNumberNodeModuleKeyKey(owner, repository, number, node, module, key) {
return owner + "." + repository + "." + number + "." + node + "." + module + "." + key;
}
/** The parts of a key of the form "<owner>.<repository>.<number>.<node>.<module>.<key>", or undefined for a key of another form. */
export function parseKeptByOwnerRepositoryNumberNodeModuleKeyKey(_key) {
let _rest = _key;
const _at0 = _rest.indexOf(".");
if (_at0 <= 0) return undefined;
const owner = _rest.slice(0, _at0);
_rest = _rest.slice(_at0 + 1);
const _at2 = _rest.indexOf(".");
if (_at2 <= 0) return undefined;
const repository = _rest.slice(0, _at2);
_rest = _rest.slice(_at2 + 1);
const _at4 = _rest.indexOf(".");
if (_at4 <= 0) return undefined;
const number = _rest.slice(0, _at4);
_rest = _rest.slice(_at4 + 1);
const _at6 = _rest.indexOf(".");
if (_at6 <= 0) return undefined;
const node = _rest.slice(0, _at6);
_rest = _rest.slice(_at6 + 1);
const _at8 = _rest.indexOf(".");
if (_at8 <= 0) return undefined;
const module = _rest.slice(0, _at8);
_rest = _rest.slice(_at8 + 1);
if (_rest === "") return undefined;
const key = _rest;
_rest = "";
if (_rest !== "") return undefined;
return { owner, repository, number, node, module, key };
}
+3 -1
View File
@@ -155,6 +155,8 @@ export interface Holding {
/** the nodes that run a module from one watched branch */
export interface ModulePlacement {
"branch": string;
/** the fingerprint of the build these nodes run from the branch; absent, the newest delivered of the branch (design 47 H 750, H-A-39): one row per branch and build */
"build"?: string;
"nodes": string[];
}
@@ -376,7 +378,7 @@ export interface PlacementInput {
/** is what placement answers. */
export interface PlacementAnswer {
/** one per branch, the nodes that run the module from it */
/** one per branch and build, the nodes that run the module from it */
"placements": ModulePlacement[];
}
+31 -2
View File
@@ -16,6 +16,7 @@ export declare const verbs: {
readonly compose: "compose";
readonly composeCandidate: "compose-candidate";
readonly manifestReads: "manifest-reads";
readonly applyOrder: "apply-order";
readonly seatList: "seat-list";
readonly seatListAgain: "seat-list-again";
readonly firstViews: "first-views";
@@ -378,6 +379,9 @@ export interface LoginFallback {
"why": string;
}
/** the word a node-engine states in manifest-reads when it reads a want by version and not by digests (design 47 H 772, H-A-45); the assigner holds a node whose engine does not state it. Other words in manifest-reads are free */
export type ManifestReadWord = "want:version";
/** what a node-engine says when what it reads changed or its node returned (ADR 0618 §4) */
export interface ManifestReadsChanged {
/** when it says it, RFC 3339 */
@@ -701,8 +705,8 @@ export interface Wait {
/** why it holds, such as restore point missing, entry-missing, parts-differ, node away or build no longer kept (design 47 G 541, 499) */
"reason"?: string;
"since": string;
/** compose: a hold of the composition (a restore point missing, an entry missing, parts that differ, a recovery that waits); kept-build: waiting for a kept build (design 47 G 499, 541) */
"step": "compose" | "kept-build";
/** compose: a hold of the composition (a restore point missing, an entry missing, parts that differ, a recovery that waits); kept-build: waiting for a kept build (design 47 G 499, 541); placing: a want of a higher rank held behind a lower one (design 47 H 771, H-A-67) */
"step": "compose" | "kept-build" | "placing";
/** the wait said in words */
"words"?: string;
}
@@ -1028,6 +1032,31 @@ export interface ManifestReadsAnswer {
"v": number;
}
/** is what apply-order takes. */
export interface ApplyOrderInput {
}
export interface ApplyOrderAnswerOrderItem {
/** the module whose want waits to be applied */
"module": string;
/** the want's pipeline (its key); absent for a want in none */
"pipeline"?: string;
/** its place in the order, the first applied being 1 */
"position": number;
/** the mover's tier in its pipeline; absent for a want in none */
"rank"?: number;
/** the modules it waits on; empty when it waits for nothing */
"waits": string[];
/** why it stands there, in one sentence */
"why": string;
}
/** is what apply-order answers. */
export interface ApplyOrderAnswer {
/** one row per unapplied changed want, in the order it will be applied */
"order": ApplyOrderAnswerOrderItem[];
}
/** is what seat-list takes. */
export interface SeatListInput {
}
+1
View File
@@ -16,6 +16,7 @@ export const verbs = {
compose: "compose",
composeCandidate: "compose-candidate",
manifestReads: "manifest-reads",
applyOrder: "apply-order",
seatList: "seat-list",
seatListAgain: "seat-list-again",
firstViews: "first-views",