diff --git a/modules/mesh-delivery-indexer/internal/index/catalog_graph.go b/modules/mesh-delivery-indexer/internal/index/catalog_graph.go index 203b39ce3..dd51ae937 100644 --- a/modules/mesh-delivery-indexer/internal/index/catalog_graph.go +++ b/modules/mesh-delivery-indexer/internal/index/catalog_graph.go @@ -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. diff --git a/modules/mesh-delivery-indexer/internal/index/catalog_graph_test.go b/modules/mesh-delivery-indexer/internal/index/catalog_graph_test.go index f54f70885..3f9ab847c 100644 --- a/modules/mesh-delivery-indexer/internal/index/catalog_graph_test.go +++ b/modules/mesh-delivery-indexer/internal/index/catalog_graph_test.go @@ -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"}