diff --git a/modules/mesh-delivery-assigner/manifest_test.go b/modules/mesh-delivery-assigner/manifest_test.go index 16bf094b..8a3db0c2 100644 --- a/modules/mesh-delivery-assigner/manifest_test.go +++ b/modules/mesh-delivery-assigner/manifest_test.go @@ -119,6 +119,13 @@ func TestManifest(t *testing.T) { } } } + // H-A-186 (design 47 G §370): asks, which the gate, the teller and the view import, is a declared Go package of the + // module, so every release publishes it; H-A-188: in the module's version series, 0.3. + if !slices.ContainsFunc(m.Build.Artifacts, func(a catalogue.Artifact) bool { + return a.Name == "asks" && a.Kind == catalogue.ArtifactPackage && a.Language == "go" && slices.Equal(a.Paths, []string{"asks"}) && a.Series == m.Version && m.Version == "0.3" + }) { + t.Errorf("artifacts = %+v, want the Go package asks of series 0.3, the module's", m.Build.Artifacts) + } // ADR 0635 §5: its views family is its ordinary events, `views.` among its emits, on no stream of its own. // The seat's four events are said on the seat's own subject (the seat's family), so the module keeps no stream for them // and lists none among its emits. diff --git a/modules/mesh-delivery-assigner/module.json b/modules/mesh-delivery-assigner/module.json index 5dfdd07d..32979138 100644 --- a/modules/mesh-delivery-assigner/module.json +++ b/modules/mesh-delivery-assigner/module.json @@ -370,6 +370,15 @@ "loads": [ "mesh-delivery-assigner" ] + }, + { + "name": "asks", + "kind": "package", + "language": "go", + "paths": [ + "asks" + ], + "series": "0.3" } ] } diff --git a/modules/mesh-delivery-builder/manifest_test.go b/modules/mesh-delivery-builder/manifest_test.go index f39d8693..cdec75a2 100644 --- a/modules/mesh-delivery-builder/manifest_test.go +++ b/modules/mesh-delivery-builder/manifest_test.go @@ -266,10 +266,16 @@ func TestManifestProcess(t *testing.T) { // 1607/AC1 if _, bus := p["bus"]; bus { t.Errorf("the process declares a bus: it runs on its own broker credential") } - // Issue 1966's bootstrap: the package artifact builds is out of the manifest until the new builder runs; the follow-up - // puts it back with its assertion (ADR 0634 §1, ADR 0606 §4: three artifacts, the third the package builds). - if len(m.Build.Artifacts) != 2 { - t.Fatalf("artifacts = %+v, want the program and the tools", m.Build.Artifacts) + // H-A-186, design 47 G §370: a Go package another module imports is a declared package artifact of its module, so every + // release publishes it: builds (ADR 0634 §1, ADR 0606 §4), imported by the build modules and the node-engine, and + // buildrun, imported by the indexer, the view and the watchman. + if len(m.Build.Artifacts) != 4 { + t.Fatalf("artifacts = %+v, want the program, the tools and the packages builds and buildrun", m.Build.Artifacts) + } + for i, name := range []string{"builds", "buildrun"} { + if a := m.Build.Artifacts[2+i]; a.Name != name || a.Kind != "package" || a.Language != "go" || !reflect.DeepEqual(a.Paths, []string{name}) || a.Series != "0.1" { + t.Errorf("package artifact = %+v, want the Go package %s of series 0.1", a, name) + } } if a := m.Build.Artifacts[1]; a.Name != "tools" || a.Kind != "bundle" || a.Binary != "mesh-delivery-builder-tools" || !reflect.DeepEqual(a.Loads, []string{"mesh-delivery-builder-tools"}) { t.Errorf("tools artifact = %+v", a) // 1945 diff --git a/modules/mesh-delivery-builder/module.json b/modules/mesh-delivery-builder/module.json index 144223d5..7419cf8d 100644 --- a/modules/mesh-delivery-builder/module.json +++ b/modules/mesh-delivery-builder/module.json @@ -334,6 +334,24 @@ "loads": [ "mesh-delivery-builder-tools" ] + }, + { + "name": "builds", + "kind": "package", + "language": "go", + "paths": [ + "builds" + ], + "series": "0.1" + }, + { + "name": "buildrun", + "kind": "package", + "language": "go", + "paths": [ + "buildrun" + ], + "series": "0.1" } ] } diff --git a/modules/mesh-delivery-forge-bridge/manifest_test.go b/modules/mesh-delivery-forge-bridge/manifest_test.go index fe97eebb..3c81cb8d 100644 --- a/modules/mesh-delivery-forge-bridge/manifest_test.go +++ b/modules/mesh-delivery-forge-bridge/manifest_test.go @@ -187,10 +187,13 @@ func TestManifestProcess(t *testing.T) { // 1235/AC1 if _, bus := p["bus"]; bus { t.Errorf("the process declares a bus: it runs on its own broker credential") } - // Issue 1966's bootstrap: the package artifact forgemsg is out of the manifest until the new builder runs; the follow-up - // puts it back with its assertion (ADR 0573 §1: three artifacts, the third the package forgemsg). - if len(m.Build.Artifacts) != 2 || m.Build.Artifacts[1].Name != "tools" || m.Build.Artifacts[1].From != "cmd/mesh-delivery-forge-bridge-tools" { - t.Fatalf("artifacts = %+v, want the program and the tools bundle", m.Build.Artifacts) + if len(m.Build.Artifacts) != 3 || m.Build.Artifacts[1].Name != "tools" || m.Build.Artifacts[1].From != "cmd/mesh-delivery-forge-bridge-tools" { + t.Fatalf("artifacts = %+v, want the program, the tools bundle and the package forgemsg", m.Build.Artifacts) + } + // ADR 0573 §1, H-A-186 (design 47 G §370): the gate, the builder and the indexer import forgemsg, so the module declares + // it as a package and every release publishes it. + if a := m.Build.Artifacts[2]; a.Name != "forgemsg" || a.Kind != "package" || a.Language != "go" || len(a.Paths) != 1 || a.Paths[0] != "forgemsg" || a.Series != "0.1" { + t.Errorf("package artifact = %+v", a) } a := m.Build.Artifacts[0] if st, err := os.Stat(a.From); err != nil || !st.IsDir() || a.Binary != "mesh-delivery-forge-bridge" || !strings.HasSuffix(a.From, a.Binary) { diff --git a/modules/mesh-delivery-forge-bridge/module.json b/modules/mesh-delivery-forge-bridge/module.json index 3e185e86..2cdf59b7 100644 --- a/modules/mesh-delivery-forge-bridge/module.json +++ b/modules/mesh-delivery-forge-bridge/module.json @@ -101,6 +101,15 @@ "loads": [ "mesh-delivery-forge-bridge-tools" ] + }, + { + "name": "forgemsg", + "kind": "package", + "language": "go", + "paths": [ + "forgemsg" + ], + "series": "0.1" } ] } diff --git a/modules/mesh-delivery-indexer/manifest_test.go b/modules/mesh-delivery-indexer/manifest_test.go index d1a5703a..8a24e6af 100644 --- a/modules/mesh-delivery-indexer/manifest_test.go +++ b/modules/mesh-delivery-indexer/manifest_test.go @@ -42,6 +42,8 @@ type artifact struct { Binary string `json:"binary"` Loads []string `json:"loads"` Env map[string]string `json:"env"` + Paths []string `json:"paths"` + Series string `json:"series"` } type stream struct { @@ -344,8 +346,12 @@ func TestManifestProcess(t *testing.T) { // 1238/AC1 if _, bus := p["bus"]; bus { t.Errorf("the process declares a bus: it runs on its own broker credential") } - if len(m.Build.Artifacts) != 2 { - t.Fatalf("artifacts = %+v, want the program and the tools", m.Build.Artifacts) + if len(m.Build.Artifacts) != 3 { + t.Fatalf("artifacts = %+v, want the program, the tools and the package takein", m.Build.Artifacts) + } + // H-A-186 (design 47 G §370): takein, which the gate, the view and the watchman import, is a declared package. + if a := m.Build.Artifacts[2]; a.Name != "takein" || a.Kind != "package" || a.Language != "go" || !reflect.DeepEqual(a.Paths, []string{"takein"}) || a.Series != "0.1" { + t.Errorf("package artifact = %+v", a) } if a := m.Build.Artifacts[1]; a.Name != "tools" || a.Kind != "bundle" || a.Binary != "mesh-delivery-indexer-tools" || !reflect.DeepEqual(a.Loads, []string{"mesh-delivery-indexer-tools"}) { t.Errorf("tools artifact = %+v", a) // 1945 diff --git a/modules/mesh-delivery-indexer/module.json b/modules/mesh-delivery-indexer/module.json index 5300ac2c..0eeaa80c 100644 --- a/modules/mesh-delivery-indexer/module.json +++ b/modules/mesh-delivery-indexer/module.json @@ -223,6 +223,15 @@ "loads": [ "mesh-delivery-indexer-tools" ] + }, + { + "name": "takein", + "kind": "package", + "language": "go", + "paths": [ + "takein" + ], + "series": "0.1" } ] } diff --git a/modules/mesh-delivery-teller/manifest_test.go b/modules/mesh-delivery-teller/manifest_test.go index 47fa14f5..dcb8d85b 100644 --- a/modules/mesh-delivery-teller/manifest_test.go +++ b/modules/mesh-delivery-teller/manifest_test.go @@ -38,9 +38,12 @@ type artifact struct { From string `json:"from"` Binary string `json:"binary"` Loads []string `json:"loads"` + Paths []string `json:"paths"` + Series string `json:"series"` } type manifest struct { + Packages map[string]string `json:"packages"` Module string `json:"module"` Version string `json:"version"` Slug string `json:"slug"` @@ -176,8 +179,16 @@ func TestManifestProcess(t *testing.T) { // 1240/AC1 if _, bus := p["bus"]; bus { t.Errorf("the process declares a bus: it runs on its own broker credential") } - if len(m.Build.Artifacts) != 2 { - t.Fatalf("artifacts = %+v, want the program and the tools", m.Build.Artifacts) + if len(m.Build.Artifacts) != 3 { + t.Fatalf("artifacts = %+v, want the program, the tools and the package tellerevents", m.Build.Artifacts) + } + // H-A-188: the assigner is at 0.3, so its package asks, which this module imports, is accepted in that series. + if got := m.Packages["git.novox.be/novox/mesh-delivery/modules/mesh-delivery-assigner/asks"]; got != "0.3" || len(m.Packages) != 1 { + t.Errorf("packages = %v, want asks accepted in the assigner's series 0.3", m.Packages) + } + // H-A-186 (design 47 G §370): tellerevents, which the assigner imports, is a declared package. + if a := m.Build.Artifacts[2]; a.Name != "tellerevents" || a.Kind != "package" || a.Language != "go" || !reflect.DeepEqual(a.Paths, []string{"tellerevents"}) || a.Series != "0.1" { + t.Errorf("package artifact = %+v", a) } a := m.Build.Artifacts[0] if st, err := os.Stat(a.From); err != nil || !st.IsDir() || a.Binary != "mesh-delivery-teller" || !strings.HasSuffix(a.From, a.Binary) { diff --git a/modules/mesh-delivery-teller/module.json b/modules/mesh-delivery-teller/module.json index ab2c2678..b993a061 100644 --- a/modules/mesh-delivery-teller/module.json +++ b/modules/mesh-delivery-teller/module.json @@ -1,6 +1,9 @@ { "module": "mesh-delivery-teller", "version": "0.1", + "packages": { + "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-assigner/asks": "0.3" + }, "slug": "teller", "tools": [ "teller_end_ask", @@ -123,6 +126,15 @@ "loads": [ "mesh-delivery-teller-tools" ] + }, + { + "name": "tellerevents", + "kind": "package", + "language": "go", + "paths": [ + "tellerevents" + ], + "series": "0.1" } ] }, diff --git a/modules/mesh-delivery-view/manifest_test.go b/modules/mesh-delivery-view/manifest_test.go index cacee9e3..e473d9a0 100644 --- a/modules/mesh-delivery-view/manifest_test.go +++ b/modules/mesh-delivery-view/manifest_test.go @@ -70,6 +70,7 @@ type claim struct { } type manifest struct { + Packages map[string]string `json:"packages"` Claims []claim `json:"claims"` State []state `json:"state"` Module string `json:"module"` @@ -313,9 +314,12 @@ func TestManifestIsTakenAndReadsOnly(t *testing.T) { // 1134/AC7 func TestManifestIsWholeInItsRepository(t *testing.T) { // 1134/AC7 m, _ := load(t) - // Issue 1966's bootstrap: the package artifact viewstate is out of the manifest until the new builder runs; the - // follow-up puts the count back at 5. - if len(m.Build.Artifacts) != 4 { + // H-A-188: the assigner is at 0.3, so its package asks, which this module imports, is accepted in that series. + if got := m.Packages["git.novox.be/novox/mesh-delivery/modules/mesh-delivery-assigner/asks"]; got != "0.3" || len(m.Packages) != 1 { + t.Errorf("packages = %v, want asks accepted in the assigner's series 0.3", m.Packages) + } + // H-A-186 (design 47 G §370): viewstate, which the gate, the assigner and the teller import, is a declared package. + if len(m.Build.Artifacts) != 5 || m.Build.Artifacts[4].Name != "viewstate" { t.Fatalf("artifacts = %+v", m.Build.Artifacts) } for _, a := range m.Build.Artifacts { diff --git a/modules/mesh-delivery-view/module.json b/modules/mesh-delivery-view/module.json index 03b6a334..b2deb116 100644 --- a/modules/mesh-delivery-view/module.json +++ b/modules/mesh-delivery-view/module.json @@ -1,6 +1,9 @@ { "module": "mesh-delivery-view", "version": "0.1", + "packages": { + "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-assigner/asks": "0.3" + }, "moved": true, "slug": "view", "tools": [ @@ -234,6 +237,15 @@ "name": "files", "kind": "archive", "from": "files" + }, + { + "name": "viewstate", + "kind": "package", + "language": "go", + "paths": [ + "viewstate" + ], + "series": "0.1" } ] }, diff --git a/modules/mesh-grants/grants_test.go b/modules/mesh-grants/grants_test.go index 68aa6546..b4cbb5f4 100644 --- a/modules/mesh-grants/grants_test.go +++ b/modules/mesh-grants/grants_test.go @@ -648,6 +648,17 @@ func TestGrants(t *testing.T) { if _, ok := m.OwnSecrets["broker"]; !ok || len(m.OwnSecrets) != 1 || m.SecretsOwner != "mesh-grants" { t.Errorf("own-secrets %v owner %q: a credential of its own, broker", m.OwnSecrets, m.SecretsOwner) } + // H-A-186 (design 47 G §370): grantsstate (imported by the assigner, the vault and the node-engine) and busgrants + // (imported by the bus module and the watchman) are declared Go packages of the module, so every release publishes them. + var packages []string + for _, a := range m.Build.Artifacts { + if a.Kind == catalogue.ArtifactPackage && a.Language == "go" && len(a.Paths) == 1 && a.Paths[0] == a.Name && a.Series == "0.1" { + packages = append(packages, a.Name) + } + } + if !slices.Equal(packages, []string{"grantsstate", "busgrants"}) { + t.Errorf("Go packages %v, want grantsstate and busgrants of series 0.1", packages) + } }) t.Run("no timer, no update or delete, a publish only of conditions, a create only of declared streams", func(t *testing.T) { diff --git a/modules/mesh-grants/module.json b/modules/mesh-grants/module.json index 006e07cf..29c8489b 100644 --- a/modules/mesh-grants/module.json +++ b/modules/mesh-grants/module.json @@ -185,6 +185,24 @@ "loads": [ "mesh-grants" ] + }, + { + "name": "grantsstate", + "kind": "package", + "language": "go", + "paths": [ + "grantsstate" + ], + "series": "0.1" + }, + { + "name": "busgrants", + "kind": "package", + "language": "go", + "paths": [ + "busgrants" + ], + "series": "0.1" } ] }