diff --git a/cmd/mesh-compose/main_test.go b/cmd/mesh-compose/main_test.go index 07d216b7..12e43dbe 100644 --- a/cmd/mesh-compose/main_test.go +++ b/cmd/mesh-compose/main_test.go @@ -3,9 +3,6 @@ package main import ( "bytes" "encoding/json" - "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/clients/meshcatalogclient" - "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshcatalog" - "github.com/novox/mesh-host/internal/buckets/bucketstest" "go/build" "os" "os/exec" @@ -110,8 +107,6 @@ func encode(t *testing.T, r composer.Request) []byte { func TestTheCommandWritesOneVerdictPerManifestAndMachine(t *testing.T) { r := request(t, composer.DepthResolve) r.Cases[0].Manifests["later"] = composer.Manifest{Raw: json.RawMessage(`{"module":"later","version":"1","shares":["x"]}`)} - r.Cases[0].Manifests["refused"] = composer.Manifest{Raw: json.RawMessage(`{"module":"refused","version":"1"}`)} - r.Cases[0].Verdicts = bucketstest.Raw(map[string]meshcatalog.VerdictsByDigestValue{"refused": {V: 1, Module: "refused", Judge: "src2:j", State: meshcatalogclient.VerdictRefused, Problems: []string{"it is wrong"}}}) code, v, stderr := runJSON(t, nil, encode(t, r)) if code != 0 { t.Fatalf("exit %d: %s", code, stderr) @@ -120,14 +115,11 @@ func TestTheCommandWritesOneVerdictPerManifestAndMachine(t *testing.T) { t.Fatalf("verdict = %+v", v) } c := v.Cases[0] - // ADR 0578 §5, §6: the composer judges nothing; it sets an unknown field aside and names it, and holds a manifest - // its verdict refuses, named in the indexer's words. + // ADR 0578 §5, §6: the composer judges nothing; it sets an unknown field aside and names it, and a manifest in the + // case is accepted by being there (design 47 H, H-A-112). if got := c.Manifests["later"]; !got.Accepted || !strings.Contains(got.SetAside, `"shares"`) { t.Errorf("the manifest with an unknown field reads %+v, want accepted naming the field set aside", got) } - if got := c.Manifests["refused"]; got.Accepted || !strings.Contains(got.Refused, "refused the manifest of refused: it is wrong") { - t.Errorf("the refused manifest reads %+v, want refused in the verdict's words", got) - } if got := c.Manifests["nats"]; !got.Accepted { t.Errorf("nats reads %+v, want accepted", got) } diff --git a/internal/compose/frombus/answer_rows_test.go b/internal/compose/frombus/answer_rows_test.go index d15ef72a..5a4011b1 100644 --- a/internal/compose/frombus/answer_rows_test.go +++ b/internal/compose/frombus/answer_rows_test.go @@ -270,26 +270,6 @@ func answerNamesEveryRefusalAndLeavesAnOldBuildToTheNode(t *testing.T) { if got, _ := compose.ContentDigest(compact.Bytes()); err == nil && (want == "" || read.ComposedHow.Manifests["spiegel"] != want || got != want) { t.Errorf("the manifest spiegel's build was made of: %v, want %s (compacted %s)", read.ComposedHow.Manifests, want, got) } - // Issue 1921: held by its manifest's verdict, spiegel is still held in what the node composes, and the input a check - // is answered with says what holds it and carries the build the node would compose it at, taken in while done; a - // node's own read takes in no build of it. - sp.Verdict, sp.Problems = meshcatalogclient.VerdictRefused, []string{"p"} - bb.modules["spiegel"] = sp - for _, done := range []bool{true, false} { - if !done { - bb.builds["spiegel "+sp.Fp2].State = builds.BuildBuilding - } - read, err = ComposingInput(ctx, bb, Mesh{}, Scope{Node: "n1"}, map[string]string{"lemurs": fp("e"), "spiegel": sp.Fp2}) - hold := read.Holds["spiegel"] - raw, _ = json.Marshal(hold.Built) - if err != nil || !read.Catalogue["spiegel"].Stubbed || hold.By != compose.HeldByVerdict || hold.Build != sp.Fp2 || - strings.Contains(string(raw), strings.Repeat("7", 64)) != done || (hold.Built == nil) == done { - t.Errorf("spiegel refused, its build done %v: %v, hold %+v (built %s)", done, err, hold, raw) - } - } - if own, err := Input(ctx, bb, Mesh{}, Scope{Node: "n1"}); err != nil || own.Holds["spiegel"] != (compose.Hold{By: compose.HeldByVerdict}) { - t.Errorf("a node's own read of spiegel refused: %v, hold %+v", err, own.Holds["spiegel"]) - } } // (C) Issue 1126, C5: what the others read of a module carried as it runs is what runs, never its stub's: the filter diff --git a/internal/compose/frombus/frombus.go b/internal/compose/frombus/frombus.go index 2f9866ef..b7240a0a 100644 --- a/internal/compose/frombus/frombus.go +++ b/internal/compose/frombus/frombus.go @@ -46,7 +46,6 @@ import ( "git.novox.be/novox/mesh-contracts/go/seats/nodeengine" "git.novox.be/novox/mesh-contracts/identity-and-access/go/clients/meshvaultclient" "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds" - "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/clients/meshcatalogclient" "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshcatalog" engcomp "github.com/novox/mesh-host/internal/compositions" @@ -238,25 +237,19 @@ func InOwn(running []engcomp.Composed, p meshmoduleassigner.Assignments) []strin // Input is the composition input for s, read through r. // // **A refused manifest never ends the read** (novox/hq ADR 0578 §3): each manifest is decoded leniently -// (catalogue.Decode) and the indexer's verdict on it taken from its modules value (meshcatalogclient.TakeVerdict, a missing -// one accepted); a module whose manifest the indexer's judge refused, or whose bytes do not decode, stands in the +// (catalogue.Decode), a module in the catalog revision accepted by being there (H-A-111); a module whose bytes do not decode stands in the // catalogue as its stub (unusable), so what it provides and requires still shapes the rest, and is named with why in // the input's Refused; a field set aside is named in its SetAside. Every other module of the read goes on. func Input(ctx context.Context, r Reader, mesh Mesh, s Scope) (compose.Input, error) { return input(ctx, r, mesh, s, nil, nil) } -// taken is a module's manifest as a reader takes it (novox/hq ADR 0578 §3): decoded leniently, with the indexer's verdict -// from its modules value. A refused one, or bytes that do not decode, stands as its stub (unusable) and why says so; a -// manifest not read past a field it set aside holds its name alone and is held the same. +// taken is a module's manifest as a reader takes it: decoded leniently, the module accepted by being in the catalog revision +// (design 47 H, H-A-79, H-A-111: the seat keeps no state verdicts, the pipeline's validate step refuses a manifest before it is +// there). Bytes that do not decode, or a manifest not read past a field it set aside, stand as the stub (unusable) and why says so. // -// by is what holds it (compose.HeldByVerdict or compose.HeldByDecoder), empty when nothing does. -func taken(name string, raw []byte, m meshcatalog.ModulesByModuleValue) (man catalogue.Manifest, why, by string) { - if v := meshcatalogclient.ModuleVerdict(name, m); v != nil { - if refused, _ := meshcatalogclient.TakeVerdict(v); refused { - return unusable(name, raw), meshcatalogclient.VerdictWhy(*v), compose.HeldByVerdict - } - } +// by is what holds it (compose.HeldByDecoder), empty when nothing does. +func taken(name string, raw []byte) (man catalogue.Manifest, why, by string) { man, err := catalogue.Decode(raw) switch { case err != nil: @@ -416,7 +409,7 @@ func readBase(ctx context.Context, r Reader, mesh Mesh, s Scope) (base, error) { // follows (issue 774: power's bar item refused every node's composition, 2026-10-30; ADR 0578 §3: one refused // manifest silenced disk-load for 45 hours). It stands in as its stub, so what it provides and requires still // shapes the rest; it is held on the composing node where it is placed there, and elsewhere only its offer is read. - man, why, by := taken(name, raw, m) + man, why, by := taken(name, raw) if why != "" { named(&in.Refused, name, why) if in.Holds == nil { diff --git a/internal/compose/frombus/frombustest/frombustest_test.go b/internal/compose/frombus/frombustest/frombustest_test.go index 330db3dd..993966bf 100644 --- a/internal/compose/frombus/frombustest/frombustest_test.go +++ b/internal/compose/frombus/frombustest/frombustest_test.go @@ -39,9 +39,6 @@ func TestTheProvisionedMeshHandsAPlanWithItsProvision(t *testing.T) { why string // words backup's hold says // elsewhere leaves backup in the indexer's modules and places it on no node: nothing is held. elsewhere bool - // refused is the indexer's verdict on bad, a problem its judge found (novox/hq ADR 0578 §1): Plans then holds - // backup too, and never ends the read. - refused string // dataHeld says the data items' read holds backup too: a refusal it meets (a refused manifest, an unusable build, // an item composition refuses), not one only a plan meets. dataHeld bool @@ -55,14 +52,11 @@ func TestTheProvisionedMeshHandsAPlanWithItsProvision(t *testing.T) { {name: "a plan that refuses", bad: `{"module":"backup","version":"1","resources":[{"id":"conf","type":"file","path":"/etc/backup.conf",` + `"mode":"0600","content":"key=${secret:nope}"}]}`, why: "${secret:nope}"}, - {name: "an indexer's manifest the mesh refuses", bad: unusableItem, why: `"shows" is none of them`, - refused: `"shows" is none of them`, dataHeld: true}, // ADR 0578 §3: an accepted manifest whose data item its composition refuses is held by the culprit rule, in every read. {name: "a data item its composition refuses", bad: `{"module":"backup","version":"1","data":{"own":[{"id":"d","path":"${dir:nope}","class":"cache"}]}}`, why: "nope", dataHeld: true, dataOnly: true}, - {name: "an indexer's manifest the mesh refuses, placed elsewhere", bad: unusableItem, elsewhere: true, - refused: `"shows" is none of them`}, + {name: "a manifest the mesh refuses, placed elsewhere", bad: unusableItem, elsewhere: true}, } { b, err := Provisioned() if err != nil { @@ -77,10 +71,6 @@ func TestTheProvisionedMeshHandsAPlanWithItsProvision(t *testing.T) { digest := meshcatalogclient.ManifestDigest([]byte(row.bad)) b.Manifests[digest] = []byte(row.bad) b.Module["backup"] = meshcatalog.ModulesByModuleValue{Fp2: fp, Manifest: digest} - if row.refused != "" { - b.Module["backup"] = meshcatalog.ModulesByModuleValue{Fp2: fp, Manifest: digest, Verdict: meshcatalogclient.VerdictRefused, - Problems: []string{row.refused}} - } if row.built != "" { builtDigest := meshcatalogclient.ManifestDigest([]byte(row.built)) b.Manifests[builtDigest] = []byte(row.built) @@ -94,11 +84,8 @@ func TestTheProvisionedMeshHandsAPlanWithItsProvision(t *testing.T) { } continue } - plans, err := frombus.Plans(context.Background(), b, frombus.Mesh{}, frombus.Scope{Node: Node}) - switch { - case row.refused != "" && (err != nil || !planned(plans, "restic") || planned(plans, "backup")): - t.Errorf("%s: Plans did not hold the refused manifest alone: %v %v", row.name, plans, err) - case row.refused == "" && err == nil && !row.elsewhere: + _, err := frombus.Plans(context.Background(), b, frombus.Mesh{}, frombus.Scope{Node: Node}) + if err == nil && !row.elsewhere { t.Errorf("%s: Plans composed the node; the row does not refuse it", row.name) } } diff --git a/internal/compose/frombus/held_rows_test.go b/internal/compose/frombus/held_rows_test.go index 628d617e..b75ad4f9 100644 --- a/internal/compose/frombus/held_rows_test.go +++ b/internal/compose/frombus/held_rows_test.go @@ -39,7 +39,7 @@ func aNode(t *testing.T, manifests ...string) (*bus, map[string]string) { // Issue 774, 2026-10-30 19:30: a node refused whole after holding a module says what it held and why, since the last // refusal can be of the held module's stub (node-tools held, then "its build produced 0 bundle(s)", its own why unsaid). func aNodeRefusedWholeSaysWhatItHeld(t *testing.T) { - refused := `{"module":"power","version":"1","items":[{"collection":"contribution:node-bar:block","attributes":{"shows":"state"},"template":"files/a"}]}` + refused := `{"module":"power","version":"1","resources":"none"}` needs := `{"module":"lamp","version":"1","requires":["two-provide-this"]}` giverA := `{"module":"giver-a","version":"1","provides":[{"name":"two-provide-this"}]}` giverB := `{"module":"giver-b","version":"1","provides":[{"name":"two-provide-this"}]}` @@ -48,38 +48,28 @@ func aNodeRefusedWholeSaysWhatItHeld(t *testing.T) { placed := b.assignments["n1"] placed.Modules = placed.Modules[:2] b.assignments["n1"] = placed - refuse(b, "power", `"shows" is none of them`) _, _, held, err := Compose(context.Background(), b, Mesh{}, Scope{Node: "n1"}, fps) if err == nil || !strings.Contains(err.Error(), "choose one") || !strings.Contains(err.Error(), `held before: power: `) || - !strings.Contains(err.Error(), `"shows" is none of them`) { + !strings.Contains(err.Error(), `does not decode`) { t.Errorf("the node refused whole with %v (held %v), want lamp's refusal and power held before, with its why", err, held) } } -// refuse writes the indexer's refusal of module's manifest into its modules value (novox/hq ADR 0578 §1). -func refuse(b *bus, module string, problems ...string) { - m := b.modules[module] - m.Verdict, m.Problems = meshcatalogclient.VerdictRefused, problems - b.modules[module] = m -} - // ADR 0578 §3: the bus reader never ends a whole read on a refused manifest. Input, Plans and DataItems compose the rest // and hold the refused module, named with the indexer's words in Refused; a field the decoder does not know is set aside // and named, and its module composed. func aRefusedManifestNeverEndsTheRead(t *testing.T) { ok := `{"module":"lamp","version":"1","resources":[{"id":"d","type":"directory","path":"/srv/lamp","mode":"0700"}],` + `"data":{"own":[{"id":"d","path":"${dir:d}","class":"valuable"}]}}` - bad := `{"module":"power","version":"1","resources":[{"id":"d","type":"directory","path":"/srv/power","mode":"0700"}],` + - `"data":{"own":[{"id":"d","path":"${dir:d}","class":"valuable"}]}}` + bad := `{"module":"power","version":"1","resources":"none"}` later := `{"module":"later","version":"1","a-field-from-later":1}` b, _ := aNode(t, ok, bad, later) - refuse(b, "power", "removes a stream it may not") ctx := context.Background() in, err := Input(ctx, b, Mesh{}, Scope{Node: "n1"}) if err != nil { t.Fatalf("one refused manifest ended the read: %v", err) } - if why := in.Refused["power"]; !strings.Contains(why, "refused the manifest of power: removes a stream it may not") || + if why := in.Refused["power"]; !strings.Contains(why, "the manifest of power does not decode") || len(in.Refused) != 1 { t.Fatalf("refused: %v", in.Refused) } @@ -93,7 +83,7 @@ func aRefusedManifestNeverEndsTheRead(t *testing.T) { t.Fatalf("plans: %v", err) } items, _, held, err := DataItemsHeld(ctx, b, Mesh{}, Scope{Node: "n1"}) - if err != nil || len(items["lamp"]) != 1 || items["power"] != nil || !strings.Contains(held["power"], "removes a stream") { + if err != nil || len(items["lamp"]) != 1 || items["power"] != nil || !strings.Contains(held["power"], "does not decode") { t.Fatalf("data items %v held %v: %v", items, held, err) } } diff --git a/internal/composer/composer.go b/internal/composer/composer.go index 60372efa..a70800dc 100644 --- a/internal/composer/composer.go +++ b/internal/composer/composer.go @@ -13,8 +13,6 @@ import ( "fmt" "git.novox.be/novox/mesh-contracts/go/clients/meshmoduleassignerclient" "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/seats/meshcatalog" "git.novox.be/novox/mesh-networking/modules/mesh-wireguard/go/overlay" "maps" "slices" @@ -23,7 +21,6 @@ import ( sdk "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/composer" "git.novox.be/novox/mesh-sdk/go/catalogue" - "git.novox.be/novox/mesh-sdk/go/keys" "git.novox.be/novox/mesh-sdk/go/sdkversion" "github.com/novox/mesh-host/internal/compose" @@ -96,10 +93,10 @@ func Run(r Request) (Verdict, error) { return v, nil } -// parse decodes every manifest leniently and takes its verdict (novox/hq ADR 0578 §3, §5): the composer judges none. A -// manifest refused by its verdict is held, composed as its stub without its items (as the bus reader holds one); bytes -// that do not decode are left out. Both are named in reads. -func parse(m map[string]Manifest, reads map[string]ManifestRead, verdicts map[string]json.RawMessage) (map[string]catalogue.Manifest, error) { +// parse decodes every manifest leniently (novox/hq ADR 0578 §3, §5): the composer judges none, and a manifest in a case is +// accepted by being there (design 47 H, H-A-79, H-A-112: the validate step judged it). Bytes that do not decode are left +// out and named in reads. +func parse(m map[string]Manifest, reads map[string]ManifestRead) (map[string]catalogue.Manifest, error) { out := map[string]catalogue.Manifest{} for name, man := range m { if len(man.Raw) == 0 { @@ -109,19 +106,6 @@ func parse(m map[string]Manifest, reads map[string]ManifestRead, verdicts map[st read := ManifestRead{Accepted: err == nil, SetAside: decoded.SetAside()} if err != nil { read.Refused = fmt.Sprintf("the manifest of %s does not decode: %v", name, err) - } else if raw, ok := verdicts[name]; ok { - v, verr := caseVerdict(raw) - if verr != nil { - return nil, fmt.Errorf("composer: the verdict of %s is not one: %w", name, verr) - } - if refused, _ := meshcatalogclient.TakeVerdict(&v); refused { - if v.Module == "" { - v.Module = name - } - read = ManifestRead{Refused: meshcatalogclient.VerdictWhy(v)} - decoded.Items = nil - decoded = compose.Stub(decoded) - } } if reads != nil { reads[name] = read @@ -133,31 +117,9 @@ func parse(m map[string]Manifest, reads map[string]ManifestRead, verdicts map[st return out, nil } -// caseVerdict reads a verdict a case carries. It is not the indexer's kept value but the checker's account of it, made -// from the indexer's modules value: a checker of the trunk writes it with version 0 and no judge, one of the registry -// milestone with no version and no judge, and the composer of a group's head is asked by the checker that runs. So it is -// read in the kept value's form at version 0 (or none) and at keys.Version, its judge optional; a later version, a value -// that does not decode and a state no reader knows are refused, never taken as accepted. -func caseVerdict(raw json.RawMessage) (meshcatalog.VerdictsByDigestValue, error) { - var v meshcatalog.VerdictsByDigestValue - if err := json.Unmarshal(raw, &v); err != nil { - return v, fmt.Errorf("the value does not fit a verdict's shape: %w", err) - } - if v.V != 0 && v.V != keys.Version { - return v, fmt.Errorf("%w: the value is version %d, this reader reads 0 and %d", keys.ErrUnknownVersion, v.V, keys.Version) - } - switch v.State { - case meshcatalogclient.VerdictAccepted, meshcatalogclient.VerdictRefused, meshcatalogclient.VerdictManifestWaits: - default: - return v, fmt.Errorf("the state %q is none of %s, %s and %s", v.State, meshcatalogclient.VerdictAccepted, - meshcatalogclient.VerdictRefused, meshcatalogclient.VerdictManifestWaits) - } - return v, nil -} - func runCase(r Request, c Case, depth string) (CaseVerdict, error) { cv := CaseVerdict{Name: c.Name, Manifests: map[string]ManifestRead{}} - shelf, err := parse(c.Manifests, cv.Manifests, c.Verdicts) + shelf, err := parse(c.Manifests, cv.Manifests) if err != nil { return CaseVerdict{}, err } @@ -223,7 +185,7 @@ func runCase(r Request, c Case, depth string) (CaseVerdict, error) { } in.Nodes[i].Kept = nil if kept := c.Kept[in.Nodes[i].Name]; len(kept) > 0 { - k, err := parse(kept, nil, nil) + k, err := parse(kept, nil) if err != nil { return CaseVerdict{}, err } @@ -310,9 +272,6 @@ func overrule(base compose.Input, c Case, reads map[string]ManifestRead, shelf m held = "not read by the running node-engine's decoder" } judged := "accepted by the check's own validator" - if _, given := c.Verdicts[name]; !given { - judged = "given no verdict by the check, so taken as accepted (novox/hq ADR 0578 §3)" - } awaited[name] = "" if hold.Built == nil && compose.NamesBuild(shelf[name]) { build := "its build" @@ -356,9 +315,6 @@ func overrule(base compose.Input, c Case, reads map[string]ManifestRead, shelf m "beyond what a take-in resolves" } judged := "accepted by the check's own validator" - if _, given := c.Verdicts[name]; !given { - judged = "given no verdict by the check, so taken as accepted (novox/hq ADR 0578 §3)" - } at := "" if how != nil && how.Builds[name] != "" { at = " " + how.Builds[name] diff --git a/internal/composer/composer_test.go b/internal/composer/composer_test.go index c5c33b43..12c26527 100644 --- a/internal/composer/composer_test.go +++ b/internal/composer/composer_test.go @@ -3,11 +3,8 @@ package composer import ( "context" "encoding/json" - "errors" "fmt" "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/seats/meshcatalog" "git.novox.be/novox/mesh-networking/modules/mesh-wireguard/go/overlay" "github.com/novox/mesh-host/internal/buckets/bucketstest" engcomp "github.com/novox/mesh-host/internal/compositions" @@ -18,7 +15,6 @@ import ( "testing" "git.novox.be/novox/mesh-sdk/go/catalogue" - "git.novox.be/novox/mesh-sdk/go/keys" "github.com/novox/mesh-host/internal/compose" "github.com/novox/mesh-host/internal/compose/frombus" "github.com/novox/mesh-host/internal/compose/frombus/frombustest" @@ -214,9 +210,7 @@ func TestARequestItCannotRunIsRefused(t *testing.T) { for name, sent := range map[string]string{"with the mark": string(wire), "from an engine before it": older} { var r Request r = Request{V: Version, Machines: []string{"a"}, Depth: DepthCompose, - Cases: []Case{{Name: "change", Manifests: map[string]Manifest{"runner": {Raw: json.RawMessage(raw)}}, - Verdicts: bucketstest.Raw(map[string]meshcatalog.VerdictsByDigestValue{"runner": {V: 1, Module: "runner", - State: meshcatalogclient.VerdictRefused, Problems: []string{"p"}}})}}} + Cases: []Case{{Name: "change", Manifests: map[string]Manifest{"runner": {Raw: json.RawMessage(raw)}}}}} if err := json.Unmarshal([]byte(sent), &r.Input); err != nil { t.Fatal(err) } @@ -224,11 +218,11 @@ func TestARequestItCannotRunIsRefused(t *testing.T) { if err != nil { t.Fatal(err) } - if m := v.Cases[0].Machines["a"]; !m.Composes || strings.Contains(m.Reason, "bundle") { + if m := v.Cases[0].Machines["a"]; m.Reason != "" || m.NotJudged == "" { t.Errorf("%s: the node with its tool runner held: %+v", name, m) } - if read := v.Cases[0].Manifests["runner"]; read.Accepted || !strings.Contains(read.Refused, "the indexer's judge refused the manifest of runner") { - t.Errorf("%s: the runner's read names not why its node-engine holds it: %+v", name, read) + if read := v.Cases[0].Manifests["runner"]; !read.Accepted { + t.Errorf("%s: the runner's manifest is accepted by being in the case (H-A-112): %+v", name, read) } } }) @@ -250,32 +244,25 @@ func TestARequestItCannotRunIsRefused(t *testing.T) { if err != nil { t.Fatal(err) } - verdict := func(state string) map[string]json.RawMessage { - return bucketstest.Raw(map[string]meshcatalog.VerdictsByDigestValue{"app": {V: 1, Module: "app", State: state, Problems: []string{"p"}}}) - } const why = "the indexer's judge refused the manifest of app" for _, row := range []struct { name string raw string - verdicts map[string]json.RawMessage hold *compose.Hold composes bool // the machine composes, judged path string // a path declared on it words string // in NotJudged, else in the read's refusal }{ - {"an accepted verdict, its build carried", app, verdict(meshcatalogclient.VerdictAccepted), - &compose.Hold{By: compose.HeldByVerdict, Build: "fp1", Built: &built}, true, "/var/lib/app-built", ""}, - {"no verdict, its build carried", app, nil, &compose.Hold{By: compose.HeldByVerdict, Build: "fp1", Built: &built}, true, "/var/lib/app-built", ""}, - {"an accepted verdict, its build awaited", plain, verdict(meshcatalogclient.VerdictAccepted), &compose.Hold{By: compose.HeldByVerdict, Build: "fp1"}, false, "", + {"its build carried", app, &compose.Hold{By: compose.HeldByVerdict, Build: "fp1", Built: &built}, true, "/var/lib/app-built", ""}, + {"its build awaited", plain, &compose.Hold{By: compose.HeldByVerdict, Build: "fp1"}, false, "", "composed from the change's manifest without its build: app is refused only by the running indexer (" + why + ") and accepted by the check's own validator, and its build fp1 is awaited"}, - {"no verdict, from an engine before holds", plain, nil, nil, false, "", - "app is held by the running node-engine (" + why + ") and given no verdict by the check, so taken as accepted"}, - {"a container, its image awaited", app, nil, &compose.Hold{By: compose.HeldByVerdict}, false, "", + {"from an engine before holds", plain, nil, false, "", + "app is held by the running node-engine (" + why + ") and accepted by the check's own validator"}, + {"a container, its image awaited", app, &compose.Hold{By: compose.HeldByVerdict}, false, "", "composed with it held as its node-engine holds it, since it does not compose without its build: app is refused only by the running indexer"}, - {"a tool runner, its bundle awaited", runner, nil, &compose.Hold{By: compose.HeldByVerdict}, false, "", + {"a tool runner, its bundle awaited", runner, &compose.Hold{By: compose.HeldByVerdict}, false, "", "composed with it held as its node-engine holds it, since it does not compose without its build: app is refused only by the running indexer"}, - {"bytes that do not decode", `{"module": "app", "version": "1", "resources": "none"}`, nil, &compose.Hold{By: compose.HeldByVerdict, Built: &built}, true, "", "does not decode"}, - {"the case's own refusal", app, verdict(meshcatalogclient.VerdictRefused), &compose.Hold{By: compose.HeldByVerdict, Built: &built}, true, "", "refused the manifest of app"}, + {"bytes that do not decode", `{"module": "app", "version": "1", "resources": "none"}`, &compose.Hold{By: compose.HeldByVerdict, Built: &built}, true, "", "does not decode"}, } { man, _ := catalogue.Decode([]byte(app)) in := compose.Input{Catalogue: map[string]catalogue.Manifest{"app": compose.Stub(man)}, Refused: map[string]string{"app": why}, @@ -284,7 +271,7 @@ func TestARequestItCannotRunIsRefused(t *testing.T) { in.Holds = map[string]compose.Hold{"app": *row.hold} } v, err := Run(withInput(t, Request{V: Version, Machines: []string{"a"}, Depth: DepthCompose, Declarations: true, - Cases: []Case{{Name: "change", Manifests: map[string]Manifest{"app": {Raw: json.RawMessage(row.raw)}}, Verdicts: row.verdicts}}}, in)) + Cases: []Case{{Name: "change", Manifests: map[string]Manifest{"app": {Raw: json.RawMessage(row.raw)}}}}}, in)) if err != nil { t.Fatal(err) } @@ -420,9 +407,8 @@ func TestARequestItCannotRunIsRefused(t *testing.T) { // The composer judges no manifest (novox/hq ADR 0578 §5): xterm's module.json from mesh-catalog at 835bf22b, whose // config value falls back to "font-size", is read whatever list of predefined keys a request carries (a group touching -// xterm failed its composition on this, group check 18df81380db3); a module whose verdict in the input refuses it is -// held, composed as its stub, and named in the verdict's words. -func TestTheComposerTakesTheVerdictsOfItsInput(t *testing.T) { +// xterm failed its composition on this, group check 18df81380db3), and accepted by being in the case (design 47 H, H-A-112). +func TestTheComposerJudgesNoManifest(t *testing.T) { raw, err := os.ReadFile("testdata/catalogue-835bf22b-xterm.module.json") if err != nil { t.Fatal(err) @@ -436,31 +422,4 @@ func TestTheComposerTakesTheVerdictsOfItsInput(t *testing.T) { if got := v.Cases[0].Manifests["xterm"]; !got.Accepted { t.Fatalf("xterm: %+v, want accepted", got) } - r.Cases[0].Verdicts = bucketstest.Raw(map[string]meshcatalog.VerdictsByDigestValue{"xterm": {V: 1, Module: "xterm", State: meshcatalogclient.VerdictRefused, - Problems: []string{"falls back to a key not listed"}, Judge: "src2:j"}}) - shelf, err := parse(r.Cases[0].Manifests, map[string]ManifestRead{}, r.Cases[0].Verdicts) - if err != nil || !shelf["xterm"].Stubbed { - t.Fatalf("the refused module is not held as its stub: %+v %v", shelf["xterm"], err) - } - if v, err = Run(r); err != nil { - t.Fatal(err) - } - if got := v.Cases[0].Manifests["xterm"]; got.Accepted || - !strings.Contains(got.Refused, "the indexer's judge (src2:j) refused the manifest of xterm: falls back to a key not listed") { - t.Fatalf("xterm refused by its verdict: %+v, want refused in the verdict's words", got) - } - // The verdict as the trunk's checker hands it, version 0 and no judge (group try 1793952957648659842 failed on all - // four nodes: "the verdict of f1-circuits is not one: ... the value is version 0"), holds the module too; a later - // version is refused. - r.Cases[0].Verdicts = map[string]json.RawMessage{"xterm": json.RawMessage(`{"v":0,"module":"xterm","state":"refused","problems":["falls back to a key not listed"],"judge":"","at":"0001-01-01T00:00:00Z"}`)} - if v, err = Run(r); err != nil { - t.Fatalf("a version-0 verdict of the trunk's checker: %v", err) - } - if got := v.Cases[0].Manifests["xterm"]; got.Accepted || !strings.Contains(got.Refused, "refused the manifest of xterm: falls back") { - t.Fatalf("xterm refused by a version-0 verdict: %+v, want refused", got) - } - r.Cases[0].Verdicts["xterm"] = json.RawMessage(`{"v":2,"module":"xterm","state":"refused","problems":["p"]}`) - if _, err = Run(r); !errors.Is(err, keys.ErrUnknownVersion) { - t.Fatalf("a version-2 verdict: %v, want keys.ErrUnknownVersion", err) - } } diff --git a/internal/selfcompose/candidate.go b/internal/selfcompose/candidate.go index e6ec25cf..34411a5c 100644 --- a/internal/selfcompose/candidate.go +++ b/internal/selfcompose/candidate.go @@ -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() diff --git a/internal/selfcompose/candidate_test.go b/internal/selfcompose/candidate_test.go index 84bde8f3..0216f65b 100644 --- a/internal/selfcompose/candidate_test.go +++ b/internal/selfcompose/candidate_test.go @@ -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) diff --git a/internal/selfcompose/selfcompose.go b/internal/selfcompose/selfcompose.go index 49baf31b..f369f793 100644 --- a/internal/selfcompose/selfcompose.go +++ b/internal/selfcompose/selfcompose.go @@ -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 } diff --git a/internal/selfcompose/selfcompose_test.go b/internal/selfcompose/selfcompose_test.go index 8ae5dc5d..0a924f67 100644 --- a/internal/selfcompose/selfcompose_test.go +++ b/internal/selfcompose/selfcompose_test.go @@ -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 diff --git a/internal/selfcompose/testdata/power-ca8d6f33.module.json b/internal/selfcompose/testdata/power-ca8d6f33.module.json deleted file mode 100644 index c43e601c..00000000 --- a/internal/selfcompose/testdata/power-ca8d6f33.module.json +++ /dev/null @@ -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" - } - ] -}