mesh/merge-gate pass: builds build-agent, mesh-controller, route-proxy → ace, g14, novox, shanks; no bus step; every machine composes with the change as it…
mesh/repo-check pass: its merge-check.sh passed
mesh/delivery delivered
mesh/delivery-group group feat/setting-defaults failed: a member failed
A key dropped silently ran a module without what its manifest says, and a key inside a block still failed the whole catalogue. Judge a key by what it is about, and narrow the listing to one machine.
51 lines
1.7 KiB
Go
51 lines
1.7 KiB
Go
package main
|
|
|
|
import (
|
|
"encoding/json"
|
|
"testing"
|
|
|
|
"github.com/novox/mesh-controller/internal/catalogue"
|
|
"github.com/novox/mesh-controller/internal/conditions"
|
|
)
|
|
|
|
// A module whose stored manifest has a key this controller does not know is a condition, in plain
|
|
// words, until it is read again; every other module raises nothing (novox/hq ADR 0262).
|
|
func TestAModuleWithAnUnknownFieldIsACondition(t *testing.T) {
|
|
var later, now catalogue.Manifest
|
|
if err := json.Unmarshal([]byte(`{"module": "dunst", "version": "2", "settings": {}, "a-field-from-later": 1}`), &later); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if err := json.Unmarshal([]byte(`{"module": "xorg", "version": "1"}`), &now); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
observed := unknownFieldObservations(map[string]catalogue.Manifest{"dunst": later, "xorg": now})
|
|
if len(observed) != 1 || observed[0].ID != "dunst" || observed[0].Kind != kindUnknownField {
|
|
t.Fatalf("observed: %+v", observed)
|
|
}
|
|
o := observed[0]
|
|
if why, ok := conditions.PlainWords(conditions.Words{Headline: o.Headline, Explanation: o.Explanation,
|
|
Resolved: o.Resolved, Needs: o.Needs}); !ok {
|
|
t.Fatalf("not plain: %s", why)
|
|
}
|
|
|
|
k, _ := withConditionsInMemory(t)
|
|
if err := k.Reconcile(t.Context(), sourceUnknownFields, observed); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if _, open, _ := k.Get(t.Context(), o.Key()); !open {
|
|
t.Fatal("not raised")
|
|
}
|
|
if err := k.Reconcile(t.Context(), sourceUnknownFields, unknownFieldObservations(map[string]catalogue.Manifest{"xorg": now})); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
still, err := k.Open(t.Context())
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
for _, c := range still {
|
|
if c.Key == o.Key() {
|
|
t.Fatalf("not cleared once read again: %+v", c)
|
|
}
|
|
}
|
|
}
|