Compare commits
13
Commits
5cb77ce69f
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0b7cf89301 | ||
|
|
36e78f5ff0 | ||
|
|
ba11b5e9e3 | ||
|
|
0806ca5d05 | ||
|
|
2db6e5df49 | ||
|
|
c93229f23a | ||
|
|
bfc5073b82 | ||
|
|
20b06dbcd3 | ||
|
|
8e722a68c9 | ||
|
|
b3a6d17c08 | ||
|
|
ef1fe33a9d | ||
|
|
5e95cbed59 | ||
|
|
821d611530 |
@@ -1,9 +1,6 @@
|
||||
package meshconfigclient
|
||||
|
||||
import (
|
||||
"io/fs"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
@@ -46,31 +43,3 @@ func TestAHeldValueIsTheOneItsKeyNames(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Design 47 G: the contracts' fixtures, and the tests generated from them, name no account of the operator and no node
|
||||
// they run on: a role name stands for either (`operator`, `workstation`).
|
||||
func TestFixturesNameNoOperatorAccountAndNoWorkstation(t *testing.T) {
|
||||
root := "../../.."
|
||||
err := filepath.WalkDir(root, func(path string, d fs.DirEntry, err error) error {
|
||||
if err != nil || d.IsDir() {
|
||||
return err
|
||||
}
|
||||
slash := filepath.ToSlash(path)
|
||||
if !strings.Contains(slash, "/fixtures/") && !strings.HasSuffix(slash, "/contract_test.go") || strings.Contains(slash, "node_modules") {
|
||||
return nil
|
||||
}
|
||||
raw, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for _, word := range []string{"jochen", "shanks"} {
|
||||
if strings.Contains(string(raw), word) {
|
||||
t.Errorf("%s names %q: a fixture names the operator and the workstation by role", slash, word)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@@ -57,7 +58,7 @@ var ErrUnknownVersion = errors.New("node-engine: unknown compose-candidate answe
|
||||
var nameOK = regexp.MustCompile(`^[-/_=a-zA-Z0-9]+$`)
|
||||
|
||||
func checkAsk(a seat.ComposeCandidateInput) error {
|
||||
if _, _, err := ParseCompositionKey(a.Candidate); err != nil {
|
||||
if _, err := ParseCandidateKey(a.Candidate); err != nil {
|
||||
return fmt.Errorf("node-engine: a compose-candidate ask names no candidate: %w", err)
|
||||
}
|
||||
return nil
|
||||
@@ -90,7 +91,7 @@ func CheckAnswer(a seat.ComposeCandidateAnswer) error {
|
||||
if a.Node == "" || !nameOK.MatchString(a.Node) {
|
||||
return fmt.Errorf("node-engine: the answer's node name %q is empty or holds a dot, a wildcard, whitespace or a character a key refuses", a.Node)
|
||||
}
|
||||
if _, _, err := ParseCompositionKey(a.Candidate); err != nil {
|
||||
if _, err := ParseCandidateKey(a.Candidate); err != nil {
|
||||
return err
|
||||
}
|
||||
if a.Took < 0 {
|
||||
@@ -216,3 +217,85 @@ func ParseCompositionKey(key string) (group, headsHash string, err error) {
|
||||
}
|
||||
return group, headsHash, nil
|
||||
}
|
||||
|
||||
// The three forms of the key `compose-candidate` takes (ADR 0593 §7; design 47 G A-226, A-226b): a check's candidate
|
||||
// `<group>.<heads hash>` (CompositionKey), a branch pipeline's catalog graph revision `<branch>.<revision>` (RevisionKey)
|
||||
// and a run on request's `run-<id>` (RunKey). Every caller builds its key with the builders and the node-engine reads it with
|
||||
// ParseCandidateKey, so no caller writes a key by hand.
|
||||
|
||||
// The kinds of candidate a key names.
|
||||
const (
|
||||
CandidateCheck = "check"
|
||||
CandidateRevision = "revision"
|
||||
CandidateRun = "run"
|
||||
)
|
||||
|
||||
const runKeyPrefix = "run-"
|
||||
|
||||
// maxRevision keeps a revision number from reading as a 12-digit heads hash: 12 decimal digits are 12 lowercase hex digits.
|
||||
const maxRevision = 99999999999
|
||||
|
||||
// Candidate is what a key names: Kind says which of the others are set.
|
||||
type Candidate struct {
|
||||
Kind string
|
||||
// Group and HeadsHash of a check's candidate.
|
||||
Group, HeadsHash string
|
||||
// Branch and Revision of a branch pipeline's catalog graph revision.
|
||||
Branch string
|
||||
Revision int64
|
||||
// Run is a run on request's id.
|
||||
Run string
|
||||
}
|
||||
|
||||
// RevisionKey is the key of a branch's catalog graph revision: `<escaped branch>.<revision>`, the branch escaped as a key
|
||||
// part as the pipeline key escapes it, the revision a positive number of at most 11 digits.
|
||||
func RevisionKey(branch string, revision int64) (string, error) {
|
||||
if branch == "" {
|
||||
return "", errors.New("node-engine: the branch name is empty")
|
||||
}
|
||||
if revision <= 0 || revision > maxRevision {
|
||||
return "", fmt.Errorf("node-engine: %d is not a catalog graph revision, a positive number of at most 11 digits", revision)
|
||||
}
|
||||
return keys.EscapeName(branch) + "." + strconv.FormatInt(revision, 10), nil
|
||||
}
|
||||
|
||||
// RunKey is the key of a run on request's candidate: `run-<id>`, the id one key part with no dot.
|
||||
func RunKey(run string) (string, error) {
|
||||
if run == "" || strings.ContainsAny(run, ". \t\n") {
|
||||
return "", fmt.Errorf("node-engine: %q is no run's id: it is empty or holds a dot or whitespace", run)
|
||||
}
|
||||
return runKeyPrefix + run, nil
|
||||
}
|
||||
|
||||
// ParseCandidateKey is the inverse of the three builders; it refuses a key that is none of them, naming it. A key with a
|
||||
// dot whose last part is 12 lowercase hex digits is a check's (a revision number has at most 11 digits), one with a dot and a
|
||||
// number is a revision's, and `run-<id>` with no dot is a run's.
|
||||
func ParseCandidateKey(key string) (Candidate, error) {
|
||||
if !strings.Contains(key, ".") {
|
||||
if run, ok := strings.CutPrefix(key, runKeyPrefix); ok && run != "" && !strings.ContainsAny(run, " \t\n") {
|
||||
return Candidate{Kind: CandidateRun, Run: run}, nil
|
||||
}
|
||||
return Candidate{}, fmt.Errorf("node-engine: %q is not a candidate key, <group>.<heads hash>, <branch>.<revision> or run-<id>", key)
|
||||
}
|
||||
i := strings.LastIndex(key, ".")
|
||||
if heads12.MatchString(key[i+1:]) {
|
||||
group, headsHash, err := ParseCompositionKey(key)
|
||||
if err != nil {
|
||||
return Candidate{}, err
|
||||
}
|
||||
return Candidate{Kind: CandidateCheck, Group: group, HeadsHash: headsHash}, nil
|
||||
}
|
||||
part, number := key[:i], key[i+1:]
|
||||
revision, err := strconv.ParseInt(number, 10, 64)
|
||||
if err != nil || revision <= 0 || revision > maxRevision || strconv.FormatInt(revision, 10) != number {
|
||||
return Candidate{}, fmt.Errorf("node-engine: %q is not a candidate key: %q is neither a heads hash, 12 lowercase hex digits, nor a revision number", key, number)
|
||||
}
|
||||
if part == "" || strings.Contains(part, ".") {
|
||||
return Candidate{}, fmt.Errorf("node-engine: %q is not a candidate key: the branch part is empty or holds a dot", key)
|
||||
}
|
||||
branch, err := keys.UnescapeName(part)
|
||||
if err != nil {
|
||||
return Candidate{}, fmt.Errorf("node-engine: %q is not a candidate key: %w", key, err)
|
||||
}
|
||||
return Candidate{Kind: CandidateRevision, Branch: branch, Revision: revision}, nil
|
||||
}
|
||||
|
||||
@@ -113,3 +113,68 @@ func TestCompositionKeyRoundTripsAndRefuses(t *testing.T) {
|
||||
t.Error("a key with no group was made")
|
||||
}
|
||||
}
|
||||
|
||||
// A-226b: the three forms of a compose-candidate key are built by the client and read by one parser; a check's key reads as it
|
||||
// did, a revision's number is never mistaken for a heads hash, and what is none of them is refused naming it.
|
||||
func TestCandidateKeysOfTheThreeFormsRoundTripAndRefuse(t *testing.T) {
|
||||
check, _ := CompositionKey("fix/1.2", "0123456789ab")
|
||||
revision, err := RevisionKey("fix/1", 362)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
run, err := RunKey("r1")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for key, want := range map[string]Candidate{
|
||||
check: {Kind: CandidateCheck, Group: "fix/1.2", HeadsHash: "0123456789ab"},
|
||||
revision: {Kind: CandidateRevision, Branch: "fix/1", Revision: 362},
|
||||
run: {Kind: CandidateRun, Run: "r1"},
|
||||
"main.1": {Kind: CandidateRevision, Branch: "main", Revision: 1},
|
||||
} {
|
||||
if got, err := ParseCandidateKey(key); err != nil || got != want {
|
||||
t.Errorf("%q parsed as %+v (%v), want %+v", key, got, err, want)
|
||||
}
|
||||
}
|
||||
for _, bad := range []string{"", "nogroup", "run-", "g.0123456789AB", ".362", "a.b.362", "main.0", "main.-3", "main.0362", "main.123456789012x"} {
|
||||
if _, err := ParseCandidateKey(bad); err == nil {
|
||||
t.Errorf("%q was taken for a candidate key", bad)
|
||||
}
|
||||
}
|
||||
for _, bad := range []int64{0, -1, 100000000000} {
|
||||
if _, err := RevisionKey("main", bad); err == nil {
|
||||
t.Errorf("a key for revision %d was made", bad)
|
||||
}
|
||||
}
|
||||
if _, err := RevisionKey("", 1); err == nil {
|
||||
t.Error("a key with no branch was made")
|
||||
}
|
||||
if _, err := RunKey("a.b"); err == nil {
|
||||
t.Error("a run key with a dot was made")
|
||||
}
|
||||
// The ask and the answer accept all three.
|
||||
if _, err := EncodeAsk(seat.ComposeCandidateInput{Candidate: revision}); err != nil {
|
||||
t.Errorf("an ask naming a revision: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// A-237b: compose-candidate is a verb marked chunks: an ask carries the caller's call token, and an answer names the chunks the
|
||||
// composition input is sent in; the inline input stays for an ask with no token.
|
||||
func TestComposeCandidateAskAndAnswerCarryTheChunkedForm(t *testing.T) {
|
||||
key, _ := RevisionKey("main", 7)
|
||||
ask, err := EncodeAsk(seat.ComposeCandidateInput{Candidate: key, Input: true, Call: "0123456789abcdef0123456789abcdef"})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
back, err := DecodeAsk(ask)
|
||||
if err != nil || back.Call != "0123456789abcdef0123456789abcdef" || !back.Input {
|
||||
t.Errorf("the ask came back as %+v (%v)", back, err)
|
||||
}
|
||||
raw, err := EncodeAnswer(seat.ComposeCandidateAnswer{Node: "n1", Candidate: key, Verdict: Composed, Modules: []seat.Module{}, Own: seat.Module{Module: NodeWord, State: ModuleComposed, Digest: "sha256:" + strings.Repeat("a", 64)}, Chunks: 3})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if a, err := DecodeAnswer(raw); err != nil || a.Chunks != 3 || a.Input != nil {
|
||||
t.Errorf("the answer came back as %+v (%v)", a, err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,6 +49,9 @@ type Composition struct {
|
||||
Own seat.NodeOwn
|
||||
Plan json.RawMessage
|
||||
Refused string
|
||||
// Templates are the digests ("sha256:<hex>"), sorted, of the templates archives the module's files were rendered from
|
||||
// (design 47 G A-481, A-481a); part of the digest as the resources are.
|
||||
Templates []string
|
||||
}
|
||||
|
||||
type adoptionWire struct {
|
||||
@@ -139,6 +142,7 @@ type composedWire struct {
|
||||
Own *ownWire `json:"own,omitempty"`
|
||||
Plan json.RawMessage `json:"plan,omitempty"`
|
||||
Refused string `json:"refused,omitempty"`
|
||||
Templates []string `json:"templates,omitempty"`
|
||||
// Signature is read and dropped: a composition is unsigned (ADR 0593 §6), and a value the ended controller signed
|
||||
// still decodes. Nothing writes it.
|
||||
Signature json.RawMessage `json:"signature,omitempty"`
|
||||
@@ -183,9 +187,17 @@ func (c Composition) check() error {
|
||||
return fmt.Errorf("node-engine: the composition of %s carries the node's own parts, which only <node>.node carries", c.Module)
|
||||
}
|
||||
}
|
||||
if c.Refused != "" && (len(c.Resources) > 0 || len(c.Filled) > 0 || c.Data || len(c.Plan) > 0) {
|
||||
if c.Refused != "" && (len(c.Resources) > 0 || len(c.Filled) > 0 || c.Data || len(c.Plan) > 0 || len(c.Templates) > 0) {
|
||||
return fmt.Errorf("node-engine: the composition of %s on %s is refused and holds resources, filled files, data or a plan", c.Module, c.Node)
|
||||
}
|
||||
for i, d := range c.Templates {
|
||||
if hex, ok := strings.CutPrefix(d, "sha256:"); !ok || !keys.IsHex64(hex) {
|
||||
return fmt.Errorf("node-engine: the templates digest %q of %s is not sha256: and 64 lowercase hex digits", d, c.Module)
|
||||
}
|
||||
if i > 0 && c.Templates[i-1] >= d {
|
||||
return fmt.Errorf("node-engine: the templates digests of %s are not sorted and distinct", c.Module)
|
||||
}
|
||||
}
|
||||
seen := map[string]bool{}
|
||||
files := map[string][]*declaration.File{}
|
||||
for _, raw := range c.Resources {
|
||||
@@ -245,7 +257,7 @@ func (c Composition) wire() (composedWire, error) {
|
||||
return composedWire{}, err
|
||||
}
|
||||
w := composedWire{V: keys.Version, Node: c.Node, Module: c.Module, FP: c.FP, Data: c.Data, Filled: c.Filled,
|
||||
Refused: c.Refused, Resources: make([]json.RawMessage, len(c.Resources))}
|
||||
Refused: c.Refused, Templates: c.Templates, Resources: make([]json.RawMessage, len(c.Resources))}
|
||||
for i, r := range c.Resources {
|
||||
canon, err := canonicalJSON(r)
|
||||
if err != nil {
|
||||
@@ -290,7 +302,7 @@ func DecodeComposition(data []byte) (Composition, error) {
|
||||
return Composition{}, fmt.Errorf("node-engine: a composition does not fit its shape: %w", err)
|
||||
}
|
||||
c := Composition{V: w.V, Node: w.Node, Module: w.Module, FP: w.FP, Data: w.Data, Resources: w.Resources,
|
||||
Filled: w.Filled, Plan: w.Plan, Refused: w.Refused}
|
||||
Filled: w.Filled, Plan: w.Plan, Refused: w.Refused, Templates: w.Templates}
|
||||
if w.Own != nil {
|
||||
c.Own = ownFromWire(*w.Own)
|
||||
}
|
||||
|
||||
@@ -60,6 +60,7 @@ func TestCompositionDigests(t *testing.T) {
|
||||
{"one package", Composition{Node: "ace", Module: "buildah", FP: fp(7), Resources: by["buildah"]}, "sha256:84e480a7a62333960b3e4be21a7548bbaa09572ef73ca8fb9dc6dfd1228aeb6b"},
|
||||
{"a service and a file", Composition{Node: "ace", Module: "mesh-wireguard", FP: fp(14), Resources: by["mesh-wireguard"]}, "sha256:d6edec2474f606503e55d4ee2e0b4f5d1ffc25d016e4bc595e86ea67fe205b8c"},
|
||||
{"a plan beside the resources", Composition{Node: "ace", Module: "hostname", FP: fp(8), Resources: by["hostname"], Plan: json.RawMessage(`{"files":[{"path":"/etc/hostname"}]}`)}, "sha256:49e17d6c471ee65cdef745ca3ac5cea4d37b6a100e11d8434dc64a6e2949e57e"},
|
||||
{"the templates archives it was rendered from", Composition{Node: "ace", Module: "hostname", FP: fp(8), Resources: by["hostname"], Templates: []string{"sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "sha256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"}}, "sha256:342df17a2e81fc08911452ecf1f37c6267aa58b66b26109b8e10253196248364"},
|
||||
}
|
||||
for _, c := range cases {
|
||||
got, err := ComposedDigest(c.c)
|
||||
@@ -107,6 +108,8 @@ func TestCompositionRefusals(t *testing.T) {
|
||||
{"a resource of another module", Composition{Node: "ace", Module: "hostname", FP: fp(8), Resources: ok.Resources}, "is of"},
|
||||
{"the node's own parts on a module", Composition{Node: "ace", Module: "buildah", FP: fp(7), Own: seat.NodeOwn{ProvisionerAccount: "x"}}, "node's own parts"},
|
||||
{"a refusal that holds resources", Composition{Node: "ace", Module: "buildah", FP: fp(7), Resources: ok.Resources, Refused: "no secret"}, "refused and holds"},
|
||||
{"templates digests not sorted", Composition{Node: "ace", Module: "hostname", FP: fp(8), Resources: by["hostname"], Templates: []string{"sha256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}}, "not sorted"},
|
||||
{"a templates digest of no form", Composition{Node: "ace", Module: "hostname", FP: fp(8), Resources: by["hostname"], Templates: []string{"abc"}}, "templates digest"},
|
||||
{"the node's own with a fingerprint", Composition{Node: "ace", FP: fp(7)}, "names no fingerprint"},
|
||||
{"a node name with a dot", Composition{Node: "a.ce"}, "node"},
|
||||
}
|
||||
|
||||
@@ -58,22 +58,21 @@ func TestHaveCodec(t *testing.T) {
|
||||
if _, err := DecodeHave([]byte(`{"v":1,"phase":"running","health":"ok","extra":1}`)); err == nil {
|
||||
t.Fatal("an unknown field is read")
|
||||
}
|
||||
}
|
||||
|
||||
func TestSameHaveComparesTimesAsInstants(t *testing.T) {
|
||||
at := time.Date(2026, 11, 5, 12, 0, 0, 0, time.UTC)
|
||||
zone := time.FixedZone("x", 3600)
|
||||
mk := func(tm time.Time) seat.HaveByNodeModuleValue {
|
||||
return seat.HaveByNodeModuleValue{Phase: PhaseFailed, Health: HealthFailed,
|
||||
PullWait: &seat.PullWait{Image: "i", Holder: "h", Began: tm},
|
||||
UserList: &seat.UserListWritten{Source: "s", At: tm}}
|
||||
}
|
||||
if !SameHave(mk(at), mk(at.In(zone))) {
|
||||
t.Fatal("the same instant in another zone differs")
|
||||
}
|
||||
if SameHave(mk(at), mk(at.Add(time.Second))) {
|
||||
t.Fatal("another instant is the same")
|
||||
}
|
||||
t.Run("SameHaveComparesTimesAsInstants", func(t *testing.T) {
|
||||
at := time.Date(2026, 11, 5, 12, 0, 0, 0, time.UTC)
|
||||
zone := time.FixedZone("x", 3600)
|
||||
mk := func(tm time.Time) seat.HaveByNodeModuleValue {
|
||||
return seat.HaveByNodeModuleValue{Phase: PhaseFailed, Health: HealthFailed,
|
||||
PullWait: &seat.PullWait{Image: "i", Holder: "h", Began: tm},
|
||||
UserList: &seat.UserListWritten{Source: "s", At: tm}}
|
||||
}
|
||||
if !SameHave(mk(at), mk(at.In(zone))) {
|
||||
t.Fatal("the same instant in another zone differs")
|
||||
}
|
||||
if SameHave(mk(at), mk(at.Add(time.Second))) {
|
||||
t.Fatal("another instant is the same")
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func TestHaveNodeCodec(t *testing.T) {
|
||||
|
||||
@@ -344,6 +344,14 @@ func DecodeSeatHoldersBySeatNodeValue(raw []byte) (SeatHoldersBySeatNodeValue, e
|
||||
return v, nil
|
||||
}
|
||||
|
||||
// AddedModule is what the want a candidate would write for a module carries of its build, in the want's own forms (the seat mesh-wants' state wants: `version` and `parts`; copied here because a seat definition cannot reuse another repository's seat's forms, design 47 G A-316).
|
||||
type AddedModule struct {
|
||||
// the digest of each of the module's parts, by `<module>:<artifact>` (design 47 G section 379)
|
||||
Parts map[string]string `json:"parts,omitempty"`
|
||||
// the module's released version, for people; none for a build of another watched branch (design 47 G section 379)
|
||||
Version string `json:"version,omitempty"`
|
||||
}
|
||||
|
||||
// Assignments is one node's assignments assembled.
|
||||
type Assignments struct {
|
||||
Decided NodeDecided `json:"decided"`
|
||||
@@ -687,6 +695,8 @@ type ProposalsByProposalValue = Proposal
|
||||
|
||||
// CandidatesByProposalNodeValue is one value of the state candidates under the key <proposal>.<node>.
|
||||
type CandidatesByProposalNodeValue struct {
|
||||
// by module name, each module the candidate adds to this node without a want there: the `version` and `parts` the want it would write carries (design 47 G A-316); the node-engine builds such a module from this entry
|
||||
Added map[string]AddedModule `json:"added,omitempty"`
|
||||
// the node's assignments with the proposal laid over it; absent when the proposal takes its key away
|
||||
Assignments *Assignments `json:"assignments,omitempty"`
|
||||
Proposal string `json:"proposal"`
|
||||
|
||||
@@ -41,7 +41,7 @@ func TestFixtures(t *testing.T) {
|
||||
err := json.Unmarshal(b, &v)
|
||||
return v, err
|
||||
}, subjectIs: nil},
|
||||
{name: "a module's key on a watched branch and a build", subject: "", given: "{\"node\":\"ace\",\"placed\":{\"branch\":\"beta\",\"build\":\"src2:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"module\":\"plex\"},\"v\":1}", wire: "{\"node\":\"ace\",\"placed\":{\"branch\":\"beta\",\"build\":\"src2:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"module\":\"plex\"},\"v\":1}",
|
||||
{name: "a module's key on a watched branch and a build", subject: "", given: "{\"node\":\"home-server\",\"placed\":{\"branch\":\"beta\",\"build\":\"src2:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"module\":\"plex\"},\"v\":1}", wire: "{\"node\":\"home-server\",\"placed\":{\"branch\":\"beta\",\"build\":\"src2:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"module\":\"plex\"},\"v\":1}",
|
||||
decode: func(b []byte) (any, error) {
|
||||
var v AssignmentsByNodeModuleValue
|
||||
err := json.Unmarshal(b, &v)
|
||||
@@ -53,13 +53,13 @@ func TestFixtures(t *testing.T) {
|
||||
err := json.Unmarshal(b, &v)
|
||||
return v, err
|
||||
}, subjectIs: nil},
|
||||
{name: "a proposal placing a module on a watched branch at an earlier build", subject: "", given: "{\"at\":\"2026-11-10T12:00:00Z\",\"base\":{\"ace\":3},\"by\":\"operator\",\"changes\":[{\"branch\":\"beta\",\"build\":\"src2:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"module\":\"nats\",\"node\":\"ace\",\"op\":\"place\"}],\"id\":\"p-20261110t120000-aabbccdd\",\"state\":\"answering\",\"why\":\"run nats from beta, back one build\"}", wire: "{\"at\":\"2026-11-10T12:00:00Z\",\"base\":{\"ace\":3},\"by\":\"operator\",\"changes\":[{\"branch\":\"beta\",\"build\":\"src2:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"module\":\"nats\",\"node\":\"ace\",\"op\":\"place\"}],\"id\":\"p-20261110t120000-aabbccdd\",\"state\":\"answering\",\"why\":\"run nats from beta, back one build\"}",
|
||||
{name: "a proposal placing a module on a watched branch at an earlier build", subject: "", given: "{\"at\":\"2026-11-10T12:00:00Z\",\"base\":{\"home-server\":3},\"by\":\"operator\",\"changes\":[{\"branch\":\"beta\",\"build\":\"src2:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"module\":\"nats\",\"node\":\"home-server\",\"op\":\"place\"}],\"id\":\"p-20261110t120000-aabbccdd\",\"state\":\"answering\",\"why\":\"run nats from beta, back one build\"}", wire: "{\"at\":\"2026-11-10T12:00:00Z\",\"base\":{\"home-server\":3},\"by\":\"operator\",\"changes\":[{\"branch\":\"beta\",\"build\":\"src2:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"module\":\"nats\",\"node\":\"home-server\",\"op\":\"place\"}],\"id\":\"p-20261110t120000-aabbccdd\",\"state\":\"answering\",\"why\":\"run nats from beta, back one build\"}",
|
||||
decode: func(b []byte) (any, error) {
|
||||
var v ProposalsByProposalValue
|
||||
err := json.Unmarshal(b, &v)
|
||||
return v, err
|
||||
}, subjectIs: nil},
|
||||
{name: "a candidate", subject: "", given: "{\"proposal\":\"p-20261105t120000-aabbccdd\",\"v\":1}", wire: "{\"proposal\":\"p-20261105t120000-aabbccdd\",\"v\":1}",
|
||||
{name: "a candidate, with the modules it adds and what their wants would carry", subject: "", given: "{\"added\":{\"mesh-build-go\":{\"parts\":{\"mesh-build-go:go-binary\":\"sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"},\"version\":\"1.4.0\"}},\"proposal\":\"p-20261105t120000-aabbccdd\",\"v\":1}", wire: "{\"added\":{\"mesh-build-go\":{\"parts\":{\"mesh-build-go:go-binary\":\"sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"},\"version\":\"1.4.0\"}},\"proposal\":\"p-20261105t120000-aabbccdd\",\"v\":1}",
|
||||
decode: func(b []byte) (any, error) {
|
||||
var v CandidatesByProposalNodeValue
|
||||
err := json.Unmarshal(b, &v)
|
||||
|
||||
@@ -1349,7 +1349,9 @@ type ComposeAnswer struct {
|
||||
|
||||
// ComposeCandidateInput is what compose-candidate takes.
|
||||
type ComposeCandidateInput struct {
|
||||
// the key of the indexer's candidate, <group>.<heads hash>
|
||||
// 128 random bits the caller chooses: the subject token of the chunks and acknowledgements the composition input is sent in, whatever its size (design 47 G A-237b); an ask with input and no call is answered inline, as before the checker goes (G-6 section 321)
|
||||
Call string `json:"call,omitempty"`
|
||||
// the key of the candidate to compose: a check's candidate in the indexer, <group>.<heads hash>; a branch pipeline's catalog graph revision, <branch>.<revision> (the node-engine reads its entries through mesh-catalog.revision); or a run on request's, run-<id>; built and read by the seat's client (nodeengineclient)
|
||||
Candidate string `json:"candidate"`
|
||||
// also answer the composition input the candidate was composed from, for the sandbox path
|
||||
Input bool `json:"input,omitempty"`
|
||||
@@ -1359,7 +1361,9 @@ type ComposeCandidateInput struct {
|
||||
type ComposeCandidateAnswer struct {
|
||||
// the candidate's key
|
||||
Candidate string `json:"candidate"`
|
||||
// when asked: the composition input it composed from
|
||||
// when asked with input and a call token: how many chunks of at most 512 KiB carry the composition input, sent on the chunk subject of the call, each acknowledged by the caller (design 47 G A-237b)
|
||||
Chunks int64 `json:"chunks,omitempty"`
|
||||
// when asked without a call token: the composition input it composed from, inline, up to what one answer carries (the checker's form, kept until G removes the checker, G-6 section 321)
|
||||
Input map[string]any `json:"input,omitempty"`
|
||||
// every module placed on the node, sorted by name
|
||||
Modules []Module `json:"modules"`
|
||||
@@ -1645,7 +1649,9 @@ type ComposedByNodeModuleFingerprintValue struct {
|
||||
Refused string `json:"refused,omitempty"`
|
||||
// the declaration resources, each saying its module
|
||||
Resources []map[string]any `json:"resources"`
|
||||
V int64 `json:"v"`
|
||||
// the digests, sorted, of the templates archives the composition was rendered from
|
||||
Templates []string `json:"templates,omitempty"`
|
||||
V int64 `json:"v"`
|
||||
}
|
||||
|
||||
// ComposedByNodeNodeValue is one value of the state composed under the key <node>.node.
|
||||
|
||||
@@ -35,19 +35,19 @@ func TestFixtures(t *testing.T) {
|
||||
err := json.Unmarshal(b, &v)
|
||||
return v, err
|
||||
}, subjectIs: regexp.MustCompile("^mesh\\.seat\\.node-engine\\.event\\.manifest-reads-changed\\.[A-Za-z0-9_-]+$")},
|
||||
{name: "composed is said", subject: "mesh.seat.node-engine.event.composed.ace", given: "{\"at\":\"2026-11-09T20:00:00Z\",\"digest\":\"sha256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\",\"fingerprint\":\"src2:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"module\":\"nats\",\"node\":\"ace\",\"v\":1}", wire: "{\"at\":\"2026-11-09T20:00:00Z\",\"digest\":\"sha256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\",\"fingerprint\":\"src2:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"module\":\"nats\",\"node\":\"ace\",\"v\":1}",
|
||||
{name: "composed is said", subject: "mesh.seat.node-engine.event.composed.home-server", given: "{\"at\":\"2026-11-09T20:00:00Z\",\"digest\":\"sha256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\",\"fingerprint\":\"src2:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"module\":\"nats\",\"node\":\"home-server\",\"v\":1}", wire: "{\"at\":\"2026-11-09T20:00:00Z\",\"digest\":\"sha256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\",\"fingerprint\":\"src2:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"module\":\"nats\",\"node\":\"home-server\",\"v\":1}",
|
||||
decode: func(b []byte) (any, error) { var v ComposedEvent; err := json.Unmarshal(b, &v); return v, err }, subjectIs: regexp.MustCompile("^mesh\\.seat\\.node-engine\\.event\\.composed\\.[^.*> ]+$")},
|
||||
{name: "running is said, its node and module in its subject", subject: "mesh.seat.node-engine.event.running.ace.nats", given: "{\"at\":\"2026-11-09T20:01:00Z\",\"fingerprint\":\"src2:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"manifest\":\"sha256:cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc\",\"module\":\"nats\",\"node\":\"ace\",\"v\":1}", wire: "{\"at\":\"2026-11-09T20:01:00Z\",\"fingerprint\":\"src2:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"manifest\":\"sha256:cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc\",\"module\":\"nats\",\"node\":\"ace\",\"v\":1}",
|
||||
{name: "running is said, its node and module in its subject", subject: "mesh.seat.node-engine.event.running.home-server.nats", given: "{\"at\":\"2026-11-09T20:01:00Z\",\"fingerprint\":\"src2:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"manifest\":\"sha256:cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc\",\"module\":\"nats\",\"node\":\"home-server\",\"v\":1}", wire: "{\"at\":\"2026-11-09T20:01:00Z\",\"fingerprint\":\"src2:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"manifest\":\"sha256:cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc\",\"module\":\"nats\",\"node\":\"home-server\",\"v\":1}",
|
||||
decode: func(b []byte) (any, error) { var v RunningEvent; err := json.Unmarshal(b, &v); return v, err }, subjectIs: regexp.MustCompile("^mesh\\.seat\\.node-engine\\.event\\.running\\.[^.*> ]+\\.[^.*> ]+$")},
|
||||
{name: "running says the build that runs is healthy", subject: "mesh.seat.node-engine.event.running.ace.nats", given: "{\"at\":\"2026-11-11T09:00:00Z\",\"fingerprint\":\"src2:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"healthy\":true,\"manifest\":\"sha256:cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc\",\"module\":\"nats\",\"node\":\"ace\",\"v\":1}", wire: "{\"at\":\"2026-11-11T09:00:00Z\",\"fingerprint\":\"src2:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"healthy\":true,\"manifest\":\"sha256:cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc\",\"module\":\"nats\",\"node\":\"ace\",\"v\":1}",
|
||||
{name: "running says the build that runs is healthy", subject: "mesh.seat.node-engine.event.running.home-server.nats", given: "{\"at\":\"2026-11-11T09:00:00Z\",\"fingerprint\":\"src2:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"healthy\":true,\"manifest\":\"sha256:cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc\",\"module\":\"nats\",\"node\":\"home-server\",\"v\":1}", wire: "{\"at\":\"2026-11-11T09:00:00Z\",\"fingerprint\":\"src2:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"healthy\":true,\"manifest\":\"sha256:cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc\",\"module\":\"nats\",\"node\":\"home-server\",\"v\":1}",
|
||||
decode: func(b []byte) (any, error) { var v RunningEvent; err := json.Unmarshal(b, &v); return v, err }, subjectIs: regexp.MustCompile("^mesh\\.seat\\.node-engine\\.event\\.running\\.[^.*> ]+\\.[^.*> ]+$")},
|
||||
{name: "running says the build that runs turned unhealthy, still running", subject: "mesh.seat.node-engine.event.running.ace.nats", given: "{\"at\":\"2026-11-11T09:05:00Z\",\"fingerprint\":\"src2:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"healthy\":false,\"manifest\":\"sha256:cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc\",\"module\":\"nats\",\"node\":\"ace\",\"v\":1}", wire: "{\"at\":\"2026-11-11T09:05:00Z\",\"fingerprint\":\"src2:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"healthy\":false,\"manifest\":\"sha256:cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc\",\"module\":\"nats\",\"node\":\"ace\",\"v\":1}",
|
||||
{name: "running says the build that runs turned unhealthy, still running", subject: "mesh.seat.node-engine.event.running.home-server.nats", given: "{\"at\":\"2026-11-11T09:05:00Z\",\"fingerprint\":\"src2:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"healthy\":false,\"manifest\":\"sha256:cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc\",\"module\":\"nats\",\"node\":\"home-server\",\"v\":1}", wire: "{\"at\":\"2026-11-11T09:05:00Z\",\"fingerprint\":\"src2:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"healthy\":false,\"manifest\":\"sha256:cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc\",\"module\":\"nats\",\"node\":\"home-server\",\"v\":1}",
|
||||
decode: func(b []byte) (any, error) { var v RunningEvent; err := json.Unmarshal(b, &v); return v, err }, subjectIs: regexp.MustCompile("^mesh\\.seat\\.node-engine\\.event\\.running\\.[^.*> ]+\\.[^.*> ]+$")},
|
||||
{name: "running says a module stopped on the node, with no fingerprint", subject: "mesh.seat.node-engine.event.running.ace.nats", given: "{\"at\":\"2026-11-11T09:00:00Z\",\"module\":\"nats\",\"node\":\"ace\",\"stopped\":true,\"v\":1}", wire: "{\"at\":\"2026-11-11T09:00:00Z\",\"module\":\"nats\",\"node\":\"ace\",\"stopped\":true,\"v\":1}",
|
||||
{name: "running says a module stopped on the node, with no fingerprint", subject: "mesh.seat.node-engine.event.running.home-server.nats", given: "{\"at\":\"2026-11-11T09:00:00Z\",\"module\":\"nats\",\"node\":\"home-server\",\"stopped\":true,\"v\":1}", wire: "{\"at\":\"2026-11-11T09:00:00Z\",\"module\":\"nats\",\"node\":\"home-server\",\"stopped\":true,\"v\":1}",
|
||||
decode: func(b []byte) (any, error) { var v RunningEvent; err := json.Unmarshal(b, &v); return v, err }, subjectIs: regexp.MustCompile("^mesh\\.seat\\.node-engine\\.event\\.running\\.[^.*> ]+\\.[^.*> ]+$")},
|
||||
{name: "a kept build's wait is held", subject: "mesh.seat.node-engine.event.wait-held.ace.postgres", given: "{\"bound\":\"60m\",\"clock-from\":\"2026-11-11T10:00:00Z\",\"node\":\"ace\",\"on\":\"the kept build of postgres\",\"owner\":\"node-engine\",\"reason\":\"node away\",\"since\":\"2026-11-11T10:00:00Z\",\"step\":\"kept-build\",\"words\":\"waiting for the kept build of postgres on ace\"}", wire: "{\"bound\":\"60m\",\"clock-from\":\"2026-11-11T10:00:00Z\",\"node\":\"ace\",\"on\":\"the kept build of postgres\",\"owner\":\"node-engine\",\"reason\":\"node away\",\"since\":\"2026-11-11T10:00:00Z\",\"step\":\"kept-build\",\"words\":\"waiting for the kept build of postgres on ace\"}",
|
||||
{name: "a kept build's wait is held", subject: "mesh.seat.node-engine.event.wait-held.home-server.postgres", given: "{\"bound\":\"60m\",\"clock-from\":\"2026-11-11T10:00:00Z\",\"node\":\"home-server\",\"on\":\"the kept build of postgres\",\"owner\":\"node-engine\",\"reason\":\"node away\",\"since\":\"2026-11-11T10:00:00Z\",\"step\":\"kept-build\",\"words\":\"waiting for the kept build of postgres on home-server\"}", wire: "{\"bound\":\"60m\",\"clock-from\":\"2026-11-11T10:00:00Z\",\"node\":\"home-server\",\"on\":\"the kept build of postgres\",\"owner\":\"node-engine\",\"reason\":\"node away\",\"since\":\"2026-11-11T10:00:00Z\",\"step\":\"kept-build\",\"words\":\"waiting for the kept build of postgres on home-server\"}",
|
||||
decode: func(b []byte) (any, error) { var v WaitHeldEvent; err := json.Unmarshal(b, &v); return v, err }, subjectIs: regexp.MustCompile("^mesh\\.seat\\.node-engine\\.event\\.wait-held\\.[^.*> ]+\\.[^.*> ]+$")},
|
||||
{name: "a hold of the composition ends", subject: "mesh.seat.node-engine.event.wait-ended.ace.postgres", given: "{\"owner\":\"node-engine\",\"reason\":\"restore point missing\",\"since\":\"2026-11-11T10:00:00Z\",\"step\":\"compose\"}", wire: "{\"owner\":\"node-engine\",\"reason\":\"restore point missing\",\"since\":\"2026-11-11T10:00:00Z\",\"step\":\"compose\"}",
|
||||
{name: "a hold of the composition ends", subject: "mesh.seat.node-engine.event.wait-ended.home-server.postgres", given: "{\"owner\":\"node-engine\",\"reason\":\"restore point missing\",\"since\":\"2026-11-11T10:00:00Z\",\"step\":\"compose\"}", wire: "{\"owner\":\"node-engine\",\"reason\":\"restore point missing\",\"since\":\"2026-11-11T10:00:00Z\",\"step\":\"compose\"}",
|
||||
decode: func(b []byte) (any, error) { var v WaitEndedEvent; err := json.Unmarshal(b, &v); return v, err }, subjectIs: regexp.MustCompile("^mesh\\.seat\\.node-engine\\.event\\.wait-ended\\.[^.*> ]+\\.[^.*> ]+$")},
|
||||
{name: "the finding of a seat list unread, as the engine writes it", subject: "", given: "{\"at\":\"2026-11-05T14:00:00Z\",\"key\":\"machine.ace.seat-list-unread\",\"kind\":\"seat-list-unread\",\"observer\":\"mesh-host\",\"severity\":\"warning\",\"source\":\"node-engine.seat-list\",\"subject\":{\"id\":\"ace\",\"machine\":\"ace\",\"scope\":\"machine\"},\"summary\":\"the seat list has not been read for five minutes\",\"v\":1}", wire: "{\"at\":\"2026-11-05T14:00:00Z\",\"key\":\"machine.ace.seat-list-unread\",\"kind\":\"seat-list-unread\",\"observer\":\"mesh-host\",\"severity\":\"warning\",\"source\":\"node-engine.seat-list\",\"subject\":{\"id\":\"ace\",\"machine\":\"ace\",\"scope\":\"machine\"},\"summary\":\"the seat list has not been read for five minutes\",\"v\":1}",
|
||||
decode: func(b []byte) (any, error) { var v FindingsByKeyValue; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
|
||||
@@ -111,9 +111,9 @@ func TestFixtures(t *testing.T) {
|
||||
decode: func(b []byte) (any, error) { var v SeatListAgainAnswer; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
|
||||
{name: "process-builds asks one module", subject: "", given: "{\"module\":\"nats\"}", wire: "{\"module\":\"nats\"}",
|
||||
decode: func(b []byte) (any, error) { var v ProcessBuildsInput; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
|
||||
{name: "process-builds answers each process's build", subject: "", given: "{\"node\":\"ace\",\"processes\":[{\"fingerprint\":\"src2:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"kind\":\"service\",\"module\":\"nats\",\"process\":\"nats.service\",\"started\":\"2026-11-09T19:00:00Z\"},{\"kind\":\"container\",\"module\":\"route-proxy\",\"process\":\"route-proxy\",\"started\":\"2026-11-01T08:00:00Z\",\"unknown\":\"started before the node-engine handed MESH_FINGERPRINT\"}]}", wire: "{\"node\":\"ace\",\"processes\":[{\"fingerprint\":\"src2:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"kind\":\"service\",\"module\":\"nats\",\"process\":\"nats.service\",\"started\":\"2026-11-09T19:00:00Z\"},{\"kind\":\"container\",\"module\":\"route-proxy\",\"process\":\"route-proxy\",\"started\":\"2026-11-01T08:00:00Z\",\"unknown\":\"started before the node-engine handed MESH_FINGERPRINT\"}]}",
|
||||
{name: "process-builds answers each process's build", subject: "", given: "{\"node\":\"home-server\",\"processes\":[{\"fingerprint\":\"src2:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"kind\":\"service\",\"module\":\"nats\",\"process\":\"nats.service\",\"started\":\"2026-11-09T19:00:00Z\"},{\"kind\":\"container\",\"module\":\"route-proxy\",\"process\":\"route-proxy\",\"started\":\"2026-11-01T08:00:00Z\",\"unknown\":\"started before the node-engine handed MESH_FINGERPRINT\"}]}", wire: "{\"node\":\"home-server\",\"processes\":[{\"fingerprint\":\"src2:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"kind\":\"service\",\"module\":\"nats\",\"process\":\"nats.service\",\"started\":\"2026-11-09T19:00:00Z\"},{\"kind\":\"container\",\"module\":\"route-proxy\",\"process\":\"route-proxy\",\"started\":\"2026-11-01T08:00:00Z\",\"unknown\":\"started before the node-engine handed MESH_FINGERPRINT\"}]}",
|
||||
decode: func(b []byte) (any, error) { var v ProcessBuildsAnswer; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
|
||||
{name: "process-builds answers an error", subject: "", given: "{\"error\":\"the service manager did not answer\",\"node\":\"ace\",\"processes\":[]}", wire: "{\"error\":\"the service manager did not answer\",\"node\":\"ace\",\"processes\":[]}",
|
||||
{name: "process-builds answers an error", subject: "", given: "{\"error\":\"the service manager did not answer\",\"node\":\"home-server\",\"processes\":[]}", wire: "{\"error\":\"the service manager did not answer\",\"node\":\"home-server\",\"processes\":[]}",
|
||||
decode: func(b []byte) (any, error) { var v ProcessBuildsAnswer; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
|
||||
{name: "first-view-again names the owner, its state and why", subject: "", given: "{\"owner\":\"mesh-delivery-indexer\",\"state\":\"manifests\",\"why\":\"the picture lags the indexer by hand\"}", wire: "{\"owner\":\"mesh-delivery-indexer\",\"state\":\"manifests\",\"why\":\"the picture lags the indexer by hand\"}",
|
||||
decode: func(b []byte) (any, error) { var v FirstViewAgainInput; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
// Package findings is kept empty as a bridge: the modules whose last build before G imported it get a fingerprint
|
||||
// naming their packages' commits only while it is published. It goes once those modules have built under G.
|
||||
package findings
|
||||
@@ -21,17 +21,17 @@ func TestFixtures(t *testing.T) {
|
||||
decode: func(b []byte) (any, error) { var v FindingsAskedEvent; err := json.Unmarshal(b, &v); return v, err }, subjectIs: regexp.MustCompile("^mesh\\.seat\\.mesh-conditions\\.event\\.findings-asked$")},
|
||||
{name: "the keeper asks every observer", subject: "mesh.seat.mesh-conditions.event.findings-asked", given: "{\"ask\":\"a-20261111t100100\",\"at\":\"2026-11-11T10:01:00Z\",\"by\":\"mesh-conditions\"}", wire: "{\"ask\":\"a-20261111t100100\",\"at\":\"2026-11-11T10:01:00Z\",\"by\":\"mesh-conditions\"}",
|
||||
decode: func(b []byte) (any, error) { var v FindingsAskedEvent; err := json.Unmarshal(b, &v); return v, err }, subjectIs: regexp.MustCompile("^mesh\\.seat\\.mesh-conditions\\.event\\.findings-asked$")},
|
||||
{name: "a condition raised with its owner and what it waits on (design 47 G 685)", subject: "mesh.seat.mesh-conditions.event.condition-raised", given: "{\"at\":\"2026-11-11T10:00:00Z\",\"change\":\"raised\",\"event\":\"condition-raised\",\"key\":\"module.mesh-host.ace.directory-used-as-found\",\"kind\":\"directory-used-as-found\",\"owner\":\"forge:operator\",\"resolver\":\"self\",\"severity\":\"warning\",\"source\":\"health-report\",\"subject\":{\"id\":\"mesh-host.ace\",\"machine\":\"ace\",\"scope\":\"module\"},\"summary\":\"a directory waits for a hand\",\"waiting-on\":\"node-engine\"}", wire: "{\"at\":\"2026-11-11T10:00:00Z\",\"change\":\"raised\",\"event\":\"condition-raised\",\"key\":\"module.mesh-host.ace.directory-used-as-found\",\"kind\":\"directory-used-as-found\",\"owner\":\"forge:operator\",\"resolver\":\"self\",\"severity\":\"warning\",\"source\":\"health-report\",\"subject\":{\"id\":\"mesh-host.ace\",\"machine\":\"ace\",\"scope\":\"module\"},\"summary\":\"a directory waits for a hand\",\"waiting-on\":\"node-engine\"}",
|
||||
{name: "a condition raised with its owner and what it waits on (design 47 G 685)", subject: "mesh.seat.mesh-conditions.event.condition-raised", given: "{\"at\":\"2026-11-11T10:00:00Z\",\"change\":\"raised\",\"event\":\"condition-raised\",\"key\":\"module.mesh-host.home-server.directory-used-as-found\",\"kind\":\"directory-used-as-found\",\"owner\":\"forge:operator\",\"resolver\":\"self\",\"severity\":\"warning\",\"source\":\"health-report\",\"subject\":{\"id\":\"mesh-host.home-server\",\"machine\":\"home-server\",\"scope\":\"module\"},\"summary\":\"a directory waits for a hand\",\"waiting-on\":\"node-engine\"}", wire: "{\"at\":\"2026-11-11T10:00:00Z\",\"change\":\"raised\",\"event\":\"condition-raised\",\"key\":\"module.mesh-host.home-server.directory-used-as-found\",\"kind\":\"directory-used-as-found\",\"owner\":\"forge:operator\",\"resolver\":\"self\",\"severity\":\"warning\",\"source\":\"health-report\",\"subject\":{\"id\":\"mesh-host.home-server\",\"machine\":\"home-server\",\"scope\":\"module\"},\"summary\":\"a directory waits for a hand\",\"waiting-on\":\"node-engine\"}",
|
||||
decode: func(b []byte) (any, error) { var v ConditionRaisedEvent; err := json.Unmarshal(b, &v); return v, err }, subjectIs: regexp.MustCompile("^mesh\\.seat\\.mesh-conditions\\.event\\.condition-raised$")},
|
||||
{name: "a condition's owner handed to the operator after two hours (design 47 G 540, A-58)", subject: "mesh.seat.mesh-conditions.event.condition-changed", given: "{\"at\":\"2026-11-11T12:00:00Z\",\"change\":\"owner\",\"event\":\"condition-changed\",\"key\":\"module.mesh-delivery.ace.pipeline-failed\",\"kind\":\"pipeline-failed\",\"owner\":\"operator-channel\",\"resolver\":\"self\",\"severity\":\"warning\",\"source\":\"runner\",\"subject\":{\"id\":\"mesh-delivery.ace\",\"machine\":\"ace\",\"scope\":\"module\"},\"summary\":\"a head failed its pipeline\",\"waiting-on\":\"operator-channel\",\"was\":\"forge:operator\"}", wire: "{\"at\":\"2026-11-11T12:00:00Z\",\"change\":\"owner\",\"event\":\"condition-changed\",\"key\":\"module.mesh-delivery.ace.pipeline-failed\",\"kind\":\"pipeline-failed\",\"owner\":\"operator-channel\",\"resolver\":\"self\",\"severity\":\"warning\",\"source\":\"runner\",\"subject\":{\"id\":\"mesh-delivery.ace\",\"machine\":\"ace\",\"scope\":\"module\"},\"summary\":\"a head failed its pipeline\",\"waiting-on\":\"operator-channel\",\"was\":\"forge:operator\"}",
|
||||
{name: "a condition's owner handed to the operator after two hours (design 47 G 540, A-58)", subject: "mesh.seat.mesh-conditions.event.condition-changed", given: "{\"at\":\"2026-11-11T12:00:00Z\",\"change\":\"owner\",\"event\":\"condition-changed\",\"key\":\"module.mesh-delivery.home-server.pipeline-failed\",\"kind\":\"pipeline-failed\",\"owner\":\"operator-channel\",\"resolver\":\"self\",\"severity\":\"warning\",\"source\":\"runner\",\"subject\":{\"id\":\"mesh-delivery.home-server\",\"machine\":\"home-server\",\"scope\":\"module\"},\"summary\":\"a head failed its pipeline\",\"waiting-on\":\"operator-channel\",\"was\":\"forge:operator\"}", wire: "{\"at\":\"2026-11-11T12:00:00Z\",\"change\":\"owner\",\"event\":\"condition-changed\",\"key\":\"module.mesh-delivery.home-server.pipeline-failed\",\"kind\":\"pipeline-failed\",\"owner\":\"operator-channel\",\"resolver\":\"self\",\"severity\":\"warning\",\"source\":\"runner\",\"subject\":{\"id\":\"mesh-delivery.home-server\",\"machine\":\"home-server\",\"scope\":\"module\"},\"summary\":\"a head failed its pipeline\",\"waiting-on\":\"operator-channel\",\"was\":\"forge:operator\"}",
|
||||
decode: func(b []byte) (any, error) { var v ConditionChangedEvent; err := json.Unmarshal(b, &v); return v, err }, subjectIs: regexp.MustCompile("^mesh\\.seat\\.mesh-conditions\\.event\\.condition-changed$")},
|
||||
{name: "a condition raised from a finding, as the keeper holds it (captured; empty fields left out)", subject: "", given: "{\"count\":1,\"evidence\":[{\"at\":\"2026-10-26T20:19:41.474823121Z\",\"said\":\"mesh-build-node on ace uses mesh-build-node.cache as found: used as found: owned by 10005:10005, mode 700, as found; mesh-build-node, mode 0711 was declared and not given it — `ace/node-engine.hand-over` with the directory's path, then your yes on your channel, with its path, hands it to the mesh\"}],\"explanation\":\"Needs you: hand the directory over from the control-node, as the operator; the details name it and the line to type. A directory of mesh-build-node was already on ace, with another owner or mode than mesh-build-node declares.\",\"headline\":\"mesh-build-node waits for a directory on ace\",\"key\":\"module.mesh-build-node.ace.directory-used-as-found\",\"kind\":\"directory-used-as-found\",\"last-observed\":\"2026-10-26T20:19:41.474823121Z\",\"needs\":\"hand the directory over from the control-node, as the operator; the details name it and the line to type.\",\"observations\":1,\"raised\":\"2026-10-31T08:19:57.076843727Z\",\"resolved\":\"mesh-build-node's directory on ace is the mesh's\",\"resolver\":\"self\",\"severity\":\"warning\",\"source\":\"health-report\",\"subject\":{\"id\":\"mesh-build-node.ace\",\"machine\":\"ace\",\"scope\":\"module\"},\"summary\":\"mesh-build-node on ace uses mesh-build-node.cache as found: used as found: owned by 10005:10005, mode 700, as found; mesh-build-node, mode 0711 was declared and not given it — `ace/node-engine.hand-over` with the directory's path, then your yes on your channel, with its path, hands it to the mesh\"}", wire: "{\"count\":1,\"evidence\":[{\"at\":\"2026-10-26T20:19:41.474823121Z\",\"said\":\"mesh-build-node on ace uses mesh-build-node.cache as found: used as found: owned by 10005:10005, mode 700, as found; mesh-build-node, mode 0711 was declared and not given it — `ace/node-engine.hand-over` with the directory's path, then your yes on your channel, with its path, hands it to the mesh\"}],\"explanation\":\"Needs you: hand the directory over from the control-node, as the operator; the details name it and the line to type. A directory of mesh-build-node was already on ace, with another owner or mode than mesh-build-node declares.\",\"headline\":\"mesh-build-node waits for a directory on ace\",\"key\":\"module.mesh-build-node.ace.directory-used-as-found\",\"kind\":\"directory-used-as-found\",\"last-observed\":\"2026-10-26T20:19:41.474823121Z\",\"needs\":\"hand the directory over from the control-node, as the operator; the details name it and the line to type.\",\"observations\":1,\"raised\":\"2026-10-31T08:19:57.076843727Z\",\"resolved\":\"mesh-build-node's directory on ace is the mesh's\",\"resolver\":\"self\",\"severity\":\"warning\",\"source\":\"health-report\",\"subject\":{\"id\":\"mesh-build-node.ace\",\"machine\":\"ace\",\"scope\":\"module\"},\"summary\":\"mesh-build-node on ace uses mesh-build-node.cache as found: used as found: owned by 10005:10005, mode 700, as found; mesh-build-node, mode 0711 was declared and not given it — `ace/node-engine.hand-over` with the directory's path, then your yes on your channel, with its path, hands it to the mesh\"}",
|
||||
{name: "a condition raised from a finding, as the keeper holds it (captured; empty fields left out)", subject: "", given: "{\"count\":1,\"evidence\":[{\"at\":\"2026-10-26T20:19:41.474823121Z\",\"said\":\"mesh-build-node on home-server uses mesh-build-node.cache as found: used as found: owned by 10005:10005, mode 700, as found; mesh-build-node, mode 0711 was declared and not given it — `home-server/node-engine.hand-over` with the directory's path, then your yes on your channel, with its path, hands it to the mesh\"}],\"explanation\":\"Needs you: hand the directory over from the control-node, as the operator; the details name it and the line to type. A directory of mesh-build-node was already on ace, with another owner or mode than mesh-build-node declares.\",\"headline\":\"mesh-build-node waits for a directory on ace\",\"key\":\"module.mesh-build-node.ace.directory-used-as-found\",\"kind\":\"directory-used-as-found\",\"last-observed\":\"2026-10-26T20:19:41.474823121Z\",\"needs\":\"hand the directory over from the control-node, as the operator; the details name it and the line to type.\",\"observations\":1,\"raised\":\"2026-10-31T08:19:57.076843727Z\",\"resolved\":\"mesh-build-node's directory on ace is the mesh's\",\"resolver\":\"self\",\"severity\":\"warning\",\"source\":\"health-report\",\"subject\":{\"id\":\"mesh-build-node.ace\",\"machine\":\"ace\",\"scope\":\"module\"},\"summary\":\"mesh-build-node on home-server uses mesh-build-node.cache as found: used as found: owned by 10005:10005, mode 700, as found; mesh-build-node, mode 0711 was declared and not given it — `home-server/node-engine.hand-over` with the directory's path, then your yes on your channel, with its path, hands it to the mesh\"}", wire: "{\"count\":1,\"evidence\":[{\"at\":\"2026-10-26T20:19:41.474823121Z\",\"said\":\"mesh-build-node on home-server uses mesh-build-node.cache as found: used as found: owned by 10005:10005, mode 700, as found; mesh-build-node, mode 0711 was declared and not given it — `home-server/node-engine.hand-over` with the directory's path, then your yes on your channel, with its path, hands it to the mesh\"}],\"explanation\":\"Needs you: hand the directory over from the control-node, as the operator; the details name it and the line to type. A directory of mesh-build-node was already on ace, with another owner or mode than mesh-build-node declares.\",\"headline\":\"mesh-build-node waits for a directory on ace\",\"key\":\"module.mesh-build-node.ace.directory-used-as-found\",\"kind\":\"directory-used-as-found\",\"last-observed\":\"2026-10-26T20:19:41.474823121Z\",\"needs\":\"hand the directory over from the control-node, as the operator; the details name it and the line to type.\",\"observations\":1,\"raised\":\"2026-10-31T08:19:57.076843727Z\",\"resolved\":\"mesh-build-node's directory on ace is the mesh's\",\"resolver\":\"self\",\"severity\":\"warning\",\"source\":\"health-report\",\"subject\":{\"id\":\"mesh-build-node.ace\",\"machine\":\"ace\",\"scope\":\"module\"},\"summary\":\"mesh-build-node on home-server uses mesh-build-node.cache as found: used as found: owned by 10005:10005, mode 700, as found; mesh-build-node, mode 0711 was declared and not given it — `home-server/node-engine.hand-over` with the directory's path, then your yes on your channel, with its path, hands it to the mesh\"}",
|
||||
decode: func(b []byte) (any, error) { var v ConditionsByKeyValue; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
|
||||
{name: "a condition with an empty evidence trail of headline (captured; empty fields left out)", subject: "", given: "{\"count\":1,\"evidence\":[{\"at\":\"2026-10-30T13:03:46.432309782Z\",\"said\":\"The backup of postgres failed on ace\"}],\"explanation\":\"Needs you: answer whether to back up again or go on without a backup. The backup before applying postgres at 978b5db8cb4e on ace failed: node-backup.now could not be asked: not asked: nothing on this machine answers mesh.seat.node-backup.tool.now.ace.\",\"headline\":\"The backup of postgres failed on ace\",\"key\":\"module.ace.postgres.978b5db8cb4ef746ce68d82cc616d1439a53266d335e60f368dc44c4cb25610f.backup\",\"kind\":\"backup\",\"last-observed\":\"2026-10-30T13:03:46.432309782Z\",\"needs\":\"answer whether to back up again or go on without a backup\",\"observations\":1,\"raised\":\"2026-10-31T08:19:57.069818178Z\",\"resolver\":\"self\",\"severity\":\"warning\",\"source\":\"assigner.backup\",\"subject\":{\"id\":\"ace.postgres.978b5db8cb4ef746ce68d82cc616d1439a53266d335e60f368dc44c4cb25610f\",\"machine\":\"ace\",\"scope\":\"module\"},\"summary\":\"The backup of postgres failed on ace\"}", wire: "{\"count\":1,\"evidence\":[{\"at\":\"2026-10-30T13:03:46.432309782Z\",\"said\":\"The backup of postgres failed on ace\"}],\"explanation\":\"Needs you: answer whether to back up again or go on without a backup. The backup before applying postgres at 978b5db8cb4e on ace failed: node-backup.now could not be asked: not asked: nothing on this machine answers mesh.seat.node-backup.tool.now.ace.\",\"headline\":\"The backup of postgres failed on ace\",\"key\":\"module.ace.postgres.978b5db8cb4ef746ce68d82cc616d1439a53266d335e60f368dc44c4cb25610f.backup\",\"kind\":\"backup\",\"last-observed\":\"2026-10-30T13:03:46.432309782Z\",\"needs\":\"answer whether to back up again or go on without a backup\",\"observations\":1,\"raised\":\"2026-10-31T08:19:57.069818178Z\",\"resolver\":\"self\",\"severity\":\"warning\",\"source\":\"assigner.backup\",\"subject\":{\"id\":\"ace.postgres.978b5db8cb4ef746ce68d82cc616d1439a53266d335e60f368dc44c4cb25610f\",\"machine\":\"ace\",\"scope\":\"module\"},\"summary\":\"The backup of postgres failed on ace\"}",
|
||||
decode: func(b []byte) (any, error) { var v ConditionsByKeyValue; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
|
||||
{name: "a condition carrying its finding's owner, a session, and what it waits on, a seat (design 47 G 685)", subject: "", given: "{\"count\":1,\"evidence\":[{\"at\":\"2026-10-26T20:19:41.474823121Z\",\"said\":\"mesh-build-node on ace uses mesh-build-node.cache as found: used as found: owned by 10005:10005, mode 700, as found; mesh-build-node, mode 0711 was declared and not given it — `ace/node-engine.hand-over` with the directory's path, then your yes on your channel, with its path, hands it to the mesh\"}],\"explanation\":\"Needs you: hand the directory over from the control-node, as the operator; the details name it and the line to type. A directory of mesh-build-node was already on ace, with another owner or mode than mesh-build-node declares.\",\"headline\":\"mesh-build-node waits for a directory on ace\",\"key\":\"module.mesh-build-node.ace.directory-used-as-found\",\"kind\":\"directory-used-as-found\",\"last-observed\":\"2026-10-26T20:19:41.474823121Z\",\"needs\":\"hand the directory over from the control-node, as the operator; the details name it and the line to type.\",\"observations\":1,\"owner\":\"operator@workstation\",\"raised\":\"2026-10-31T08:19:57.076843727Z\",\"resolved\":\"mesh-build-node's directory on ace is the mesh's\",\"resolver\":\"self\",\"severity\":\"warning\",\"source\":\"health-report\",\"subject\":{\"id\":\"mesh-build-node.ace\",\"machine\":\"ace\",\"scope\":\"module\"},\"summary\":\"mesh-build-node on ace uses mesh-build-node.cache as found: used as found: owned by 10005:10005, mode 700, as found; mesh-build-node, mode 0711 was declared and not given it — `ace/node-engine.hand-over` with the directory's path, then your yes on your channel, with its path, hands it to the mesh\",\"waiting-on\":\"node-engine\"}", wire: "{\"count\":1,\"evidence\":[{\"at\":\"2026-10-26T20:19:41.474823121Z\",\"said\":\"mesh-build-node on ace uses mesh-build-node.cache as found: used as found: owned by 10005:10005, mode 700, as found; mesh-build-node, mode 0711 was declared and not given it — `ace/node-engine.hand-over` with the directory's path, then your yes on your channel, with its path, hands it to the mesh\"}],\"explanation\":\"Needs you: hand the directory over from the control-node, as the operator; the details name it and the line to type. A directory of mesh-build-node was already on ace, with another owner or mode than mesh-build-node declares.\",\"headline\":\"mesh-build-node waits for a directory on ace\",\"key\":\"module.mesh-build-node.ace.directory-used-as-found\",\"kind\":\"directory-used-as-found\",\"last-observed\":\"2026-10-26T20:19:41.474823121Z\",\"needs\":\"hand the directory over from the control-node, as the operator; the details name it and the line to type.\",\"observations\":1,\"owner\":\"operator@workstation\",\"raised\":\"2026-10-31T08:19:57.076843727Z\",\"resolved\":\"mesh-build-node's directory on ace is the mesh's\",\"resolver\":\"self\",\"severity\":\"warning\",\"source\":\"health-report\",\"subject\":{\"id\":\"mesh-build-node.ace\",\"machine\":\"ace\",\"scope\":\"module\"},\"summary\":\"mesh-build-node on ace uses mesh-build-node.cache as found: used as found: owned by 10005:10005, mode 700, as found; mesh-build-node, mode 0711 was declared and not given it — `ace/node-engine.hand-over` with the directory's path, then your yes on your channel, with its path, hands it to the mesh\",\"waiting-on\":\"node-engine\"}",
|
||||
{name: "a condition carrying its finding's owner, a session, and what it waits on, a seat (design 47 G 685)", subject: "", given: "{\"count\":1,\"evidence\":[{\"at\":\"2026-10-26T20:19:41.474823121Z\",\"said\":\"mesh-build-node on home-server uses mesh-build-node.cache as found: used as found: owned by 10005:10005, mode 700, as found; mesh-build-node, mode 0711 was declared and not given it — `home-server/node-engine.hand-over` with the directory's path, then your yes on your channel, with its path, hands it to the mesh\"}],\"explanation\":\"Needs you: hand the directory over from the control-node, as the operator; the details name it and the line to type. A directory of mesh-build-node was already on home-server, with another owner or mode than mesh-build-node declares.\",\"headline\":\"mesh-build-node waits for a directory on home-server\",\"key\":\"module.mesh-build-node.home-server.directory-used-as-found\",\"kind\":\"directory-used-as-found\",\"last-observed\":\"2026-10-26T20:19:41.474823121Z\",\"needs\":\"hand the directory over from the control-node, as the operator; the details name it and the line to type.\",\"observations\":1,\"owner\":\"operator@workstation\",\"raised\":\"2026-10-31T08:19:57.076843727Z\",\"resolved\":\"mesh-build-node's directory on home-server is the mesh's\",\"resolver\":\"self\",\"severity\":\"warning\",\"source\":\"health-report\",\"subject\":{\"id\":\"mesh-build-node.home-server\",\"machine\":\"home-server\",\"scope\":\"module\"},\"summary\":\"mesh-build-node on home-server uses mesh-build-node.cache as found: used as found: owned by 10005:10005, mode 700, as found; mesh-build-node, mode 0711 was declared and not given it — `home-server/node-engine.hand-over` with the directory's path, then your yes on your channel, with its path, hands it to the mesh\",\"waiting-on\":\"node-engine\"}", wire: "{\"count\":1,\"evidence\":[{\"at\":\"2026-10-26T20:19:41.474823121Z\",\"said\":\"mesh-build-node on home-server uses mesh-build-node.cache as found: used as found: owned by 10005:10005, mode 700, as found; mesh-build-node, mode 0711 was declared and not given it — `home-server/node-engine.hand-over` with the directory's path, then your yes on your channel, with its path, hands it to the mesh\"}],\"explanation\":\"Needs you: hand the directory over from the control-node, as the operator; the details name it and the line to type. A directory of mesh-build-node was already on home-server, with another owner or mode than mesh-build-node declares.\",\"headline\":\"mesh-build-node waits for a directory on home-server\",\"key\":\"module.mesh-build-node.home-server.directory-used-as-found\",\"kind\":\"directory-used-as-found\",\"last-observed\":\"2026-10-26T20:19:41.474823121Z\",\"needs\":\"hand the directory over from the control-node, as the operator; the details name it and the line to type.\",\"observations\":1,\"owner\":\"operator@workstation\",\"raised\":\"2026-10-31T08:19:57.076843727Z\",\"resolved\":\"mesh-build-node's directory on home-server is the mesh's\",\"resolver\":\"self\",\"severity\":\"warning\",\"source\":\"health-report\",\"subject\":{\"id\":\"mesh-build-node.home-server\",\"machine\":\"home-server\",\"scope\":\"module\"},\"summary\":\"mesh-build-node on home-server uses mesh-build-node.cache as found: used as found: owned by 10005:10005, mode 700, as found; mesh-build-node, mode 0711 was declared and not given it — `home-server/node-engine.hand-over` with the directory's path, then your yes on your channel, with its path, hands it to the mesh\",\"waiting-on\":\"node-engine\"}",
|
||||
decode: func(b []byte) (any, error) { var v ConditionsByKeyValue; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
|
||||
{name: "a condition owned by a commit's author, handed to operator-channel when the keeper hands it over (design 47 G 685, 540)", subject: "", given: "{\"count\":1,\"evidence\":[{\"at\":\"2026-10-26T20:19:41.474823121Z\",\"said\":\"mesh-build-node on ace uses mesh-build-node.cache as found: used as found: owned by 10005:10005, mode 700, as found; mesh-build-node, mode 0711 was declared and not given it — `ace/node-engine.hand-over` with the directory's path, then your yes on your channel, with its path, hands it to the mesh\"}],\"explanation\":\"Needs you: hand the directory over from the control-node, as the operator; the details name it and the line to type. A directory of mesh-build-node was already on ace, with another owner or mode than mesh-build-node declares.\",\"headline\":\"mesh-build-node waits for a directory on ace\",\"key\":\"module.mesh-build-node.ace.directory-used-as-found\",\"kind\":\"directory-used-as-found\",\"last-observed\":\"2026-10-26T20:19:41.474823121Z\",\"needs\":\"hand the directory over from the control-node, as the operator; the details name it and the line to type.\",\"observations\":1,\"owner\":\"operator-channel\",\"raised\":\"2026-10-31T08:19:57.076843727Z\",\"resolved\":\"mesh-build-node's directory on ace is the mesh's\",\"resolver\":\"self\",\"severity\":\"warning\",\"source\":\"health-report\",\"subject\":{\"id\":\"mesh-build-node.ace\",\"machine\":\"ace\",\"scope\":\"module\"},\"summary\":\"mesh-build-node on ace uses mesh-build-node.cache as found: used as found: owned by 10005:10005, mode 700, as found; mesh-build-node, mode 0711 was declared and not given it — `ace/node-engine.hand-over` with the directory's path, then your yes on your channel, with its path, hands it to the mesh\",\"waiting-on\":\"forge:operator\"}", wire: "{\"count\":1,\"evidence\":[{\"at\":\"2026-10-26T20:19:41.474823121Z\",\"said\":\"mesh-build-node on ace uses mesh-build-node.cache as found: used as found: owned by 10005:10005, mode 700, as found; mesh-build-node, mode 0711 was declared and not given it — `ace/node-engine.hand-over` with the directory's path, then your yes on your channel, with its path, hands it to the mesh\"}],\"explanation\":\"Needs you: hand the directory over from the control-node, as the operator; the details name it and the line to type. A directory of mesh-build-node was already on ace, with another owner or mode than mesh-build-node declares.\",\"headline\":\"mesh-build-node waits for a directory on ace\",\"key\":\"module.mesh-build-node.ace.directory-used-as-found\",\"kind\":\"directory-used-as-found\",\"last-observed\":\"2026-10-26T20:19:41.474823121Z\",\"needs\":\"hand the directory over from the control-node, as the operator; the details name it and the line to type.\",\"observations\":1,\"owner\":\"operator-channel\",\"raised\":\"2026-10-31T08:19:57.076843727Z\",\"resolved\":\"mesh-build-node's directory on ace is the mesh's\",\"resolver\":\"self\",\"severity\":\"warning\",\"source\":\"health-report\",\"subject\":{\"id\":\"mesh-build-node.ace\",\"machine\":\"ace\",\"scope\":\"module\"},\"summary\":\"mesh-build-node on ace uses mesh-build-node.cache as found: used as found: owned by 10005:10005, mode 700, as found; mesh-build-node, mode 0711 was declared and not given it — `ace/node-engine.hand-over` with the directory's path, then your yes on your channel, with its path, hands it to the mesh\",\"waiting-on\":\"forge:operator\"}",
|
||||
{name: "a condition owned by a commit's author, handed to operator-channel when the keeper hands it over (design 47 G 685, 540)", subject: "", given: "{\"count\":1,\"evidence\":[{\"at\":\"2026-10-26T20:19:41.474823121Z\",\"said\":\"mesh-build-node on home-server uses mesh-build-node.cache as found: used as found: owned by 10005:10005, mode 700, as found; mesh-build-node, mode 0711 was declared and not given it — `home-server/node-engine.hand-over` with the directory's path, then your yes on your channel, with its path, hands it to the mesh\"}],\"explanation\":\"Needs you: hand the directory over from the control-node, as the operator; the details name it and the line to type. A directory of mesh-build-node was already on home-server, with another owner or mode than mesh-build-node declares.\",\"headline\":\"mesh-build-node waits for a directory on home-server\",\"key\":\"module.mesh-build-node.home-server.directory-used-as-found\",\"kind\":\"directory-used-as-found\",\"last-observed\":\"2026-10-26T20:19:41.474823121Z\",\"needs\":\"hand the directory over from the control-node, as the operator; the details name it and the line to type.\",\"observations\":1,\"owner\":\"operator-channel\",\"raised\":\"2026-10-31T08:19:57.076843727Z\",\"resolved\":\"mesh-build-node's directory on home-server is the mesh's\",\"resolver\":\"self\",\"severity\":\"warning\",\"source\":\"health-report\",\"subject\":{\"id\":\"mesh-build-node.home-server\",\"machine\":\"home-server\",\"scope\":\"module\"},\"summary\":\"mesh-build-node on home-server uses mesh-build-node.cache as found: used as found: owned by 10005:10005, mode 700, as found; mesh-build-node, mode 0711 was declared and not given it — `home-server/node-engine.hand-over` with the directory's path, then your yes on your channel, with its path, hands it to the mesh\",\"waiting-on\":\"forge:operator\"}", wire: "{\"count\":1,\"evidence\":[{\"at\":\"2026-10-26T20:19:41.474823121Z\",\"said\":\"mesh-build-node on home-server uses mesh-build-node.cache as found: used as found: owned by 10005:10005, mode 700, as found; mesh-build-node, mode 0711 was declared and not given it — `home-server/node-engine.hand-over` with the directory's path, then your yes on your channel, with its path, hands it to the mesh\"}],\"explanation\":\"Needs you: hand the directory over from the control-node, as the operator; the details name it and the line to type. A directory of mesh-build-node was already on home-server, with another owner or mode than mesh-build-node declares.\",\"headline\":\"mesh-build-node waits for a directory on home-server\",\"key\":\"module.mesh-build-node.home-server.directory-used-as-found\",\"kind\":\"directory-used-as-found\",\"last-observed\":\"2026-10-26T20:19:41.474823121Z\",\"needs\":\"hand the directory over from the control-node, as the operator; the details name it and the line to type.\",\"observations\":1,\"owner\":\"operator-channel\",\"raised\":\"2026-10-31T08:19:57.076843727Z\",\"resolved\":\"mesh-build-node's directory on home-server is the mesh's\",\"resolver\":\"self\",\"severity\":\"warning\",\"source\":\"health-report\",\"subject\":{\"id\":\"mesh-build-node.home-server\",\"machine\":\"home-server\",\"scope\":\"module\"},\"summary\":\"mesh-build-node on home-server uses mesh-build-node.cache as found: used as found: owned by 10005:10005, mode 700, as found; mesh-build-node, mode 0711 was declared and not given it — `home-server/node-engine.hand-over` with the directory's path, then your yes on your channel, with its path, hands it to the mesh\",\"waiting-on\":\"forge:operator\"}",
|
||||
decode: func(b []byte) (any, error) { var v ConditionsByKeyValue; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
|
||||
{name: "a finding of the bus scope with its zero time (in the finding layout (design 47 G 660))", subject: "", given: "{\"at\":\"0001-01-01T00:00:00Z\",\"evidence\":[{\"at\":\"0001-01-01T00:00:00Z\",\"said\":\"1 held for EVENTS.controller (counted again every 5m0s while any is held, so one delivered again or dropped ends this within it)\"}],\"id\":\"EVENTS.controller\",\"kind\":\"max-deliveries\",\"needs\":\"deliver them again or drop them, from the mesh MCP server.\",\"observer\":\"mesh-delivery-watchman\",\"scope\":\"bus\",\"severity\":\"warning\",\"since\":\"0001-01-01T00:00:00Z\",\"source\":\"S9\",\"subject\":{\"id\":\"EVENTS.controller\",\"scope\":\"bus\"},\"summary\":\"the controller's consumer on EVENTS gave up on a message; it is kept in DEAD_LETTERS until delivered again or dropped, with why\"}", wire: "{\"at\":\"0001-01-01T00:00:00Z\",\"evidence\":[{\"at\":\"0001-01-01T00:00:00Z\",\"said\":\"1 held for EVENTS.controller (counted again every 5m0s while any is held, so one delivered again or dropped ends this within it)\"}],\"id\":\"EVENTS.controller\",\"kind\":\"max-deliveries\",\"needs\":\"deliver them again or drop them, from the mesh MCP server.\",\"observer\":\"mesh-delivery-watchman\",\"scope\":\"bus\",\"severity\":\"warning\",\"since\":\"0001-01-01T00:00:00Z\",\"source\":\"S9\",\"subject\":{\"id\":\"EVENTS.controller\",\"scope\":\"bus\"},\"summary\":\"the controller's consumer on EVENTS gave up on a message; it is kept in DEAD_LETTERS until delivered again or dropped, with why\"}",
|
||||
decode: func(b []byte) (any, error) {
|
||||
@@ -39,19 +39,19 @@ func TestFixtures(t *testing.T) {
|
||||
err := json.Unmarshal(b, &v)
|
||||
return v, err
|
||||
}, subjectIs: nil},
|
||||
{name: "a finding of the module scope with its machine (in the finding layout (design 47 G 660))", subject: "", given: "{\"at\":\"2026-10-26T20:19:41.474823121Z\",\"evidence\":[{\"at\":\"2026-10-26T20:19:41.474823121Z\",\"said\":\"mesh-build-node on ace uses mesh-build-node.cache as found: owned by 10005:10005, mode 700, as found\"}],\"explanation\":\"Needs you: hand the directory over from the control-node, as the operator.\",\"headline\":\"mesh-build-node waits for a directory on ace\",\"id\":\"mesh-build-node.ace\",\"kind\":\"directory-used-as-found\",\"needs\":\"hand the directory over from the control-node, as the operator; the details name it and the line to type.\",\"observer\":\"mesh-delivery-watchman\",\"scope\":\"module\",\"severity\":\"warning\",\"since\":\"2026-10-26T20:19:41.474823121Z\",\"source\":\"health-report\",\"subject\":{\"id\":\"mesh-build-node.ace\",\"machine\":\"ace\",\"scope\":\"module\"},\"summary\":\"mesh-build-node on ace uses mesh-build-node.cache as found\"}", wire: "{\"at\":\"2026-10-26T20:19:41.474823121Z\",\"evidence\":[{\"at\":\"2026-10-26T20:19:41.474823121Z\",\"said\":\"mesh-build-node on ace uses mesh-build-node.cache as found: owned by 10005:10005, mode 700, as found\"}],\"explanation\":\"Needs you: hand the directory over from the control-node, as the operator.\",\"headline\":\"mesh-build-node waits for a directory on ace\",\"id\":\"mesh-build-node.ace\",\"kind\":\"directory-used-as-found\",\"needs\":\"hand the directory over from the control-node, as the operator; the details name it and the line to type.\",\"observer\":\"mesh-delivery-watchman\",\"scope\":\"module\",\"severity\":\"warning\",\"since\":\"2026-10-26T20:19:41.474823121Z\",\"source\":\"health-report\",\"subject\":{\"id\":\"mesh-build-node.ace\",\"machine\":\"ace\",\"scope\":\"module\"},\"summary\":\"mesh-build-node on ace uses mesh-build-node.cache as found\"}",
|
||||
{name: "a finding of the module scope with its machine (in the finding layout (design 47 G 660))", subject: "", given: "{\"at\":\"2026-10-26T20:19:41.474823121Z\",\"evidence\":[{\"at\":\"2026-10-26T20:19:41.474823121Z\",\"said\":\"mesh-build-node on ace uses mesh-build-node.cache as found: owned by 10005:10005, mode 700, as found\"}],\"explanation\":\"Needs you: hand the directory over from the control-node, as the operator.\",\"headline\":\"mesh-build-node waits for a directory on ace\",\"id\":\"mesh-build-node.home-server\",\"kind\":\"directory-used-as-found\",\"needs\":\"hand the directory over from the control-node, as the operator; the details name it and the line to type.\",\"observer\":\"mesh-delivery-watchman\",\"scope\":\"module\",\"severity\":\"warning\",\"since\":\"2026-10-26T20:19:41.474823121Z\",\"source\":\"health-report\",\"subject\":{\"id\":\"mesh-build-node.ace\",\"machine\":\"ace\",\"scope\":\"module\"},\"summary\":\"mesh-build-node on ace uses mesh-build-node.cache as found\"}", wire: "{\"at\":\"2026-10-26T20:19:41.474823121Z\",\"evidence\":[{\"at\":\"2026-10-26T20:19:41.474823121Z\",\"said\":\"mesh-build-node on ace uses mesh-build-node.cache as found: owned by 10005:10005, mode 700, as found\"}],\"explanation\":\"Needs you: hand the directory over from the control-node, as the operator.\",\"headline\":\"mesh-build-node waits for a directory on ace\",\"id\":\"mesh-build-node.home-server\",\"kind\":\"directory-used-as-found\",\"needs\":\"hand the directory over from the control-node, as the operator; the details name it and the line to type.\",\"observer\":\"mesh-delivery-watchman\",\"scope\":\"module\",\"severity\":\"warning\",\"since\":\"2026-10-26T20:19:41.474823121Z\",\"source\":\"health-report\",\"subject\":{\"id\":\"mesh-build-node.ace\",\"machine\":\"ace\",\"scope\":\"module\"},\"summary\":\"mesh-build-node on ace uses mesh-build-node.cache as found\"}",
|
||||
decode: func(b []byte) (any, error) {
|
||||
var v FindingsByScopeIDKindValue
|
||||
err := json.Unmarshal(b, &v)
|
||||
return v, err
|
||||
}, subjectIs: nil},
|
||||
{name: "a finding owned by a session and waiting on a seat (design 47 G 678)", subject: "", given: "{\"at\":\"2026-11-11T10:00:00Z\",\"id\":\"mesh-host.ace\",\"kind\":\"directory-used-as-found\",\"observer\":\"mesh-delivery-watchman\",\"owner\":\"operator@workstation\",\"scope\":\"module\",\"severity\":\"warning\",\"since\":\"2026-11-11T10:00:00Z\",\"source\":\"health-report\",\"subject\":{\"id\":\"mesh-host.ace\",\"machine\":\"ace\",\"scope\":\"module\"},\"summary\":\"a directory waits for a hand\",\"waiting-on\":\"node-engine\"}", wire: "{\"at\":\"2026-11-11T10:00:00Z\",\"id\":\"mesh-host.ace\",\"kind\":\"directory-used-as-found\",\"observer\":\"mesh-delivery-watchman\",\"owner\":\"operator@workstation\",\"scope\":\"module\",\"severity\":\"warning\",\"since\":\"2026-11-11T10:00:00Z\",\"source\":\"health-report\",\"subject\":{\"id\":\"mesh-host.ace\",\"machine\":\"ace\",\"scope\":\"module\"},\"summary\":\"a directory waits for a hand\",\"waiting-on\":\"node-engine\"}",
|
||||
{name: "a finding owned by a session and waiting on a seat (design 47 G 678)", subject: "", given: "{\"at\":\"2026-11-11T10:00:00Z\",\"id\":\"mesh-host.home-server\",\"kind\":\"directory-used-as-found\",\"observer\":\"mesh-delivery-watchman\",\"owner\":\"operator@workstation\",\"scope\":\"module\",\"severity\":\"warning\",\"since\":\"2026-11-11T10:00:00Z\",\"source\":\"health-report\",\"subject\":{\"id\":\"mesh-host.home-server\",\"machine\":\"home-server\",\"scope\":\"module\"},\"summary\":\"a directory waits for a hand\",\"waiting-on\":\"node-engine\"}", wire: "{\"at\":\"2026-11-11T10:00:00Z\",\"id\":\"mesh-host.home-server\",\"kind\":\"directory-used-as-found\",\"observer\":\"mesh-delivery-watchman\",\"owner\":\"operator@workstation\",\"scope\":\"module\",\"severity\":\"warning\",\"since\":\"2026-11-11T10:00:00Z\",\"source\":\"health-report\",\"subject\":{\"id\":\"mesh-host.home-server\",\"machine\":\"home-server\",\"scope\":\"module\"},\"summary\":\"a directory waits for a hand\",\"waiting-on\":\"node-engine\"}",
|
||||
decode: func(b []byte) (any, error) {
|
||||
var v FindingsByScopeIDKindValue
|
||||
err := json.Unmarshal(b, &v)
|
||||
return v, err
|
||||
}, subjectIs: nil},
|
||||
{name: "a finding owned by a seat and waiting on a commit's author (design 47 G 678, 540)", subject: "", given: "{\"at\":\"2026-11-11T10:00:00Z\",\"id\":\"mesh-host.ace\",\"kind\":\"directory-used-as-found\",\"observer\":\"mesh-delivery-watchman\",\"owner\":\"node-engine\",\"scope\":\"module\",\"severity\":\"warning\",\"since\":\"2026-11-11T10:00:00Z\",\"source\":\"health-report\",\"subject\":{\"id\":\"mesh-host.ace\",\"machine\":\"ace\",\"scope\":\"module\"},\"summary\":\"a directory waits for a hand\",\"waiting-on\":\"forge:operator\"}", wire: "{\"at\":\"2026-11-11T10:00:00Z\",\"id\":\"mesh-host.ace\",\"kind\":\"directory-used-as-found\",\"observer\":\"mesh-delivery-watchman\",\"owner\":\"node-engine\",\"scope\":\"module\",\"severity\":\"warning\",\"since\":\"2026-11-11T10:00:00Z\",\"source\":\"health-report\",\"subject\":{\"id\":\"mesh-host.ace\",\"machine\":\"ace\",\"scope\":\"module\"},\"summary\":\"a directory waits for a hand\",\"waiting-on\":\"forge:operator\"}",
|
||||
{name: "a finding owned by a seat and waiting on a commit's author (design 47 G 678, 540)", subject: "", given: "{\"at\":\"2026-11-11T10:00:00Z\",\"id\":\"mesh-host.home-server\",\"kind\":\"directory-used-as-found\",\"observer\":\"mesh-delivery-watchman\",\"owner\":\"node-engine\",\"scope\":\"module\",\"severity\":\"warning\",\"since\":\"2026-11-11T10:00:00Z\",\"source\":\"health-report\",\"subject\":{\"id\":\"mesh-host.home-server\",\"machine\":\"home-server\",\"scope\":\"module\"},\"summary\":\"a directory waits for a hand\",\"waiting-on\":\"forge:operator\"}", wire: "{\"at\":\"2026-11-11T10:00:00Z\",\"id\":\"mesh-host.home-server\",\"kind\":\"directory-used-as-found\",\"observer\":\"mesh-delivery-watchman\",\"owner\":\"node-engine\",\"scope\":\"module\",\"severity\":\"warning\",\"since\":\"2026-11-11T10:00:00Z\",\"source\":\"health-report\",\"subject\":{\"id\":\"mesh-host.home-server\",\"machine\":\"home-server\",\"scope\":\"module\"},\"summary\":\"a directory waits for a hand\",\"waiting-on\":\"forge:operator\"}",
|
||||
decode: func(b []byte) (any, error) {
|
||||
var v FindingsByScopeIDKindValue
|
||||
err := json.Unmarshal(b, &v)
|
||||
|
||||
@@ -17,9 +17,9 @@ func TestFixtures(t *testing.T) {
|
||||
decode func([]byte) (any, error)
|
||||
subjectIs *regexp.Regexp
|
||||
}{
|
||||
{name: "an attempt begun, said with its end (design 47 G 665)", subject: "mesh.seat.mesh-healers.event.attempt-changed.c-1.a-1", given: "{\"act\":\"hand-over\",\"begun\":\"2026-11-11T10:00:00Z\",\"budget-key\":\"module.mesh-host.ace.directory-used-as-found\",\"condition\":\"module.mesh-host.ace.directory-used-as-found\",\"healer\":\"directory\",\"kind\":\"directory-used-as-found\",\"outcome\":\"acting\",\"until\":\"2026-11-11T12:00:00Z\"}", wire: "{\"act\":\"hand-over\",\"begun\":\"2026-11-11T10:00:00Z\",\"budget-key\":\"module.mesh-host.ace.directory-used-as-found\",\"condition\":\"module.mesh-host.ace.directory-used-as-found\",\"healer\":\"directory\",\"kind\":\"directory-used-as-found\",\"outcome\":\"acting\",\"until\":\"2026-11-11T12:00:00Z\"}",
|
||||
{name: "an attempt begun, said with its end (design 47 G 665)", subject: "mesh.seat.mesh-healers.event.attempt-changed.c-1.a-1", given: "{\"act\":\"hand-over\",\"begun\":\"2026-11-11T10:00:00Z\",\"budget-key\":\"module.mesh-host.home-server.directory-used-as-found\",\"condition\":\"module.mesh-host.home-server.directory-used-as-found\",\"healer\":\"directory\",\"kind\":\"directory-used-as-found\",\"outcome\":\"acting\",\"until\":\"2026-11-11T12:00:00Z\"}", wire: "{\"act\":\"hand-over\",\"begun\":\"2026-11-11T10:00:00Z\",\"budget-key\":\"module.mesh-host.home-server.directory-used-as-found\",\"condition\":\"module.mesh-host.home-server.directory-used-as-found\",\"healer\":\"directory\",\"kind\":\"directory-used-as-found\",\"outcome\":\"acting\",\"until\":\"2026-11-11T12:00:00Z\"}",
|
||||
decode: func(b []byte) (any, error) { var v AttemptChangedEvent; err := json.Unmarshal(b, &v); return v, err }, subjectIs: regexp.MustCompile("^mesh\\.seat\\.mesh-healers\\.event\\.attempt-changed\\.[^.*> ]+\\.[^.*> ]+$")},
|
||||
{name: "an attempt ended by its healer", subject: "mesh.seat.mesh-healers.event.attempt-changed.c-1.a-1", given: "{\"condition\":\"module.mesh-host.ace.directory-used-as-found\",\"removed\":true}", wire: "{\"condition\":\"module.mesh-host.ace.directory-used-as-found\",\"removed\":true}",
|
||||
{name: "an attempt ended by its healer", subject: "mesh.seat.mesh-healers.event.attempt-changed.c-1.a-1", given: "{\"condition\":\"module.mesh-host.home-server.directory-used-as-found\",\"removed\":true}", wire: "{\"condition\":\"module.mesh-host.home-server.directory-used-as-found\",\"removed\":true}",
|
||||
decode: func(b []byte) (any, error) { var v AttemptChangedEvent; err := json.Unmarshal(b, &v); return v, err }, subjectIs: regexp.MustCompile("^mesh\\.seat\\.mesh-healers\\.event\\.attempt-changed\\.[^.*> ]+\\.[^.*> ]+$")},
|
||||
{name: "an act a healer would have made, kept from the controller's time (captured)", subject: "", given: "{\"act\":\"assert the module's buckets, logs and streams again through the grants part (grants_assert)\",\"at\":\"2026-11-02T08:15:56.49507336Z\",\"condition\":\"bus.EVENTS.4fs9xzyDY7CD2Cf1wVFYDK_1.consumer-lost\",\"healer\":\"H3\",\"kind\":\"consumer-lost\",\"why\":\"the controller's lease names a controller (or none is written, so one may take it): every act is written as would\"}", wire: "{\"act\":\"assert the module's buckets, logs and streams again through the grants part (grants_assert)\",\"at\":\"2026-11-02T08:15:56.49507336Z\",\"condition\":\"bus.EVENTS.4fs9xzyDY7CD2Cf1wVFYDK_1.consumer-lost\",\"healer\":\"H3\",\"kind\":\"consumer-lost\",\"why\":\"the controller's lease names a controller (or none is written, so one may take it): every act is written as would\"}",
|
||||
decode: func(b []byte) (any, error) { var v WouldByWouldValue; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
|
||||
|
||||
@@ -17,9 +17,9 @@ func TestFixtures(t *testing.T) {
|
||||
decode func([]byte) (any, error)
|
||||
subjectIs *regexp.Regexp
|
||||
}{
|
||||
{name: "a machine's presence expired", subject: "mesh.seat.mesh-watchdogs.event.machine-away.g14", given: "{\"at\":\"2026-11-11T10:00:00Z\",\"last-heard\":\"2026-11-11T09:58:00Z\",\"machine\":\"g14\",\"v\":1}", wire: "{\"at\":\"2026-11-11T10:00:00Z\",\"last-heard\":\"2026-11-11T09:58:00Z\",\"machine\":\"g14\",\"v\":1}",
|
||||
{name: "a machine's presence expired", subject: "mesh.seat.mesh-watchdogs.event.machine-away.laptop", given: "{\"at\":\"2026-11-11T10:00:00Z\",\"last-heard\":\"2026-11-11T09:58:00Z\",\"machine\":\"laptop\",\"v\":1}", wire: "{\"at\":\"2026-11-11T10:00:00Z\",\"last-heard\":\"2026-11-11T09:58:00Z\",\"machine\":\"laptop\",\"v\":1}",
|
||||
decode: func(b []byte) (any, error) { var v MachineAwayEvent; err := json.Unmarshal(b, &v); return v, err }, subjectIs: regexp.MustCompile("^mesh\\.seat\\.mesh-watchdogs\\.event\\.machine-away\\.[^.*> ]+$")},
|
||||
{name: "a machine heard again", subject: "mesh.seat.mesh-watchdogs.event.machine-back.g14", given: "{\"at\":\"2026-11-11T10:30:00Z\",\"last-heard\":\"2026-11-11T10:30:00Z\",\"machine\":\"g14\",\"v\":1}", wire: "{\"at\":\"2026-11-11T10:30:00Z\",\"last-heard\":\"2026-11-11T10:30:00Z\",\"machine\":\"g14\",\"v\":1}",
|
||||
{name: "a machine heard again", subject: "mesh.seat.mesh-watchdogs.event.machine-back.laptop", given: "{\"at\":\"2026-11-11T10:30:00Z\",\"last-heard\":\"2026-11-11T10:30:00Z\",\"machine\":\"laptop\",\"v\":1}", wire: "{\"at\":\"2026-11-11T10:30:00Z\",\"last-heard\":\"2026-11-11T10:30:00Z\",\"machine\":\"laptop\",\"v\":1}",
|
||||
decode: func(b []byte) (any, error) { var v MachineBackEvent; err := json.Unmarshal(b, &v); return v, err }, subjectIs: regexp.MustCompile("^mesh\\.seat\\.mesh-watchdogs\\.event\\.machine-back\\.[^.*> ]+$")},
|
||||
{name: "a node's agent online (captured)", subject: "", given: "{\"online\":true,\"v\":1}", wire: "{\"online\":true,\"v\":1}",
|
||||
decode: func(b []byte) (any, error) { var v PresenceByNodeValue; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
|
||||
|
||||
@@ -25,12 +25,12 @@
|
||||
"of": "event:condition-raised",
|
||||
"subject": "mesh.seat.mesh-conditions.event.condition-raised",
|
||||
"given": {
|
||||
"key": "module.mesh-host.ace.directory-used-as-found",
|
||||
"key": "module.mesh-host.home-server.directory-used-as-found",
|
||||
"kind": "directory-used-as-found",
|
||||
"subject": {
|
||||
"scope": "module",
|
||||
"id": "mesh-host.ace",
|
||||
"machine": "ace"
|
||||
"id": "mesh-host.home-server",
|
||||
"machine": "home-server"
|
||||
},
|
||||
"severity": "warning",
|
||||
"summary": "a directory waits for a hand",
|
||||
@@ -48,12 +48,12 @@
|
||||
"of": "event:condition-changed",
|
||||
"subject": "mesh.seat.mesh-conditions.event.condition-changed",
|
||||
"given": {
|
||||
"key": "module.mesh-delivery.ace.pipeline-failed",
|
||||
"key": "module.mesh-delivery.home-server.pipeline-failed",
|
||||
"kind": "pipeline-failed",
|
||||
"subject": {
|
||||
"scope": "module",
|
||||
"id": "mesh-delivery.ace",
|
||||
"machine": "ace"
|
||||
"id": "mesh-delivery.home-server",
|
||||
"machine": "home-server"
|
||||
},
|
||||
"severity": "warning",
|
||||
"summary": "a head failed its pipeline",
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
"evidence": [
|
||||
{
|
||||
"at": "2026-10-26T20:19:41.474823121Z",
|
||||
"said": "mesh-build-node on ace uses mesh-build-node.cache as found: used as found: owned by 10005:10005, mode 700, as found; mesh-build-node, mode 0711 was declared and not given it — `ace/node-engine.hand-over` with the directory's path, then your yes on your channel, with its path, hands it to the mesh"
|
||||
"said": "mesh-build-node on home-server uses mesh-build-node.cache as found: used as found: owned by 10005:10005, mode 700, as found; mesh-build-node, mode 0711 was declared and not given it — `home-server/node-engine.hand-over` with the directory's path, then your yes on your channel, with its path, hands it to the mesh"
|
||||
}
|
||||
],
|
||||
"explanation": "Needs you: hand the directory over from the control-node, as the operator; the details name it and the line to type. A directory of mesh-build-node was already on ace, with another owner or mode than mesh-build-node declares.",
|
||||
@@ -27,7 +27,7 @@
|
||||
"machine": "ace",
|
||||
"scope": "module"
|
||||
},
|
||||
"summary": "mesh-build-node on ace uses mesh-build-node.cache as found: used as found: owned by 10005:10005, mode 700, as found; mesh-build-node, mode 0711 was declared and not given it — `ace/node-engine.hand-over` with the directory's path, then your yes on your channel, with its path, hands it to the mesh"
|
||||
"summary": "mesh-build-node on home-server uses mesh-build-node.cache as found: used as found: owned by 10005:10005, mode 700, as found; mesh-build-node, mode 0711 was declared and not given it — `home-server/node-engine.hand-over` with the directory's path, then your yes on your channel, with its path, hands it to the mesh"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -68,27 +68,27 @@
|
||||
"evidence": [
|
||||
{
|
||||
"at": "2026-10-26T20:19:41.474823121Z",
|
||||
"said": "mesh-build-node on ace uses mesh-build-node.cache as found: used as found: owned by 10005:10005, mode 700, as found; mesh-build-node, mode 0711 was declared and not given it — `ace/node-engine.hand-over` with the directory's path, then your yes on your channel, with its path, hands it to the mesh"
|
||||
"said": "mesh-build-node on home-server uses mesh-build-node.cache as found: used as found: owned by 10005:10005, mode 700, as found; mesh-build-node, mode 0711 was declared and not given it — `home-server/node-engine.hand-over` with the directory's path, then your yes on your channel, with its path, hands it to the mesh"
|
||||
}
|
||||
],
|
||||
"explanation": "Needs you: hand the directory over from the control-node, as the operator; the details name it and the line to type. A directory of mesh-build-node was already on ace, with another owner or mode than mesh-build-node declares.",
|
||||
"headline": "mesh-build-node waits for a directory on ace",
|
||||
"key": "module.mesh-build-node.ace.directory-used-as-found",
|
||||
"explanation": "Needs you: hand the directory over from the control-node, as the operator; the details name it and the line to type. A directory of mesh-build-node was already on home-server, with another owner or mode than mesh-build-node declares.",
|
||||
"headline": "mesh-build-node waits for a directory on home-server",
|
||||
"key": "module.mesh-build-node.home-server.directory-used-as-found",
|
||||
"kind": "directory-used-as-found",
|
||||
"last-observed": "2026-10-26T20:19:41.474823121Z",
|
||||
"needs": "hand the directory over from the control-node, as the operator; the details name it and the line to type.",
|
||||
"observations": 1,
|
||||
"raised": "2026-10-31T08:19:57.076843727Z",
|
||||
"resolved": "mesh-build-node's directory on ace is the mesh's",
|
||||
"resolved": "mesh-build-node's directory on home-server is the mesh's",
|
||||
"resolver": "self",
|
||||
"severity": "warning",
|
||||
"source": "health-report",
|
||||
"subject": {
|
||||
"id": "mesh-build-node.ace",
|
||||
"machine": "ace",
|
||||
"id": "mesh-build-node.home-server",
|
||||
"machine": "home-server",
|
||||
"scope": "module"
|
||||
},
|
||||
"summary": "mesh-build-node on ace uses mesh-build-node.cache as found: used as found: owned by 10005:10005, mode 700, as found; mesh-build-node, mode 0711 was declared and not given it — `ace/node-engine.hand-over` with the directory's path, then your yes on your channel, with its path, hands it to the mesh",
|
||||
"summary": "mesh-build-node on home-server uses mesh-build-node.cache as found: used as found: owned by 10005:10005, mode 700, as found; mesh-build-node, mode 0711 was declared and not given it — `home-server/node-engine.hand-over` with the directory's path, then your yes on your channel, with its path, hands it to the mesh",
|
||||
"owner": "operator@workstation",
|
||||
"waiting-on": "node-engine"
|
||||
}
|
||||
@@ -101,27 +101,27 @@
|
||||
"evidence": [
|
||||
{
|
||||
"at": "2026-10-26T20:19:41.474823121Z",
|
||||
"said": "mesh-build-node on ace uses mesh-build-node.cache as found: used as found: owned by 10005:10005, mode 700, as found; mesh-build-node, mode 0711 was declared and not given it — `ace/node-engine.hand-over` with the directory's path, then your yes on your channel, with its path, hands it to the mesh"
|
||||
"said": "mesh-build-node on home-server uses mesh-build-node.cache as found: used as found: owned by 10005:10005, mode 700, as found; mesh-build-node, mode 0711 was declared and not given it — `home-server/node-engine.hand-over` with the directory's path, then your yes on your channel, with its path, hands it to the mesh"
|
||||
}
|
||||
],
|
||||
"explanation": "Needs you: hand the directory over from the control-node, as the operator; the details name it and the line to type. A directory of mesh-build-node was already on ace, with another owner or mode than mesh-build-node declares.",
|
||||
"headline": "mesh-build-node waits for a directory on ace",
|
||||
"key": "module.mesh-build-node.ace.directory-used-as-found",
|
||||
"explanation": "Needs you: hand the directory over from the control-node, as the operator; the details name it and the line to type. A directory of mesh-build-node was already on home-server, with another owner or mode than mesh-build-node declares.",
|
||||
"headline": "mesh-build-node waits for a directory on home-server",
|
||||
"key": "module.mesh-build-node.home-server.directory-used-as-found",
|
||||
"kind": "directory-used-as-found",
|
||||
"last-observed": "2026-10-26T20:19:41.474823121Z",
|
||||
"needs": "hand the directory over from the control-node, as the operator; the details name it and the line to type.",
|
||||
"observations": 1,
|
||||
"raised": "2026-10-31T08:19:57.076843727Z",
|
||||
"resolved": "mesh-build-node's directory on ace is the mesh's",
|
||||
"resolved": "mesh-build-node's directory on home-server is the mesh's",
|
||||
"resolver": "self",
|
||||
"severity": "warning",
|
||||
"source": "health-report",
|
||||
"subject": {
|
||||
"id": "mesh-build-node.ace",
|
||||
"machine": "ace",
|
||||
"id": "mesh-build-node.home-server",
|
||||
"machine": "home-server",
|
||||
"scope": "module"
|
||||
},
|
||||
"summary": "mesh-build-node on ace uses mesh-build-node.cache as found: used as found: owned by 10005:10005, mode 700, as found; mesh-build-node, mode 0711 was declared and not given it — `ace/node-engine.hand-over` with the directory's path, then your yes on your channel, with its path, hands it to the mesh",
|
||||
"summary": "mesh-build-node on home-server uses mesh-build-node.cache as found: used as found: owned by 10005:10005, mode 700, as found; mesh-build-node, mode 0711 was declared and not given it — `home-server/node-engine.hand-over` with the directory's path, then your yes on your channel, with its path, hands it to the mesh",
|
||||
"owner": "operator-channel",
|
||||
"waiting-on": "forge:operator"
|
||||
}
|
||||
@@ -177,7 +177,7 @@
|
||||
],
|
||||
"at": "2026-10-26T20:19:41.474823121Z",
|
||||
"scope": "module",
|
||||
"id": "mesh-build-node.ace",
|
||||
"id": "mesh-build-node.home-server",
|
||||
"since": "2026-10-26T20:19:41.474823121Z"
|
||||
}
|
||||
},
|
||||
@@ -188,8 +188,8 @@
|
||||
"kind": "directory-used-as-found",
|
||||
"subject": {
|
||||
"scope": "module",
|
||||
"id": "mesh-host.ace",
|
||||
"machine": "ace"
|
||||
"id": "mesh-host.home-server",
|
||||
"machine": "home-server"
|
||||
},
|
||||
"severity": "warning",
|
||||
"summary": "a directory waits for a hand",
|
||||
@@ -199,7 +199,7 @@
|
||||
"owner": "operator@workstation",
|
||||
"waiting-on": "node-engine",
|
||||
"scope": "module",
|
||||
"id": "mesh-host.ace",
|
||||
"id": "mesh-host.home-server",
|
||||
"since": "2026-11-11T10:00:00Z"
|
||||
}
|
||||
},
|
||||
@@ -210,8 +210,8 @@
|
||||
"kind": "directory-used-as-found",
|
||||
"subject": {
|
||||
"scope": "module",
|
||||
"id": "mesh-host.ace",
|
||||
"machine": "ace"
|
||||
"id": "mesh-host.home-server",
|
||||
"machine": "home-server"
|
||||
},
|
||||
"severity": "warning",
|
||||
"summary": "a directory waits for a hand",
|
||||
@@ -221,7 +221,7 @@
|
||||
"owner": "node-engine",
|
||||
"waiting-on": "forge:operator",
|
||||
"scope": "module",
|
||||
"id": "mesh-host.ace",
|
||||
"id": "mesh-host.home-server",
|
||||
"since": "2026-11-11T10:00:00Z"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
"subject": "mesh.seat.mesh-healers.event.attempt-changed.c-1.a-1",
|
||||
"given": {
|
||||
"healer": "directory",
|
||||
"condition": "module.mesh-host.ace.directory-used-as-found",
|
||||
"condition": "module.mesh-host.home-server.directory-used-as-found",
|
||||
"kind": "directory-used-as-found",
|
||||
"budget-key": "module.mesh-host.ace.directory-used-as-found",
|
||||
"budget-key": "module.mesh-host.home-server.directory-used-as-found",
|
||||
"act": "hand-over",
|
||||
"outcome": "acting",
|
||||
"begun": "2026-11-11T10:00:00Z",
|
||||
@@ -19,7 +19,7 @@
|
||||
"of": "event:attempt-changed",
|
||||
"subject": "mesh.seat.mesh-healers.event.attempt-changed.c-1.a-1",
|
||||
"given": {
|
||||
"condition": "module.mesh-host.ace.directory-used-as-found",
|
||||
"condition": "module.mesh-host.home-server.directory-used-as-found",
|
||||
"removed": true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
{
|
||||
"name": "a machine's presence expired",
|
||||
"of": "event:machine-away",
|
||||
"subject": "mesh.seat.mesh-watchdogs.event.machine-away.g14",
|
||||
"subject": "mesh.seat.mesh-watchdogs.event.machine-away.laptop",
|
||||
"given": {
|
||||
"v": 1,
|
||||
"machine": "g14",
|
||||
"machine": "laptop",
|
||||
"at": "2026-11-11T10:00:00Z",
|
||||
"last-heard": "2026-11-11T09:58:00Z"
|
||||
}
|
||||
@@ -13,10 +13,10 @@
|
||||
{
|
||||
"name": "a machine heard again",
|
||||
"of": "event:machine-back",
|
||||
"subject": "mesh.seat.mesh-watchdogs.event.machine-back.g14",
|
||||
"subject": "mesh.seat.mesh-watchdogs.event.machine-back.laptop",
|
||||
"given": {
|
||||
"v": 1,
|
||||
"machine": "g14",
|
||||
"machine": "laptop",
|
||||
"at": "2026-11-11T10:30:00Z",
|
||||
"last-heard": "2026-11-11T10:30:00Z"
|
||||
}
|
||||
|
||||
@@ -32,27 +32,26 @@ func TestATokenLifeAndTheRedeemProofAreAsTheHolderMakesThem(t *testing.T) {
|
||||
if got := (RedeemAnswer{Node: "g14", Signature: "x"}).SignedBytes(); string(got) == "" || string(got) == "x" {
|
||||
t.Errorf("SignedBytes = %s", got)
|
||||
}
|
||||
}
|
||||
|
||||
// TestTheRedeemAnswerIsTheContractsWire: the client's answer reads into the contract's type with no field dropped, and
|
||||
// the contract's reads back as the client's wire.
|
||||
func TestTheRedeemAnswerIsTheContractsWire(t *testing.T) {
|
||||
mine := RedeemAnswer{Node: "g14", Login: "g14-login", Account: "YQ==", Certificate: "pem", Signer: "dg==", Signature: "cw=="}
|
||||
wire, _ := json.Marshal(mine)
|
||||
var theirs seat.RedeemAnswer
|
||||
d := json.NewDecoder(bytes.NewReader(wire))
|
||||
d.DisallowUnknownFields()
|
||||
if err := d.Decode(&theirs); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if theirs.Node != "g14" || theirs.Signer != "dg==" || theirs.Signature != "cw==" {
|
||||
t.Errorf("the contract reads %+v", theirs)
|
||||
}
|
||||
back, _ := json.Marshal(theirs)
|
||||
var a, b map[string]string
|
||||
_ = json.Unmarshal(wire, &a)
|
||||
_ = json.Unmarshal(back, &b)
|
||||
if len(a) != 6 || !reflect.DeepEqual(a, b) {
|
||||
t.Errorf("the contract reads %s back as %s", wire, back)
|
||||
}
|
||||
// TestTheRedeemAnswerIsTheContractsWire: the client's answer reads into the contract's type with no field dropped, and
|
||||
// the contract's reads back as the client's wire.
|
||||
t.Run("TheRedeemAnswerIsTheContractsWire", func(t *testing.T) {
|
||||
mine := RedeemAnswer{Node: "laptop", Login: "laptop-login", Account: "YQ==", Certificate: "pem", Signer: "dg==", Signature: "cw=="}
|
||||
wire, _ := json.Marshal(mine)
|
||||
var theirs seat.RedeemAnswer
|
||||
d := json.NewDecoder(bytes.NewReader(wire))
|
||||
d.DisallowUnknownFields()
|
||||
if err := d.Decode(&theirs); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if theirs.Node != "laptop" || theirs.Signer != "dg==" || theirs.Signature != "cw==" {
|
||||
t.Errorf("the contract reads %+v", theirs)
|
||||
}
|
||||
back, _ := json.Marshal(theirs)
|
||||
var a, b map[string]string
|
||||
_ = json.Unmarshal(wire, &a)
|
||||
_ = json.Unmarshal(back, &b)
|
||||
if len(a) != 6 || !reflect.DeepEqual(a, b) {
|
||||
t.Errorf("the contract reads %s back as %s", wire, back)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -176,7 +176,6 @@ func Glance(explanation string) error {
|
||||
// The bounds of an ask (novox/hq ADR 0234 §8, ADR 0259 §4).
|
||||
const (
|
||||
MostOptions = 4
|
||||
MostOpen = 3
|
||||
ApproveLasts = 24 * time.Hour
|
||||
DestroyLasts = 10 * time.Minute
|
||||
HeadlineLength = approval.HeadlineLength
|
||||
|
||||
@@ -2,6 +2,7 @@ package operatorchannelclient
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
@@ -88,6 +89,51 @@ func TestAnAskIsKeptThenPublishedUnderTheModulesOwnName(t *testing.T) {
|
||||
if err := c.Ask(bad); err == nil {
|
||||
t.Error("an ask the contract refuses was published")
|
||||
}
|
||||
t.Run("AKeyPrefixIsPutBeforeEveryKeyOfTheClientsOwnStateAndNotBeforeWhere", func(t *testing.T) {
|
||||
for _, tc := range []struct{ prefix, key string }{{"n1.", "n1.ask.d-1"}, {"", "ask.d-1"}} {
|
||||
c, _ := client()
|
||||
store := c.State.(*mem)
|
||||
c.KeyPrefix = tc.prefix
|
||||
var asked string
|
||||
c.Record = func(k string) (*stdio.StateEntry, error) { asked = k; return nil, nil }
|
||||
if err := c.Ask(askedHeld()); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if _, ok := store.vals[tc.key]; len(store.vals) != 1 || !ok {
|
||||
t.Fatalf("prefix %q: keys written %v, want %s", tc.prefix, store.vals, tc.key)
|
||||
}
|
||||
// Design 46 7-approval-mark §13: the act and the call's arguments kept beside the ask stay as Take marks it.
|
||||
e, _ := store.Get(tc.key)
|
||||
var k Kept
|
||||
_ = json.Unmarshal(e.Value, &k)
|
||||
k.Act, k.Arguments = releaseHQ, json.RawMessage(`{"delivery":"hq"}`)
|
||||
if _, err := store.Update(tc.key, k, e.Revision); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if h, err := c.Take(askedWarrant(), func(seat.Option, seat.Warrant) error { return nil }); h != Acted || err != nil {
|
||||
t.Fatalf("prefix %q: the warrant was not read from %s: %s %v", tc.prefix, tc.key, h, err)
|
||||
}
|
||||
raw := string(store.vals[tc.key])
|
||||
if !strings.Contains(raw, `"act":{"delivery":"hq","verb":"release"}`) || !strings.Contains(raw, `"arguments":{"delivery":"hq"}`) || strings.Contains(raw, `"recorded"`) {
|
||||
t.Errorf("prefix %q: the kept ask after Take is %s", tc.prefix, raw)
|
||||
}
|
||||
if _, _, err := c.Where("an-asker.d-1"); err != nil || asked != "an-asker.d-1" {
|
||||
t.Errorf("prefix %q: Where read %q", tc.prefix, asked)
|
||||
}
|
||||
}
|
||||
})
|
||||
// Design 47 G §700, A-91: Where reads the router's record as the contract's typed value, its warrant included.
|
||||
t.Run("WhereReadsTheRecordsWarrantTyped", func(t *testing.T) {
|
||||
c, _ := client()
|
||||
rec := seat.AsksByAskerIDValue{Key: "an-asker.d-1", Asker: "an-asker", State: "chosen",
|
||||
Warrant: &seat.Warrant{Ask: "d-1", Asker: "an-asker", Outcome: seat.WarrantOutcomeChosen, Option: "ok"}}
|
||||
raw, _ := json.Marshal(rec)
|
||||
c.Record = func(string) (*stdio.StateEntry, error) { return &stdio.StateEntry{Value: raw}, nil }
|
||||
state, w, err := c.Where("d-1")
|
||||
if err != nil || state != "chosen" || w == nil || w.Option != "ok" {
|
||||
t.Fatalf("Where = %q, %+v, %v; want chosen and the record's warrant", state, w, err)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func TestAWarrantIsActedOnOnceAndOnlyForItsOwnAsk(t *testing.T) {
|
||||
@@ -126,6 +172,109 @@ func TestAWarrantIsActedOnOnceAndOnlyForItsOwnAsk(t *testing.T) {
|
||||
if acted != 1 {
|
||||
t.Errorf("acted %d times", acted)
|
||||
}
|
||||
// The gate's channel (design 47 G lead answers A-219, A-228): the gate's ask raised to the operator at the level approve,
|
||||
// the router's record read in the gate's form with its warrant whole, and a warrant claimed once, only for the act its
|
||||
// option binds.
|
||||
t.Run("TheGateChannelTranslatesTheGatesForms", func(t *testing.T) {
|
||||
st := &mem{vals: map[string]json.RawMessage{}, revs: map[string]uint64{}}
|
||||
records := map[string]seat.AsksByAskerIDValue{}
|
||||
g := &GateChannel{State: st, KeyPrefix: "n1.", Now: func() time.Time { return now },
|
||||
Publish: func(module, subject string, body any, id string) error {
|
||||
if subject != seat.AcceptSubjectAsk(module) {
|
||||
t.Fatalf("published on %s", subject)
|
||||
}
|
||||
return nil
|
||||
},
|
||||
ReadRecord: func(module, id string) (*stdio.StateEntry, error) {
|
||||
rec, ok := records[module+"."+id]
|
||||
if !ok {
|
||||
return nil, nil
|
||||
}
|
||||
raw, _ := json.Marshal(rec)
|
||||
return &stdio.StateEntry{Value: raw}, nil
|
||||
}}
|
||||
digest, _ := ActDigest(releaseHQ)
|
||||
a := approval.Ask{ID: "a1", About: digest, Headline: "Run wipe?", Explanation: "Wipes.", Expires: FormatTime(now.Add(time.Hour)),
|
||||
OnExpiry: "nothing runs", Options: []approval.Option{{ID: "approve", Label: "Approve", Does: "runs", Binds: digest}}}
|
||||
if err := g.Ask("shell", a); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
var k Kept
|
||||
if e, _ := st.Get("n1.ask.a1"); e == nil || json.Unmarshal(e.Value, &k) != nil || k.Ask.Who != Operator || k.Ask.Options[0].Level != Approve {
|
||||
t.Fatalf("kept %+v", k)
|
||||
}
|
||||
if rec, err := g.Record("shell", "a1"); rec != nil || err != nil {
|
||||
t.Fatalf("a record not yet there: %+v %v", rec, err)
|
||||
}
|
||||
w := seat.Warrant{Ask: "a1", Asker: "shell", Outcome: OutcomeChosen, Option: "approve", Level: Approve, At: FormatTime(now),
|
||||
AskDigest: Digest(k.Ask), Channel: "telegram", By: &seat.Person{Who: Operator, Kind: "telegram"}}
|
||||
records["shell.a1"] = seat.AsksByAskerIDValue{Asker: "shell", State: "chosen", Opened: FormatTime(now), Warrant: &w}
|
||||
rec, err := g.Record("shell", "a1")
|
||||
if err != nil || rec == nil || rec.State != "chosen" || rec.Warrant == nil || rec.Warrant.Channel != "telegram" || rec.Warrant.Option != "approve" {
|
||||
t.Fatalf("record %+v %v", rec, err)
|
||||
}
|
||||
if h, err := g.Claim("shell", *rec.Warrant, map[string]string{"verb": "other"}, func() { t.Fatal("ran another act") }); h != approval.Claimed || err == nil {
|
||||
t.Fatalf("another act: %s %v", h, err)
|
||||
}
|
||||
delete(st.vals, "n1.ask.a1")
|
||||
_ = g.Ask("shell", a)
|
||||
runs := 0
|
||||
for i := 0; i < 2; i++ {
|
||||
h, err := g.Claim("shell", *rec.Warrant, releaseHQ, func() { runs++ })
|
||||
if want := []approval.Claim{approval.Claimed, approval.ClaimDone}[i]; h != want || err != nil {
|
||||
t.Fatalf("claim %d: %s %v", i, h, err)
|
||||
}
|
||||
}
|
||||
if runs != 1 || g.Decided("shell") != seat.SubjectDecided("shell") {
|
||||
t.Fatalf("runs %d", runs)
|
||||
}
|
||||
})
|
||||
// The gate's channel over a process connection (design 47 G lead answers A-272, A-273): an ask and its cancel go out as
|
||||
// accepted kinds of the seat operator-channel with the ask's id as the message id, the router's record is the get of
|
||||
// `<module>.<id>` in the state asks of the seat's holder, and nothing else is reached: another subject, or a seat with no
|
||||
// holder, is refused.
|
||||
t.Run("TheGateChannelOverAConnectionAsksAndReadsOnlyThroughTheSeat", func(t *testing.T) {
|
||||
type sent struct{ seat, kind, id string }
|
||||
var out []sent
|
||||
accept := func(s, kind string, _ any, opts ...stdio.EmitOptions) error {
|
||||
out = append(out, sent{s, kind, opts[0].MessageID})
|
||||
return nil
|
||||
}
|
||||
raw, _ := json.Marshal(seat.AsksByAskerIDValue{Asker: "shell", State: "open", Opened: FormatTime(now)})
|
||||
vals := map[string]json.RawMessage{"messenger_holder.asks|shell.a1": raw, "other.asks|shell.a1": json.RawMessage(`{"state":"wrong"}`)}
|
||||
read := func(r string) asksRead { return readOf{state: r, vals: vals} }
|
||||
holder := func() (string, error) { return "messenger_holder", nil }
|
||||
st := &mem{vals: map[string]json.RawMessage{}, revs: map[string]uint64{}}
|
||||
g := gateChannelOver(accept, read, st, "n1.", holder)
|
||||
g.Now = func() time.Time { return now }
|
||||
|
||||
digest, _ := ActDigest(releaseHQ)
|
||||
a := approval.Ask{ID: "a1", About: digest, Headline: "Run wipe?", Explanation: "Wipes.", Expires: FormatTime(now.Add(time.Hour)),
|
||||
OnExpiry: "nothing runs", Options: []approval.Option{{ID: "approve", Label: "Approve", Does: "runs", Binds: digest}}}
|
||||
if err := g.Ask("shell", a); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := g.Cancel("shell", "a1"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(out) != 2 || out[0] != (sent{seat.Seat, seat.AcceptAsk, "a1"}) || out[1] != (sent{seat.Seat, seat.AcceptCancel, "cancel.a1"}) {
|
||||
t.Fatalf("sent %+v, want the ask and its cancel on the seat's accepts", out)
|
||||
}
|
||||
if rec, err := g.Record("shell", "a1"); err != nil || rec == nil || rec.State != "open" {
|
||||
t.Fatalf("record %+v %v, want the one in the holder's state asks", rec, err)
|
||||
}
|
||||
if rec, err := g.Record("shell", "zz"); err != nil || rec != nil {
|
||||
t.Fatalf("a record not there: %+v %v", rec, err)
|
||||
}
|
||||
if err := g.Publish("shell", "mesh.seat.operator-channel.accept.ask.other", nil, "x"); err == nil {
|
||||
t.Fatal("an accept subject naming another caller was sent")
|
||||
}
|
||||
for _, c := range []func() (string, error){func() (string, error) { return "", nil }, func() (string, error) { return "", errors.New("unread") }} {
|
||||
if _, err := gateChannelOver(accept, read, st, "n1.", c).Record("shell", "a1"); err == nil {
|
||||
t.Fatal("a record was read with no holder of the seat")
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func TestAnAskEndedWithoutAChoiceIsRecordedAndNothingDone(t *testing.T) {
|
||||
@@ -139,123 +288,17 @@ func TestAnAskEndedWithoutAChoiceIsRecordedAndNothingDone(t *testing.T) {
|
||||
if h, _ := c.Take(askedWarrant(), func(seat.Option, seat.Warrant) error { t.Fatal("acted after it ended"); return nil }); h != Done {
|
||||
t.Errorf("%s", h)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAnAskTheRouterRefusedEndsTheRequestWithItsWords(t *testing.T) {
|
||||
c, _ := client()
|
||||
_ = c.Ask(askedHeld())
|
||||
w := askedWarrant()
|
||||
w.Outcome, w.Option, w.By, w.Words = OutcomeRefused, "", nil, "its expiry passes the bound of its level"
|
||||
h, err := c.Take(w, func(seat.Option, seat.Warrant) error { t.Fatal("acted"); return nil })
|
||||
if h != Refused || err == nil || !strings.Contains(err.Error(), w.Words) {
|
||||
t.Fatalf("%s %v, want refused with the router's words", h, err)
|
||||
}
|
||||
if h, _ := c.Take(askedWarrant(), func(seat.Option, seat.Warrant) error { t.Fatal("acted after it ended"); return nil }); h != Done {
|
||||
t.Errorf("the refused ask was not closed: %s", h)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAKeyPrefixIsPutBeforeEveryKeyOfTheClientsOwnStateAndNotBeforeWhere(t *testing.T) {
|
||||
for _, tc := range []struct{ prefix, key string }{{"n1.", "n1.ask.d-1"}, {"", "ask.d-1"}} {
|
||||
t.Run("AnAskTheRouterRefusedEndsTheRequestWithItsWords", func(t *testing.T) {
|
||||
c, _ := client()
|
||||
store := c.State.(*mem)
|
||||
c.KeyPrefix = tc.prefix
|
||||
var asked string
|
||||
c.Record = func(k string) (*stdio.StateEntry, error) { asked = k; return nil, nil }
|
||||
if err := c.Ask(askedHeld()); err != nil {
|
||||
t.Fatal(err)
|
||||
_ = c.Ask(askedHeld())
|
||||
w := askedWarrant()
|
||||
w.Outcome, w.Option, w.By, w.Words = OutcomeRefused, "", nil, "its expiry passes the bound of its level"
|
||||
h, err := c.Take(w, func(seat.Option, seat.Warrant) error { t.Fatal("acted"); return nil })
|
||||
if h != Refused || err == nil || !strings.Contains(err.Error(), w.Words) {
|
||||
t.Fatalf("%s %v, want refused with the router's words", h, err)
|
||||
}
|
||||
if _, ok := store.vals[tc.key]; len(store.vals) != 1 || !ok {
|
||||
t.Fatalf("prefix %q: keys written %v, want %s", tc.prefix, store.vals, tc.key)
|
||||
if h, _ := c.Take(askedWarrant(), func(seat.Option, seat.Warrant) error { t.Fatal("acted after it ended"); return nil }); h != Done {
|
||||
t.Errorf("the refused ask was not closed: %s", h)
|
||||
}
|
||||
// Design 46 7-approval-mark §13: the act and the call's arguments kept beside the ask stay as Take marks it.
|
||||
e, _ := store.Get(tc.key)
|
||||
var k Kept
|
||||
_ = json.Unmarshal(e.Value, &k)
|
||||
k.Act, k.Arguments = releaseHQ, json.RawMessage(`{"delivery":"hq"}`)
|
||||
if _, err := store.Update(tc.key, k, e.Revision); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if h, err := c.Take(askedWarrant(), func(seat.Option, seat.Warrant) error { return nil }); h != Acted || err != nil {
|
||||
t.Fatalf("prefix %q: the warrant was not read from %s: %s %v", tc.prefix, tc.key, h, err)
|
||||
}
|
||||
raw := string(store.vals[tc.key])
|
||||
if !strings.Contains(raw, `"act":{"delivery":"hq","verb":"release"}`) || !strings.Contains(raw, `"arguments":{"delivery":"hq"}`) || strings.Contains(raw, `"recorded"`) {
|
||||
t.Errorf("prefix %q: the kept ask after Take is %s", tc.prefix, raw)
|
||||
}
|
||||
if _, _, err := c.Where("an-asker.d-1"); err != nil || asked != "an-asker.d-1" {
|
||||
t.Errorf("prefix %q: Where read %q", tc.prefix, asked)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Design 47 G §700, A-91: Where reads the router's record as the contract's typed value, its warrant included.
|
||||
func TestWhereReadsTheRecordsWarrantTyped(t *testing.T) {
|
||||
c, _ := client()
|
||||
rec := seat.AsksByAskerIDValue{Key: "an-asker.d-1", Asker: "an-asker", State: "chosen",
|
||||
Warrant: &seat.Warrant{Ask: "d-1", Asker: "an-asker", Outcome: seat.WarrantOutcomeChosen, Option: "ok"}}
|
||||
raw, _ := json.Marshal(rec)
|
||||
c.Record = func(string) (*stdio.StateEntry, error) { return &stdio.StateEntry{Value: raw}, nil }
|
||||
state, w, err := c.Where("d-1")
|
||||
if err != nil || state != "chosen" || w == nil || w.Option != "ok" {
|
||||
t.Fatalf("Where = %q, %+v, %v; want chosen and the record's warrant", state, w, err)
|
||||
}
|
||||
}
|
||||
|
||||
// The gate's channel (design 47 G lead answers A-219, A-228): the gate's ask raised to the operator at the level approve,
|
||||
// the router's record read in the gate's form with its warrant whole, and a warrant claimed once, only for the act its
|
||||
// option binds.
|
||||
func TestTheGateChannelTranslatesTheGatesForms(t *testing.T) {
|
||||
st := &mem{vals: map[string]json.RawMessage{}, revs: map[string]uint64{}}
|
||||
records := map[string]seat.AsksByAskerIDValue{}
|
||||
g := &GateChannel{State: st, KeyPrefix: "n1.", Now: func() time.Time { return now },
|
||||
Publish: func(module, subject string, body any, id string) error {
|
||||
if subject != seat.AcceptSubjectAsk(module) {
|
||||
t.Fatalf("published on %s", subject)
|
||||
}
|
||||
return nil
|
||||
},
|
||||
ReadRecord: func(module, id string) (*stdio.StateEntry, error) {
|
||||
rec, ok := records[module+"."+id]
|
||||
if !ok {
|
||||
return nil, nil
|
||||
}
|
||||
raw, _ := json.Marshal(rec)
|
||||
return &stdio.StateEntry{Value: raw}, nil
|
||||
}}
|
||||
digest, _ := ActDigest(releaseHQ)
|
||||
a := approval.Ask{ID: "a1", About: digest, Headline: "Run wipe?", Explanation: "Wipes.", Expires: FormatTime(now.Add(time.Hour)),
|
||||
OnExpiry: "nothing runs", Options: []approval.Option{{ID: "approve", Label: "Approve", Does: "runs", Binds: digest}}}
|
||||
if err := g.Ask("shell", a); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
var k Kept
|
||||
if e, _ := st.Get("n1.ask.a1"); e == nil || json.Unmarshal(e.Value, &k) != nil || k.Ask.Who != Operator || k.Ask.Options[0].Level != Approve {
|
||||
t.Fatalf("kept %+v", k)
|
||||
}
|
||||
if rec, err := g.Record("shell", "a1"); rec != nil || err != nil {
|
||||
t.Fatalf("a record not yet there: %+v %v", rec, err)
|
||||
}
|
||||
w := seat.Warrant{Ask: "a1", Asker: "shell", Outcome: OutcomeChosen, Option: "approve", Level: Approve, At: FormatTime(now),
|
||||
AskDigest: Digest(k.Ask), Channel: "telegram", By: &seat.Person{Who: Operator, Kind: "telegram"}}
|
||||
records["shell.a1"] = seat.AsksByAskerIDValue{Asker: "shell", State: "chosen", Opened: FormatTime(now), Warrant: &w}
|
||||
rec, err := g.Record("shell", "a1")
|
||||
if err != nil || rec == nil || rec.State != "chosen" || rec.Warrant == nil || rec.Warrant.Channel != "telegram" || rec.Warrant.Option != "approve" {
|
||||
t.Fatalf("record %+v %v", rec, err)
|
||||
}
|
||||
if h, err := g.Claim("shell", *rec.Warrant, map[string]string{"verb": "other"}, func() { t.Fatal("ran another act") }); h != approval.Claimed || err == nil {
|
||||
t.Fatalf("another act: %s %v", h, err)
|
||||
}
|
||||
delete(st.vals, "n1.ask.a1")
|
||||
_ = g.Ask("shell", a)
|
||||
runs := 0
|
||||
for i := 0; i < 2; i++ {
|
||||
h, err := g.Claim("shell", *rec.Warrant, releaseHQ, func() { runs++ })
|
||||
if want := []approval.Claim{approval.Claimed, approval.ClaimDone}[i]; h != want || err != nil {
|
||||
t.Fatalf("claim %d: %s %v", i, h, err)
|
||||
}
|
||||
}
|
||||
if runs != 1 || g.Decided("shell") != seat.SubjectDecided("shell") {
|
||||
t.Fatalf("runs %d", runs)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -2,13 +2,8 @@ package operatorchannelclient
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
seat "git.novox.be/novox/mesh-contracts/operator-and-conversation/go/seats/operatorchannel"
|
||||
stdio "git.novox.be/novox/mesh-sdk/go"
|
||||
"git.novox.be/novox/mesh-sdk/go/approval"
|
||||
)
|
||||
|
||||
type readOf struct {
|
||||
@@ -22,50 +17,3 @@ func (r readOf) Get(key string) (*stdio.StateEntry, error) {
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// The gate's channel over a process connection (design 47 G lead answers A-272, A-273): an ask and its cancel go out as
|
||||
// accepted kinds of the seat operator-channel with the ask's id as the message id, the router's record is the get of
|
||||
// `<module>.<id>` in the state asks of the seat's holder, and nothing else is reached: another subject, or a seat with no
|
||||
// holder, is refused.
|
||||
func TestTheGateChannelOverAConnectionAsksAndReadsOnlyThroughTheSeat(t *testing.T) {
|
||||
type sent struct{ seat, kind, id string }
|
||||
var out []sent
|
||||
accept := func(s, kind string, _ any, opts ...stdio.EmitOptions) error {
|
||||
out = append(out, sent{s, kind, opts[0].MessageID})
|
||||
return nil
|
||||
}
|
||||
raw, _ := json.Marshal(seat.AsksByAskerIDValue{Asker: "shell", State: "open", Opened: FormatTime(now)})
|
||||
vals := map[string]json.RawMessage{"messenger_holder.asks|shell.a1": raw, "other.asks|shell.a1": json.RawMessage(`{"state":"wrong"}`)}
|
||||
read := func(r string) asksRead { return readOf{state: r, vals: vals} }
|
||||
holder := func() (string, error) { return "messenger_holder", nil }
|
||||
st := &mem{vals: map[string]json.RawMessage{}, revs: map[string]uint64{}}
|
||||
g := gateChannelOver(accept, read, st, "n1.", holder)
|
||||
g.Now = func() time.Time { return now }
|
||||
|
||||
digest, _ := ActDigest(releaseHQ)
|
||||
a := approval.Ask{ID: "a1", About: digest, Headline: "Run wipe?", Explanation: "Wipes.", Expires: FormatTime(now.Add(time.Hour)),
|
||||
OnExpiry: "nothing runs", Options: []approval.Option{{ID: "approve", Label: "Approve", Does: "runs", Binds: digest}}}
|
||||
if err := g.Ask("shell", a); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := g.Cancel("shell", "a1"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(out) != 2 || out[0] != (sent{seat.Seat, seat.AcceptAsk, "a1"}) || out[1] != (sent{seat.Seat, seat.AcceptCancel, "cancel.a1"}) {
|
||||
t.Fatalf("sent %+v, want the ask and its cancel on the seat's accepts", out)
|
||||
}
|
||||
if rec, err := g.Record("shell", "a1"); err != nil || rec == nil || rec.State != "open" {
|
||||
t.Fatalf("record %+v %v, want the one in the holder's state asks", rec, err)
|
||||
}
|
||||
if rec, err := g.Record("shell", "zz"); err != nil || rec != nil {
|
||||
t.Fatalf("a record not there: %+v %v", rec, err)
|
||||
}
|
||||
if err := g.Publish("shell", "mesh.seat.operator-channel.accept.ask.other", nil, "x"); err == nil {
|
||||
t.Fatal("an accept subject naming another caller was sent")
|
||||
}
|
||||
for _, c := range []func() (string, error){func() (string, error) { return "", nil }, func() (string, error) { return "", errors.New("unread") }} {
|
||||
if _, err := gateChannelOver(accept, read, st, "n1.", c).Record("shell", "a1"); err == nil {
|
||||
t.Fatal("a record was read with no holder of the seat")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,7 +56,8 @@
|
||||
"entries"
|
||||
]
|
||||
},
|
||||
"optional": true
|
||||
"optional": true,
|
||||
"class": "read"
|
||||
},
|
||||
{
|
||||
"name": "show",
|
||||
@@ -67,7 +68,8 @@
|
||||
"answer": {
|
||||
"$ref": "#/defs/Held"
|
||||
},
|
||||
"optional": true
|
||||
"optional": true,
|
||||
"class": "read"
|
||||
},
|
||||
{
|
||||
"name": "check",
|
||||
@@ -122,7 +124,8 @@
|
||||
"differences"
|
||||
]
|
||||
},
|
||||
"optional": true
|
||||
"optional": true,
|
||||
"class": "read"
|
||||
},
|
||||
{
|
||||
"name": "orphans",
|
||||
@@ -147,7 +150,8 @@
|
||||
"entries"
|
||||
]
|
||||
},
|
||||
"optional": true
|
||||
"optional": true,
|
||||
"class": "read"
|
||||
},
|
||||
{
|
||||
"name": "create",
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
"of": "state:assignments/<node>.<module>",
|
||||
"given": {
|
||||
"v": 1,
|
||||
"node": "ace",
|
||||
"node": "home-server",
|
||||
"placed": {
|
||||
"module": "plex",
|
||||
"branch": "beta",
|
||||
@@ -106,24 +106,32 @@
|
||||
"changes": [
|
||||
{
|
||||
"op": "place",
|
||||
"node": "ace",
|
||||
"node": "home-server",
|
||||
"module": "nats",
|
||||
"branch": "beta",
|
||||
"build": "src2:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
||||
}
|
||||
],
|
||||
"base": {
|
||||
"ace": 3
|
||||
"home-server": 3
|
||||
},
|
||||
"state": "answering"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "a candidate",
|
||||
"name": "a candidate, with the modules it adds and what their wants would carry",
|
||||
"of": "state:candidates/<proposal>.<node>",
|
||||
"given": {
|
||||
"v": 1,
|
||||
"proposal": "p-20261105t120000-aabbccdd"
|
||||
"proposal": "p-20261105t120000-aabbccdd",
|
||||
"added": {
|
||||
"mesh-build-go": {
|
||||
"version": "1.4.0",
|
||||
"parts": {
|
||||
"mesh-build-go:go-binary": "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -350,6 +350,13 @@
|
||||
"assignments": {
|
||||
"$ref": "#/defs/Assignments",
|
||||
"description": "the node's assignments with the proposal laid over it; absent when the proposal takes its key away"
|
||||
},
|
||||
"added": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"$ref": "#/defs/AddedModule"
|
||||
},
|
||||
"description": "by module name, each module the candidate adds to this node without a want there: the `version` and `parts` the want it would write carries (design 47 G A-316); the node-engine builds such a module from this entry"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
@@ -1061,6 +1068,23 @@
|
||||
"branch",
|
||||
"nodes"
|
||||
]
|
||||
},
|
||||
"AddedModule": {
|
||||
"type": "object",
|
||||
"description": "what the want a candidate would write for a module carries of its build, in the want's own forms (the seat mesh-wants' state wants: `version` and `parts`; copied here because a seat definition cannot reuse another repository's seat's forms, design 47 G A-316)",
|
||||
"properties": {
|
||||
"version": {
|
||||
"type": "string",
|
||||
"description": "the module's released version, for people; none for a build of another watched branch (design 47 G section 379)"
|
||||
},
|
||||
"parts": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": "the digest of each of the module's parts, by `<module>:<artifact>` (design 47 G section 379)"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,10 +69,10 @@
|
||||
{
|
||||
"name": "composed is said",
|
||||
"of": "event:composed",
|
||||
"subject": "mesh.seat.node-engine.event.composed.ace",
|
||||
"subject": "mesh.seat.node-engine.event.composed.home-server",
|
||||
"given": {
|
||||
"v": 1,
|
||||
"node": "ace",
|
||||
"node": "home-server",
|
||||
"module": "nats",
|
||||
"fingerprint": "src2:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
||||
"digest": "sha256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
|
||||
@@ -82,10 +82,10 @@
|
||||
{
|
||||
"name": "running is said, its node and module in its subject",
|
||||
"of": "event:running",
|
||||
"subject": "mesh.seat.node-engine.event.running.ace.nats",
|
||||
"subject": "mesh.seat.node-engine.event.running.home-server.nats",
|
||||
"given": {
|
||||
"v": 1,
|
||||
"node": "ace",
|
||||
"node": "home-server",
|
||||
"module": "nats",
|
||||
"fingerprint": "src2:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
||||
"manifest": "sha256:cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc",
|
||||
@@ -95,10 +95,10 @@
|
||||
{
|
||||
"name": "running says the build that runs is healthy",
|
||||
"of": "event:running",
|
||||
"subject": "mesh.seat.node-engine.event.running.ace.nats",
|
||||
"subject": "mesh.seat.node-engine.event.running.home-server.nats",
|
||||
"given": {
|
||||
"v": 1,
|
||||
"node": "ace",
|
||||
"node": "home-server",
|
||||
"module": "nats",
|
||||
"fingerprint": "src2:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
||||
"manifest": "sha256:cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc",
|
||||
@@ -109,10 +109,10 @@
|
||||
{
|
||||
"name": "running says the build that runs turned unhealthy, still running",
|
||||
"of": "event:running",
|
||||
"subject": "mesh.seat.node-engine.event.running.ace.nats",
|
||||
"subject": "mesh.seat.node-engine.event.running.home-server.nats",
|
||||
"given": {
|
||||
"v": 1,
|
||||
"node": "ace",
|
||||
"node": "home-server",
|
||||
"module": "nats",
|
||||
"fingerprint": "src2:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
||||
"manifest": "sha256:cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc",
|
||||
@@ -123,10 +123,10 @@
|
||||
{
|
||||
"name": "running says a module stopped on the node, with no fingerprint",
|
||||
"of": "event:running",
|
||||
"subject": "mesh.seat.node-engine.event.running.ace.nats",
|
||||
"subject": "mesh.seat.node-engine.event.running.home-server.nats",
|
||||
"given": {
|
||||
"v": 1,
|
||||
"node": "ace",
|
||||
"node": "home-server",
|
||||
"module": "nats",
|
||||
"stopped": true,
|
||||
"at": "2026-11-11T09:00:00Z"
|
||||
@@ -135,23 +135,23 @@
|
||||
{
|
||||
"name": "a kept build's wait is held",
|
||||
"of": "event:wait-held",
|
||||
"subject": "mesh.seat.node-engine.event.wait-held.ace.postgres",
|
||||
"subject": "mesh.seat.node-engine.event.wait-held.home-server.postgres",
|
||||
"given": {
|
||||
"owner": "node-engine",
|
||||
"step": "kept-build",
|
||||
"node": "ace",
|
||||
"node": "home-server",
|
||||
"on": "the kept build of postgres",
|
||||
"bound": "60m",
|
||||
"since": "2026-11-11T10:00:00Z",
|
||||
"clock-from": "2026-11-11T10:00:00Z",
|
||||
"words": "waiting for the kept build of postgres on ace",
|
||||
"words": "waiting for the kept build of postgres on home-server",
|
||||
"reason": "node away"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "a hold of the composition ends",
|
||||
"of": "event:wait-ended",
|
||||
"subject": "mesh.seat.node-engine.event.wait-ended.ace.postgres",
|
||||
"subject": "mesh.seat.node-engine.event.wait-ended.home-server.postgres",
|
||||
"given": {
|
||||
"owner": "node-engine",
|
||||
"step": "compose",
|
||||
|
||||
@@ -129,7 +129,7 @@
|
||||
"name": "process-builds answers each process's build",
|
||||
"of": "verb:process-builds.answer",
|
||||
"given": {
|
||||
"node": "ace",
|
||||
"node": "home-server",
|
||||
"processes": [
|
||||
{
|
||||
"module": "nats",
|
||||
@@ -152,7 +152,7 @@
|
||||
"name": "process-builds answers an error",
|
||||
"of": "verb:process-builds.answer",
|
||||
"given": {
|
||||
"node": "ace",
|
||||
"node": "home-server",
|
||||
"processes": [],
|
||||
"error": "the service manager did not answer"
|
||||
}
|
||||
|
||||
@@ -600,12 +600,16 @@
|
||||
"input": {
|
||||
"properties": {
|
||||
"candidate": {
|
||||
"description": "the key of the indexer's candidate, <group>.<heads hash>",
|
||||
"description": "the key of the candidate to compose: a check's candidate in the indexer, <group>.<heads hash>; a branch pipeline's catalog graph revision, <branch>.<revision> (the node-engine reads its entries through mesh-catalog.revision); or a run on request's, run-<id>; built and read by the seat's client (nodeengineclient)",
|
||||
"type": "string"
|
||||
},
|
||||
"input": {
|
||||
"description": "also answer the composition input the candidate was composed from, for the sandbox path",
|
||||
"type": "boolean"
|
||||
},
|
||||
"call": {
|
||||
"description": "128 random bits the caller chooses: the subject token of the chunks and acknowledgements the composition input is sent in, whatever its size (design 47 G A-237b); an ask with input and no call is answered inline, as before the checker goes (G-6 section 321)",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
@@ -658,7 +662,12 @@
|
||||
},
|
||||
"input": {
|
||||
"type": "object",
|
||||
"description": "when asked: the composition input it composed from"
|
||||
"description": "when asked without a call token: the composition input it composed from, inline, up to what one answer carries (the checker's form, kept until G removes the checker, G-6 section 321)"
|
||||
},
|
||||
"chunks": {
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"description": "when asked with input and a call token: how many chunks of at most 512 KiB carry the composition input, sent on the chunk subject of the call, each acknowledged by the caller (design 47 G A-237b)"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
@@ -671,6 +680,7 @@
|
||||
"took"
|
||||
]
|
||||
},
|
||||
"chunks": true,
|
||||
"class": "read"
|
||||
},
|
||||
{
|
||||
@@ -1300,6 +1310,13 @@
|
||||
"refused": {
|
||||
"type": "string",
|
||||
"description": "why the module cannot be composed at this fingerprint"
|
||||
},
|
||||
"templates": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": "the digests, sorted, of the templates archives the composition was rendered from"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
|
||||
+10
@@ -86,6 +86,14 @@ export declare function seatHoldersBySeatNodeKey(seat: string, node: string): st
|
||||
/** The parts of a key of the form "<seat>.<node>", or undefined for a key of another form. */
|
||||
export declare function parseSeatHoldersBySeatNodeKey(_key: string): { seat: string; node: string } | undefined;
|
||||
|
||||
/** what the want a candidate would write for a module carries of its build, in the want's own forms (the seat mesh-wants' state wants: `version` and `parts`; copied here because a seat definition cannot reuse another repository's seat's forms, design 47 G A-316) */
|
||||
export interface AddedModule {
|
||||
/** the digest of each of the module's parts, by `<module>:<artifact>` (design 47 G section 379) */
|
||||
"parts"?: Record<string, string>;
|
||||
/** the module's released version, for people; none for a build of another watched branch (design 47 G section 379) */
|
||||
"version"?: string;
|
||||
}
|
||||
|
||||
/** one node's assignments assembled */
|
||||
export interface Assignments {
|
||||
"decided": NodeDecided;
|
||||
@@ -415,6 +423,8 @@ export type ProposalsByProposalValue = Proposal;
|
||||
|
||||
/** is one value of the state candidates under the key <proposal>.<node>. */
|
||||
export interface CandidatesByProposalNodeValue {
|
||||
/** by module name, each module the candidate adds to this node without a want there: the `version` and `parts` the want it would write carries (design 47 G A-316); the node-engine builds such a module from this entry */
|
||||
"added"?: Record<string, AddedModule>;
|
||||
/** the node's assignments with the proposal laid over it; absent when the proposal takes its key away */
|
||||
"assignments"?: Assignments;
|
||||
"proposal": string;
|
||||
|
||||
Vendored
+8
-2
@@ -981,7 +981,9 @@ export interface ComposeAnswer {
|
||||
|
||||
/** is what compose-candidate takes. */
|
||||
export interface ComposeCandidateInput {
|
||||
/** the key of the indexer's candidate, <group>.<heads hash> */
|
||||
/** 128 random bits the caller chooses: the subject token of the chunks and acknowledgements the composition input is sent in, whatever its size (design 47 G A-237b); an ask with input and no call is answered inline, as before the checker goes (G-6 section 321) */
|
||||
"call"?: string;
|
||||
/** the key of the candidate to compose: a check's candidate in the indexer, <group>.<heads hash>; a branch pipeline's catalog graph revision, <branch>.<revision> (the node-engine reads its entries through mesh-catalog.revision); or a run on request's, run-<id>; built and read by the seat's client (nodeengineclient) */
|
||||
"candidate": string;
|
||||
/** also answer the composition input the candidate was composed from, for the sandbox path */
|
||||
"input"?: boolean;
|
||||
@@ -991,7 +993,9 @@ export interface ComposeCandidateInput {
|
||||
export interface ComposeCandidateAnswer {
|
||||
/** the candidate's key */
|
||||
"candidate": string;
|
||||
/** when asked: the composition input it composed from */
|
||||
/** when asked with input and a call token: how many chunks of at most 512 KiB carry the composition input, sent on the chunk subject of the call, each acknowledged by the caller (design 47 G A-237b) */
|
||||
"chunks"?: number;
|
||||
/** when asked without a call token: the composition input it composed from, inline, up to what one answer carries (the checker's form, kept until G removes the checker, G-6 section 321) */
|
||||
"input"?: Record<string, unknown>;
|
||||
/** every module placed on the node, sorted by name */
|
||||
"modules": Module[];
|
||||
@@ -1233,6 +1237,8 @@ export interface ComposedByNodeModuleFingerprintValue {
|
||||
"refused"?: string;
|
||||
/** the declaration resources, each saying its module */
|
||||
"resources": Record<string, unknown>[];
|
||||
/** the digests, sorted, of the templates archives the composition was rendered from */
|
||||
"templates"?: string[];
|
||||
"v": number;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user