MH-7: the node-engine reads a module of a catalog revision as accepted: no verdict is read

The seat mesh-catalog keeps no state verdicts (H-A-79): frombus taken, the composer's parse and the composer's
reading of a candidate drop the verdict branch and decode the manifest alone, a module in a catalog revision being
accepted by being there; the composer no longer reads the request field Case.Verdicts (H-A-112). Tests that held a
module by a verdict hold it by the decoder, or go.

Builds: design 47 H, H-A-79, H-A-111, H-A-112

Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
This commit is contained in:
2026-11-20 04:24:53 +01:00
parent dd2b3a16df
commit e4d098c4b9
12 changed files with 50 additions and 731 deletions
+1 -18
View File
@@ -414,7 +414,7 @@ func (c *Composer) warm(ctx context.Context, origin *Composer, cand meshcatalog.
}
// layCandidate lays the candidate's modules over the indexer's: each at its fingerprint, with its manifest's digest and
// the indexer's verdict on it (read from its verdicts, none read taken as accepted); a module the candidate removes goes.
// a module the candidate removes goes (design 47 H, H-A-79: the seat keeps no verdicts).
// It answers the modules laid.
func (c *Composer) layCandidate(ctx context.Context, cand meshcatalog.CandidatesByGroupValue) (map[string]bool, error) {
touched := map[string]bool{}
@@ -430,23 +430,6 @@ func (c *Composer) layCandidate(ctx context.Context, cand meshcatalog.Candidates
continue // no fingerprint at the preview: composed as the trunk holds it
}
m := meshcatalog.ModulesByModuleValue{Fp2: cm.Fp2, Manifest: cm.Manifest, Repository: pull.Repository, Commit: pull.Head}
if cm.Manifest != "" {
key, err := meshcatalogclient.VerdictsKey(cm.Manifest)
if err != nil {
return nil, err
}
raw, err := c.get(ctx, buckets.Verdicts, key)
if err != nil {
return nil, fmt.Errorf("the indexer's verdict on %s's manifest cannot be read: %w", module, err)
}
if raw != nil {
v, err := meshcatalogclient.DecodeVerdict(raw)
if err != nil {
return nil, fmt.Errorf("the indexer's verdict on %s's manifest cannot be read: %w", module, err)
}
m.Verdict, m.Problems, m.Warnings = v.State, v.Problems, v.Warnings
}
}
c.mu.Lock()
c.modules[module] = m
c.mu.Unlock()
+6 -29
View File
@@ -3,6 +3,11 @@ package selfcompose
import (
"context"
"encoding/json"
"strings"
"sync/atomic"
"testing"
"time"
"git.novox.be/novox/mesh-contracts/go/seats/meshmoduleassigner"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/clients/meshcatalogclient"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/clients/meshdeliveryclient"
@@ -10,10 +15,6 @@ import (
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshwants"
"github.com/novox/mesh-host/internal/buckets"
"github.com/novox/mesh-host/internal/buckets/bucketstest"
"strings"
"sync/atomic"
"testing"
"time"
nec "git.novox.be/novox/mesh-contracts/go/clients/nodeengineclient"
"git.novox.be/novox/mesh-contracts/go/seats/nodeengine"
@@ -56,23 +57,7 @@ func TestTheNodeComposesACandidateOnAsk(t *testing.T) {
key, _ := nec.CompositionKey(group, heads)
return key
}
accepted, refusedKey := candidateOf("fix/940-no-retire-on-partial-read", digest2), ""
{
// The same change, its manifest refused by the indexer's judge.
refusedMan := strings.Replace(lemurs2, `"version":"2"`, `"version":"3"`, 1)
d3 := meshcatalogclient.ManifestDigest([]byte(refusedMan))
man, _ := meshcatalogclient.EncodeManifest(meshcatalog.ManifestsByDigestValue{Module: "lemurs", Manifest: refusedMan})
key, _ := meshcatalogclient.ManifestsKey(d3)
b.kv[buckets.Manifests+"/"+key] = man
vkey, _ := meshcatalogclient.VerdictsKey(d3)
v, err := meshcatalogclient.EncodeVerdict(meshcatalog.VerdictsByDigestValue{Module: "lemurs", State: meshcatalogclient.VerdictRefused,
Problems: []string{"a field the judge refuses"}, Judge: "src2:j", At: func(t time.Time) *time.Time { return &t }(time.Now())})
if err != nil {
t.Fatal(err)
}
b.kv[buckets.Verdicts+"/"+vkey] = v
refusedKey = candidateOf("fix/941-refused", d3)
}
accepted := candidateOf("fix/940-no-retire-on-partial-read", digest2)
env := b.env()
state := &fakeComposed{kv: map[string]ComposedEntry{}}
@@ -144,14 +129,6 @@ func TestTheNodeComposesACandidateOnAsk(t *testing.T) {
in.ComposedHow.Builds["lemurs"] != fpNew {
t.Errorf("the input sent for the sandbox does not say how the node composes: %+v, %v", in.ComposedHow, err)
}
r := s.ComposeCandidate(ctx, nodeengine.ComposeCandidateInput{Candidate: refusedKey})
if r.Verdict != nec.Refused || len(r.Modules) != 1 || r.Modules[0].State != nec.ModuleRefused ||
!strings.Contains(r.Modules[0].Words, "a field the judge refuses") {
t.Errorf("a candidate whose manifest the indexer refused answered %+v", r)
}
if _, err := nec.EncodeAnswer(r); err != nil {
t.Errorf("the refused answer does not fit the seat's shape: %v", err)
}
// A-226b: a branch pipeline's revision composes as the candidate, each module at the revision's build; one the catalog does
// not hold, and a run on request's key, are refused in words.
revKey, _ := nec.RevisionKey("main", 362)
+6 -14
View File
@@ -1454,7 +1454,7 @@ func (c *Composer) Policy(ctx context.Context, module string) string {
if err != nil {
return ""
}
parsed, held, err := c.taken(module, m, raw)
parsed, held, err := c.taken(module, raw)
if err != nil || held != "" {
return ""
}
@@ -1486,16 +1486,11 @@ func (c *Composer) Claims(_ context.Context, module, seat string) (claims, known
return a.Manifest.ClaimsSeat(seat), true
}
// taken is a module's manifest as this engine reads it (novox/hq ADR 0578 §3): decoded leniently, judging nothing, with
// the indexer's verdict from the module's value (a missing one is accepted). held is why the module is held, "" when it is
// not: a manifest the indexer refused, or one not read past a field this engine does not know. A field set aside is said
// taken is a module's manifest as this engine reads it: decoded leniently, judging nothing; a module in a catalog revision is
// accepted by being there (design 47 H, H-A-79, H-A-111). held is why the module is held, "" when it is not: one not read past
// a field this engine does not know. A field set aside is said
// once, and an error is returned only for bytes that are no manifest, which the caller says in its own words.
func (c *Composer) taken(module string, m meshcatalog.ModulesByModuleValue, raw []byte) (man catalogue.Manifest, held string, err error) {
if v := meshcatalogclient.ModuleVerdict(module, m); v != nil {
if refused, _ := meshcatalogclient.TakeVerdict(v); refused {
return catalogue.Manifest{}, meshcatalogclient.VerdictWhy(*v), nil
}
}
func (c *Composer) taken(module string, raw []byte) (man catalogue.Manifest, held string, err error) {
man, err = catalogue.Decode(raw)
if err != nil {
c.sayOnceEach("the manifest of " + module + " does not decode, and the module is held: " + err.Error())
@@ -1552,10 +1547,7 @@ func (c *Composer) certificateWanted(ctx context.Context, r reader, p meshmodule
if err != nil {
continue
}
c.mu.Lock()
mod := c.modules[m.Module]
c.mu.Unlock()
parsed, held, err := c.taken(m.Module, mod, raw)
parsed, held, err := c.taken(m.Module, raw)
if err != nil || held != "" {
continue // held or not read: it asks none, and its refusal is named by the composition
}
-38
View File
@@ -624,44 +624,6 @@ func TestTheNodeComposesItsWantsFromTheBus(t *testing.T) {
strings.Contains((*told)[0], "held lemurs") {
t.Errorf("the agent was told %q, want de-spiegel held alone, in its config form's words, without its routes", *told)
}
// Issue 774, 2026-10-30 19:13: a manifest the mesh refuses (power's bar item at mesh-catalog ca8d6f33, captured, with
// attributes its bar places by none of) refused every node's composition and failed all its modules. Now power is
// held alone, naming why, and lemurs is handed.
power, err := os.ReadFile("testdata/power-ca8d6f33.module.json")
if err != nil {
t.Fatal(err)
}
c4, told4 := fresh(env.Get)
powerFP := meshcatalogclient.SourcePrefix2 + strings.Repeat("c", 64)
powerHalf := catalogHalf{}
powerHalf.add(t, "power", powerFP, string(power))
powerEntry := powerHalf[powerFP]
// The verdict the catalog half's entry carries on the captured manifest (ADR 0578): the engine judges nothing, it takes this.
powerEntry.Repository, powerEntry.Commit, powerEntry.Verdict = "novox/mesh-catalog", "ca8d6f33", meshcatalogclient.VerdictRefused
powerEntry.Inputs = &meshcatalog.EntryInputs{Problems: []string{`bar item "shows" is none of them`}}
c4.mu.Lock()
c4.keptEnt[powerFP] = keptEntry{entry: powerEntry}
c4.mu.Unlock()
c4.wants["power"] = meshwants.WantsByWantNodeModuleValue{Fp: powerFP, Self: true}
p4 := c4.assignments["n1"]
p4.Modules = append(append([]meshmoduleassigner.PlacedModule{}, p4.Modules...), meshmoduleassigner.PlacedModule{Module: "power"})
c4.assignments["n1"] = p4
handed4 := map[string]agent.Update{}
for _, u := range c4.compose(ctx) {
handed4[u.Key] = u
}
if u, ok := handed4[lemursKey3]; !ok || u.Deleted {
t.Errorf("lemurs is not handed beside power's refused manifest: %v (told %q)", handed4, *told4)
}
if len(*told4) != 1 || !strings.HasPrefix((*told4)[0], "held power: ") || !strings.Contains((*told4)[0], `"shows" is none of them`) {
t.Errorf("the agent was told %q, want power held alone, naming its item", *told4)
}
// Issue 1921: the composition verb's held says what holds power and the build it would be composed at, as the input a
// check's composer reads says it.
if why := c4.LastHeld()["power"]; !strings.Contains(why, `"shows" is none of them`) ||
!strings.Contains(why, "held by its manifest's verdict, at the build "+powerFP) {
t.Errorf("the last pass held power for %q, want its verdict and its build named", why)
}
// Review of issue 774 (the kept read): mesh-wireguard, which the mesh provides and which never has a fingerprint, is
// folded in the node's own and composed from the manifest mesh-sdk provides (overlay.ProvidedManifest), not from
// what runs nor the kept declaration: with nothing running (the kept read retired, Running empty) the node's own
-452
View File
@@ -1,452 +0,0 @@
{
"module": "power",
"version": "1",
"moved": true,
"templates": "templates",
"capabilities": [
"package-manager",
"service-manager"
],
"claims": [
{
"name": "node-power",
"scope": "node"
}
],
"emits": [
"booted",
"sleeping",
"woke",
"shutting-down",
"on-mains",
"on-battery",
"battery-low"
],
"state": [
{
"name": "draw",
"ttl-seconds": 30,
"per-machine": true
}
],
"tools": [
"power_state",
"power_hooks",
"power_history",
"power_run",
"power_check"
],
"config": {
"handle-power-key": {
"type": "string",
"description": "What logind does when the power key is pressed: one of logind's actions, such as suspend, ignore or poweroff (logind.conf(5)); the operator's choice for this machine, with no default.",
"enum": [
"ignore",
"poweroff",
"reboot",
"halt",
"kexec",
"suspend",
"hibernate",
"hybrid-sleep",
"suspend-then-hibernate",
"lock",
"factory-reset",
"sleep"
],
"trusted": true,
"required": true
},
"handle-lid-switch": {
"type": "string",
"description": "What logind does when the lid is closed on battery: one of logind's actions, such as suspend, ignore or poweroff (logind.conf(5)); the operator's choice for this machine, with no default.",
"enum": [
"ignore",
"poweroff",
"reboot",
"halt",
"kexec",
"suspend",
"hibernate",
"hybrid-sleep",
"suspend-then-hibernate",
"lock",
"factory-reset",
"sleep"
],
"trusted": true,
"required": true
},
"handle-lid-switch-external-power": {
"type": "string",
"description": "What logind does when the lid is closed on external power: one of logind's actions, such as suspend, ignore or poweroff (logind.conf(5)); the operator's choice for this machine, with no default.",
"enum": [
"ignore",
"poweroff",
"reboot",
"halt",
"kexec",
"suspend",
"hibernate",
"hybrid-sleep",
"suspend-then-hibernate",
"lock",
"factory-reset",
"sleep"
],
"trusted": true,
"required": true
},
"handle-lid-switch-docked": {
"type": "string",
"description": "What logind does when the lid is closed while docked or with another screen attached: one of logind's actions, such as suspend, ignore or poweroff (logind.conf(5)); the operator's choice for this machine, with no default.",
"enum": [
"ignore",
"poweroff",
"reboot",
"halt",
"kexec",
"suspend",
"hibernate",
"hybrid-sleep",
"suspend-then-hibernate",
"lock",
"factory-reset",
"sleep"
],
"trusted": true,
"required": true
}
},
"resources": [
{
"id": "polkit",
"type": "package",
"package": "polkit"
},
{
"id": "scripts",
"type": "archive",
"path": "/usr/local/lib/mesh-power",
"artifact": "scripts",
"unknown": "program"
},
{
"id": "config-dir",
"type": "directory",
"path": "/etc/mesh-power",
"mode": "0755",
"unknown": "program"
},
{
"id": "moments-dir",
"type": "directory",
"path": "/etc/mesh-power/moments",
"mode": "0755",
"unknown": "program"
},
{
"id": "moment-after-boot",
"type": "file",
"path": "/etc/mesh-power/moments/after-boot",
"mode": "0644",
"template": "templates/mesh-power/moments/after-boot"
},
{
"id": "moment-before-sleep",
"type": "file",
"path": "/etc/mesh-power/moments/before-sleep",
"mode": "0644",
"template": "templates/mesh-power/moments/before-sleep"
},
{
"id": "moment-after-wake",
"type": "file",
"path": "/etc/mesh-power/moments/after-wake",
"mode": "0644",
"template": "templates/mesh-power/moments/after-wake"
},
{
"id": "moment-before-shutdown",
"type": "file",
"path": "/etc/mesh-power/moments/before-shutdown",
"mode": "0644",
"template": "templates/mesh-power/moments/before-shutdown"
},
{
"id": "moment-on-mains",
"type": "file",
"path": "/etc/mesh-power/moments/on-mains",
"mode": "0644",
"template": "templates/mesh-power/moments/on-mains"
},
{
"id": "moment-on-battery",
"type": "file",
"path": "/etc/mesh-power/moments/on-battery",
"mode": "0644",
"template": "templates/mesh-power/moments/on-battery"
},
{
"id": "logind-drop-ins",
"type": "directory",
"path": "/etc/systemd/logind.conf.d",
"mode": "0755",
"unknown": "program"
},
{
"id": "logind-power",
"type": "file",
"path": "/etc/systemd/logind.conf.d/power.conf",
"mode": "0644",
"template": "templates/systemd/logind.conf.d/power.conf"
},
{
"id": "logind",
"type": "service",
"unit": "systemd-logind.service",
"reload-on": [
"logind-power"
]
},
{
"id": "after-boot-unit",
"type": "file",
"path": "/etc/systemd/system/mesh-power-after-boot.service",
"mode": "0644",
"template": "templates/systemd/system/mesh-power-after-boot.service"
},
{
"id": "before-shutdown-unit",
"type": "file",
"path": "/etc/systemd/system/mesh-power-before-shutdown.service",
"mode": "0644",
"template": "templates/systemd/system/mesh-power-before-shutdown.service"
},
{
"id": "before-sleep-unit",
"type": "file",
"path": "/etc/systemd/system/mesh-power-before-sleep.service",
"mode": "0644",
"template": "templates/systemd/system/mesh-power-before-sleep.service"
},
{
"id": "after-wake-unit",
"type": "file",
"path": "/etc/systemd/system/mesh-power-after-wake.service",
"mode": "0644",
"template": "templates/systemd/system/mesh-power-after-wake.service"
},
{
"id": "supply-unit",
"type": "file",
"path": "/etc/systemd/system/mesh-power-supply.service",
"mode": "0644",
"template": "templates/systemd/system/mesh-power-supply.service"
},
{
"id": "sleep-drop-ins",
"type": "directory",
"path": "/etc/systemd/system/sleep.target.d",
"mode": "0755",
"unknown": "program"
},
{
"id": "sleep-wants",
"type": "file",
"path": "/etc/systemd/system/sleep.target.d/mesh-power.conf",
"mode": "0644",
"template": "templates/systemd/system/sleep.target.d/mesh-power.conf"
},
{
"id": "suspend-drop-ins",
"type": "directory",
"path": "/etc/systemd/system/suspend.target.d",
"mode": "0755",
"unknown": "program"
},
{
"id": "suspend-wants",
"type": "file",
"path": "/etc/systemd/system/suspend.target.d/mesh-power.conf",
"mode": "0644",
"template": "templates/systemd/system/suspend.target.d/mesh-power.conf"
},
{
"id": "hibernate-drop-ins",
"type": "directory",
"path": "/etc/systemd/system/hibernate.target.d",
"mode": "0755",
"unknown": "program"
},
{
"id": "hibernate-wants",
"type": "file",
"path": "/etc/systemd/system/hibernate.target.d/mesh-power.conf",
"mode": "0644",
"template": "templates/systemd/system/hibernate.target.d/mesh-power.conf"
},
{
"id": "hybrid-sleep-drop-ins",
"type": "directory",
"path": "/etc/systemd/system/hybrid-sleep.target.d",
"mode": "0755",
"unknown": "program"
},
{
"id": "hybrid-sleep-wants",
"type": "file",
"path": "/etc/systemd/system/hybrid-sleep.target.d/mesh-power.conf",
"mode": "0644",
"template": "templates/systemd/system/hybrid-sleep.target.d/mesh-power.conf"
},
{
"id": "suspend-then-hibernate-drop-ins",
"type": "directory",
"path": "/etc/systemd/system/suspend-then-hibernate.target.d",
"mode": "0755",
"unknown": "program"
},
{
"id": "suspend-then-hibernate-wants",
"type": "file",
"path": "/etc/systemd/system/suspend-then-hibernate.target.d/mesh-power.conf",
"mode": "0644",
"template": "templates/systemd/system/suspend-then-hibernate.target.d/mesh-power.conf"
},
{
"id": "reboot-drop-ins",
"type": "directory",
"path": "/etc/systemd/system/reboot.target.d",
"mode": "0755",
"unknown": "program"
},
{
"id": "reboot-bound",
"type": "file",
"path": "/etc/systemd/system/reboot.target.d/mesh-power.conf",
"mode": "0644",
"template": "templates/systemd/system/reboot.target.d/mesh-power.conf"
},
{
"id": "poweroff-drop-ins",
"type": "directory",
"path": "/etc/systemd/system/poweroff.target.d",
"mode": "0755",
"unknown": "program"
},
{
"id": "poweroff-bound",
"type": "file",
"path": "/etc/systemd/system/poweroff.target.d/mesh-power.conf",
"mode": "0644",
"template": "templates/systemd/system/poweroff.target.d/mesh-power.conf"
},
{
"id": "halt-drop-ins",
"type": "directory",
"path": "/etc/systemd/system/halt.target.d",
"mode": "0755",
"unknown": "program"
},
{
"id": "halt-bound",
"type": "file",
"path": "/etc/systemd/system/halt.target.d/mesh-power.conf",
"mode": "0644",
"template": "templates/systemd/system/halt.target.d/mesh-power.conf"
},
{
"id": "udev-rule",
"type": "file",
"path": "/etc/udev/rules.d/90-mesh-power.rules",
"mode": "0644",
"template": "templates/udev/rules.d/90-mesh-power.rules"
},
{
"id": "after-boot",
"type": "service",
"unit": "mesh-power-after-boot.service",
"state": "running",
"boot": "enabled"
},
{
"id": "before-shutdown",
"type": "service",
"unit": "mesh-power-before-shutdown.service",
"state": "running",
"boot": "enabled"
},
{
"id": "draw-dir",
"type": "directory",
"path": "/run/mesh-power",
"mode": "0755",
"unknown": "program"
},
{
"id": "draw",
"type": "process",
"name": "mesh-power-draw",
"artifact": "tools-go",
"run": [
"./power",
"draw"
],
"health": {
"kind": "unit"
}
}
],
"build": {
"artifacts": [
{
"name": "tools-go",
"kind": "bundle",
"language": "go",
"system": "arch",
"from": "cmd/power",
"binary": "power",
"loads": [
"power"
]
},
{
"name": "scripts",
"kind": "archive",
"from": "files"
},
{
"name": "templates",
"kind": "archive",
"from": "templates"
}
]
},
"items": [
{
"collection": "contribution:node-bar:block",
"name": "battery",
"if-capability": "battery",
"attributes": {
"bar": "bottom",
"place": "status",
"order": "40"
},
"template": "templates/bar-battery"
},
{
"collection": "contribution:node-bar:block",
"name": "power-draw",
"if-capability": "power-meter",
"attributes": {
"bar": "bottom",
"place": "status",
"order": "45",
"shows": "state",
"state": "power.draw"
},
"template": "templates/bar-power-draw"
}
]
}