I4 consumes-on-entry: an entry's consumes equals its manifest's

Builds: design 47 H2 H-A-621
This commit is contained in:
2026-11-25 17:20:45 +01:00
parent 3baef9df5b
commit ca91d4e85b
2 changed files with 9 additions and 1 deletions
@@ -33,7 +33,7 @@ const CatalogEntryLayout = 1
func CatalogEntryOf(module string, cur meshcatalog.ModulesByModuleValue, m catalogue.Manifest, raw string, n graph.Node) meshcatalog.CatalogEntry {
e := meshcatalog.CatalogEntry{V: CatalogEntryLayout, Module: module, Repository: cur.Repository, Path: cur.Path,
Commit: cur.Commit, Manifest: manifestWhole(raw), ManifestDigest: meshcatalogclient.EntryManifestDigest(cur.Manifest), Verdict: cur.Verdict, Fp: n.FP, None: n.None, Bases: n.Bases,
Packages: maps.Clone(cur.Packages), Provides: n.Provides, Requires: n.Requires, Awaits: n.Awaits, Invokes: n.Invokes,
Packages: maps.Clone(cur.Packages), Provides: n.Provides, Requires: n.Requires, Awaits: n.Awaits, Invokes: n.Invokes, Consumes: slices.Clone(m.Consumes),
Serves: n.Serves, LeftOut: n.LeftOut, Main: MainOf(m), Contributes: contributesOf(m), Class: m.Class}
// needs are the reader capabilities the module's value names (design 47 H2, H-A-682 (1)): its manifest's words, forms
// and seat names and its templates' forms, sorted, absent when empty.
@@ -109,6 +109,14 @@ func TestAnEntryNamesWhatItContributesToAndEveryRequirement(t *testing.T) {
if e := CatalogEntryOf("kv", meshcatalog.ModulesByModuleValue{}, catalogue.Manifest{}, "", graph.Node{}); e.Contributes != nil || e.Class != "" {
t.Errorf("an entry of a manifest contributing nothing and naming no class carries contributes %v, class %q", e.Contributes, e.Class)
}
// Design 47 H2 H-A-621: an entry's consumes equals its manifest's, beside its invokes.
cm := catalogue.Manifest{Consumes: []string{"mesh-delivery.merge-called", "mesh-builds.step-ended"}}
if e := CatalogEntryOf("web", meshcatalog.ModulesByModuleValue{}, cm, "", graph.Node{}); !reflect.DeepEqual(e.Consumes, cm.Consumes) {
t.Errorf("consumes = %v, want %v", e.Consumes, cm.Consumes)
}
if e := CatalogEntryOf("web", meshcatalog.ModulesByModuleValue{}, m, raw, graph.Node{}); e.Consumes != nil {
t.Errorf("a manifest consuming nothing gives the entry consumes %v", e.Consumes)
}
// Design 47 H2 H-A-682 (1): a module whose value names needs carries them sorted on its entry, and the value read back
// from the entry names them; a value with none leaves the entry's needs absent.
needs := []string{"seat:node-engine", "form:dir", "word:runs-as"}