Compare commits

..
Author SHA1 Message Date
mesh-tools e4781edcd6 Merge pull request 'Design 47 H1: the Go packages other modules import are declared artifacts of their modules (H-A-186, H-A-188)' (#290) from fix/47-H1-declare-package-artifacts into main 2026-11-20 20:08:40 +00:00
jschoubben 1db38fcc72 Declare asks in the assigner's version series, and have the teller and the view accept it there (H-A-188)
The builder numbers every artifact of a release in its module's version, so the assigner's package asks is
published in 0.3, not the 0.1 eba4309b declared: asks now names series 0.3, and the teller and the view, which
import it, accept it at 0.3 in their manifests' packages. The other eight packages' modules are all at 0.1, so
their series stand. The gate in mesh-catalog, which imports asks too, follows with the catalog's next change.

Builds: design 47 G §370, H-A-186, H-A-188
2026-11-20 21:05:39 +01:00
jschoubben eba4309b19 Declare every Go package another module imports as a package artifact of its module (H-A-186)
mesh-build-go and other modules import packages of this repository that no manifest declared, so no release
published them and the registry holds no version: their importers stay unpinned and fail past the bound. Each
module now declares its imported packages in the form they had before issue 1966's bootstrap took them out:
asks (assigner), builds and buildrun (builder), forgemsg (forge bridge), takein (indexer), tellerevents
(teller), viewstate (view), grantsstate and busgrants (grants), each a Go package of series 0.1. Each
module's manifest test asserts its packages again.

Builds: design 47 G §370, H-A-186
2026-11-20 20:58:06 +01:00
mesh-tools a7fc37561e Merge pull request 'Design 47 H1: a pin is the version the registry published for the package path within the module's accepted series (H-A-183, H-A-184, H-A-185)' (#287) from fix/47-H1-pins-by-package-path into main 2026-11-20 19:15:04 +00:00
jschoubben e93575ffe7 mesh-delivery-indexer: the accepted series is the manifest's, contents or none
The pin fell back to the path's newest publish while no series value
held contents, which live none does, so a publish in a series a module
does not accept pinned it. The series a module accepts is the one its
manifest names, or the default; the pin is the newest version published
for the package path within it.

Builds: design 47 H H-A-185, H-A-184
2026-11-20 20:13:15 +01:00
jschoubben 859f88b2f0 mesh-delivery-indexer: a pin stays within the series the module accepts
A pin by the package path across every series moved a module to a
series it does not accept while its contents came from the accepted
one. The pin is the accepted series' newest published version where
that series gives the contents; only where none does yet is it the
newest published of the path. A publish in another series pins nothing
and moves nothing.

Builds: design 47 H H-A-184, H-A-183
2026-11-20 20:07:46 +01:00
jschoubben 517a4b3cf1 mesh-delivery-indexer: a pin is the version the registry published for the package's path
At main.39 every importer of a nested package was pinned to the release
number of the module holding it (v0.1.97 of the builder for its package
builds), and the Go seat found no tag <package dir>/v0.1.97. A Go
package's version is its tag: the pin is now the newest version the
registry published for that package path (the seats' published, kept in
the package's series), never a module's release; a package the
registry never published stays unpinned.

Builds: design 47 H H-A-183, H-A-167, G §370
2026-11-20 20:05:52 +01:00
18 changed files with 214 additions and 72 deletions
@@ -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.<state>` 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.
@@ -370,6 +370,15 @@
"loads": [
"mesh-delivery-assigner"
]
},
{
"name": "asks",
"kind": "package",
"language": "go",
"paths": [
"asks"
],
"series": "0.3"
}
]
}
+10 -4
View File
@@ -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
+18
View File
@@ -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"
}
]
}
@@ -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) {
@@ -101,6 +101,15 @@
"loads": [
"mesh-delivery-forge-bridge-tools"
]
},
{
"name": "forgemsg",
"kind": "package",
"language": "go",
"paths": [
"forgemsg"
],
"series": "0.1"
}
]
}
@@ -123,9 +123,21 @@ func TestImportsReportedMoveTheFingerprintOnlyWithAnImportedPackage(t *testing.T
moved.Fp2, before.Fp2, moved.Inputs2.ImportForm, moved.Packages)
}
// mesh-sdk releases 0.1.20: the import form's fingerprint takes the pin too and moves, once (H-A-172).
// mesh-sdk's module releases 0.1.97 while the registry has published nothing of its Go package: the module's release
// number is never the package's pin (H-A-183), so avahi stays unpinned and where it was.
ix.Versions = newMem()
ix.Versions.(*memStore).put(meshcatalog.VersionsByModuleVersionKey("mesh-sdk", "0.1.20"), []byte(`{}`))
ix.Versions.(*memStore).put(meshcatalog.VersionsByModuleVersionKey("mesh-sdk", "0.1.97"), []byte(`{}`))
if err := ix.Recompute(ctx); err != nil {
t.Fatal(err)
}
if m, _ := moduleOf(t, mods, "avahi"); m.Fp2 != moved.Fp2 || m.Packages[meshSDK] != "" {
t.Fatalf("after mesh-sdk's module release alone: fp2 %q (was %q), versions %v; want it unpinned where it was", m.Fp2, moved.Fp2, m.Packages)
}
// The registry publishes its Go package at 0.1.20, another version than the module's release: the import form's
// fingerprint takes that pin and moves, once (H-A-172, H-A-183).
if _, err := ix.HearVersion(ctx, HeardVersion{Package: "mesh-sdk/go", Seat: "go-package-registry", Version: "0.1.20", Commit: c3, GoModule: meshSDK, Published: true}); err != nil {
t.Fatal(err)
}
for range 2 {
if err := ix.Recompute(ctx); err != nil {
t.Fatal(err)
@@ -283,17 +295,18 @@ func anAcceptedSeriesPinsItsNewest(t *testing.T) {
if pinned.Fp2 == before.Fp2 || pinned.Packages[meshSDK] != "v0.1.15" {
t.Fatalf("after 0.1.15: fp2 %q (was %q), versions %v; want moved by c3's announce, pinned to v0.1.15", pinned.Fp2, before.Fp2, pinned.Packages)
}
// A publish in a series avahi does not accept pins nothing and moves nothing (H-A-184).
if m := step("0.2.0 published from c1", hear("0.2.0", c1)); m.Fp2 != pinned.Fp2 || m.Packages[meshSDK] != "v0.1.15" {
t.Errorf("a publish of a series avahi does not accept moved it: %q %v", m.Fp2, m.Packages)
}
if m := step("trunk at c2", trunk(c2)); m.Fp2 != pinned.Fp2 || m.Packages[meshSDK] != "v0.1.15" {
t.Errorf("a trunk merge moved avahi off its accepted series' newest: %q %v", m.Fp2, m.Packages)
}
// mesh-sdk releases 0.1.20: an accepted series' older version never stands over a newer release (H-A-167).
// mesh-sdk's module releases 0.3.0: a module's release number is never a package's pin (H-A-183).
ix.Versions = newMem()
ix.Versions.(*memStore).put(meshcatalog.VersionsByModuleVersionKey("mesh-sdk", "0.1.20"), []byte(`{}`))
if m := step("0.1.20 released", func() error { return nil }); m.Packages[meshSDK] != "v0.1.20" {
t.Errorf("a newer release left avahi on its series' older version: %v", m.Packages)
ix.Versions.(*memStore).put(meshcatalog.VersionsByModuleVersionKey("mesh-sdk", "0.3.0"), []byte(`{}`))
if m := step("0.3.0 released", func() error { return nil }); m.Packages[meshSDK] != "v0.1.15" {
t.Errorf("a module's release pinned its package: %v", m.Packages)
}
}
@@ -218,8 +218,7 @@ func (ix *Indexer) recomputeLocked(ctx context.Context, overlay map[string]meshc
ix.logf("no fingerprint is written by this pass: %v", err)
return fmt.Errorf("no fingerprint is written: %w", err)
}
series := ix.SeriesAll(ctx) // each package's series, the newest a user accepting it takes (DLV-I6)
released := ix.releasedOf(ctx) // each module's newest released version, what a package is pinned to (H-A-161)
series := ix.SeriesAll(ctx) // each package's series, the newest a user accepting it takes (DLV-I6)
type result struct {
fp, none string
tcs map[string]meshcatalog.ToolchainUsed // by language, when there is a fingerprint
@@ -291,7 +290,7 @@ func (ix *Indexer) recomputeLocked(ctx context.Context, overlay map[string]meshc
r.none = strings.Join(missing, "; ")
case noToolchain != "":
r.none = noToolchain
if fp, pkgs, ok := stillComputed(module, kept, k, toolchains, held, pub, pins, ix.sourceHeads(), released); ok {
if fp, pkgs, ok := stillComputed(module, kept, k, toolchains, held, pub, pins, ix.sourceHeads(), series); ok {
r = result{fp: fp, tcs: k.held.Toolchains, pkgs: pkgs}
}
default:
@@ -299,7 +298,7 @@ func (ix *Indexer) recomputeLocked(ctx context.Context, overlay map[string]meshc
r.fp, r.none = f.fp, f.none
if r.fp != "" {
// a pin is a released version, never a commit (H-A-161), and the version line's fingerprint takes it (H-A-167)
r.fp, r.pkgs = pinnedOf(f, held, released)
r.fp, r.pkgs = pinnedOf(f, series, k.manifest)
r.tcs = toolchainsUsed(toolchains)
}
}
@@ -498,7 +497,7 @@ func hasContext(m catalogue.Manifest) bool {
// with the toolchains it was computed with in place of the languages agreed on none, give it again, in its form. Any
// other input that moved (a merge, a base, an agreed toolchain, an imported package) gives another fingerprint, and the
// module has none until they agree.
func stillComputed(module string, kept meshcatalog.ModulesByModuleValueInputs2, k *known, agreed map[string]meshcatalogclient.Toolchain2, held map[string]meshcatalog.ModulesByModuleValue, published map[string]meshcatalog.PackagesByModuleValue, pins sdkstep.PackageVersions, heads map[string]string, released map[string]string) (string, sdkstep.PackageVersions, bool) {
func stillComputed(module string, kept meshcatalog.ModulesByModuleValueInputs2, k *known, agreed map[string]meshcatalogclient.Toolchain2, held map[string]meshcatalog.ModulesByModuleValue, published map[string]meshcatalog.PackagesByModuleValue, pins sdkstep.PackageVersions, heads map[string]string, series map[string]SeriesPackage) (string, sdkstep.PackageVersions, bool) {
if k.held.Fp2 == "" {
return "", nil, false
}
@@ -518,7 +517,7 @@ func stillComputed(module string, kept meshcatalog.ModulesByModuleValueInputs2,
if f.none != "" || f.fp == "" {
return "", nil, false
}
fp, pkgs := pinnedOf(f, held, released)
fp, pkgs := pinnedOf(f, series, k.manifest)
return fp, pkgs, fp == k.held.Fp2
}
@@ -805,17 +805,34 @@ func TestAModuleKeepsTheToolchainsItsFingerprintWasComputedWith(t *testing.T) {
t.Fatal("a release whose re-pin failed was acknowledged")
}
mods.keysErr = nil
// The registry published mesh-sdk's Go package at 0.1.18, not at the module's release number 0.1.20, in the series
// avahi accepts (the default 0.1), with no contents read: the pin is that version (H-A-183, H-A-185).
ix.Packages = newMem()
if _, err := ix.HearVersion(context.Background(), HeardVersion{Package: "mesh-sdk/go", Seat: "go-package-registry", Version: "0.1.18", Commit: strings.Repeat("1", 40), GoModule: sdk, Published: true}); err != nil {
t.Fatal(err)
}
if err := ix.HearPackagePublished(context.Background(), release); err != nil {
t.Fatal(err)
}
ix.Revisions = revisions
if a, _ := moduleOf(t, mods, "avahi"); a.Fp2 == first.Fp2 || a.Fp2 == "" || !reflect.DeepEqual(a.Packages, map[string]string{sdk: "v0.1.20"}) {
t.Fatalf("after mesh-sdk's release: fp2 %q (was %q) packages %v, want a new fingerprint pinned to v0.1.20", a.Fp2, first.Fp2, a.Packages)
if a, _ := moduleOf(t, mods, "avahi"); a.Fp2 == first.Fp2 || a.Fp2 == "" || !reflect.DeepEqual(a.Packages, map[string]string{sdk: "v0.1.18"}) {
t.Fatalf("after mesh-sdk's release: fp2 %q (was %q) packages %v, want a new fingerprint pinned to v0.1.18", a.Fp2, first.Fp2, a.Packages)
} else {
// A 0.2.0 publish, of a series avahi does not accept, leaves it alone, contents or none (H-A-184, H-A-185).
if _, err := ix.HearVersion(context.Background(), HeardVersion{Package: "mesh-sdk/go", Seat: "go-package-registry", Version: "0.2.0", Commit: strings.Repeat("1", 40), GoModule: sdk, Published: true}); err != nil {
t.Fatal(err)
}
if _, err := ix.Repin(context.Background(), "mesh-sdk"); err != nil { // the pass for avahi alone: mesh-tools is held stale here
t.Fatal(err)
}
if b, _ := moduleOf(t, mods, "avahi"); b.Fp2 != a.Fp2 || b.Packages[sdk] != "v0.1.18" {
t.Fatalf("a publish of another series moved avahi: fp2 %q (was %q) packages %v", b.Fp2, a.Fp2, b.Packages)
}
}
if o, _ := moduleOf(t, mods, "mesh-tools"); o.Fp2 != tools.Fp2 {
t.Errorf("a re-pin moved mesh-tools, which holds no package of mesh-sdk: %q (was %q)", o.Fp2, tools.Fp2)
}
second := sdkMerge(strings.Repeat("2", 40), "tree-sdk-2", "v0.1.20")
second := sdkMerge(strings.Repeat("2", 40), "tree-sdk-2", "v0.1.18")
if second.Fp2 == first.Fp2 {
t.Errorf("a mesh-sdk trunk merge kept avahi's fingerprint %q", first.Fp2)
}
@@ -16,6 +16,7 @@ import (
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshcatalog"
sdkstep "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/buildstep"
stdio "git.novox.be/novox/mesh-sdk/go"
"git.novox.be/novox/mesh-sdk/go/catalogue"
"git.novox.be/novox/mesh-sdk/go/keys"
"mesh-delivery-indexer/internal/fingerprint"
@@ -366,51 +367,28 @@ func isFloor(raw []byte) bool {
return json.Unmarshal(raw, &v) == nil && len(v.Artifacts) == 0
}
// releasedOf is the newest released version of each module the state versions keeps (§349; design 47 H-A-161), by module;
// nil when the indexer keeps no such state or it cannot be listed, said.
func (ix *Indexer) releasedOf(ctx context.Context) map[string]string {
if ix.Versions == nil {
return nil
}
all, err := ix.Versions.Keys(ctx)
if err != nil {
ix.logf("versions: the state cannot be listed, so no package is pinned by this pass: %v", err)
return nil
}
out := map[string]string{}
for _, k := range all {
m, v, ok := meshcatalog.ParseVersionsByModuleVersionKey(k)
if _, parts := versionParts(v); !ok || !parts {
continue
}
if cur, has := out[m]; !has || compareVersions(v, cur) > 0 {
out[m] = v
}
}
return out
}
// releasedPins are a module's pins (its catalog entry's packages, which the builder builds it against) from the versions its
// fingerprint was computed with (design 47 H-A-161, G §370): a package the held module holding it has released is pinned
// to that module's newest released version, as Go names it (v<version>); a version already in that form (an accepted
// series' newest, DLV-I6) stands; any other, a commit, is no pin: its package is kept with no version, so its kind-1 edge
// stands (H §746) and no build is made against a commit. nil for none.
func releasedPins(versions sdkstep.PackageVersions, held map[string]meshcatalog.ModulesByModuleValue, released map[string]string) sdkstep.PackageVersions {
// fingerprint was computed with (design 47 H-A-161, H-A-183, H-A-184, H-A-185, G §370): each package is pinned to the
// newest version the registry published for its path (the seats' published, kept in the package's series by HearVersion)
// within the series the module accepts, the one its manifest m names or the default (Manifest.AcceptedSeries), whether
// or not that series holds contents yet; a publish in another series pins nothing and moves nothing, and a module's
// release number is never a pin. A package with none published in that series is kept with no version, so its kind-1
// edge stands (H §746) and its build waits for the publish (H-A-165). nil for none.
func releasedPins(versions sdkstep.PackageVersions, series map[string]SeriesPackage, m catalogue.Manifest) sdkstep.PackageVersions {
if len(versions) == 0 {
return nil
}
out := sdkstep.PackageVersions{}
for p, v := range versions {
rel := released[moduleOfKey(fingerprint.HolderOf(p, held))]
series := sdkstep.PackageSemver.MatchString(v)
_, plain := versionParts(strings.TrimPrefix(v, "v"))
switch {
case rel != "" && (!series || !plain || compareVersions(rel, strings.TrimPrefix(v, "v")) > 0):
out[p] = "v" + rel // never an older series' version over a newer release (H-A-167)
case series:
out[p] = v
default:
out[p] = ""
for p := range versions {
out[p] = ""
for _, s := range series {
if s.GoModule != p || s.Newest == nil || s.Series != m.AcceptedSeries(s.Name) {
continue
}
v := strings.TrimPrefix(s.Newest.Version, "v")
if _, ok := versionParts(v); ok && (out[p] == "" || compareVersions(v, strings.TrimPrefix(out[p], "v")) > 0) {
out[p] = "v" + v
}
}
}
return out
@@ -420,8 +398,8 @@ func releasedPins(versions sdkstep.PackageVersions, held map[string]meshcatalog.
// form's fingerprint takes them (design 47 H-A-167, H-A-172; ADR 0573 §4) and a re-pin moves it, the module a mover
// built again against the release; a fingerprint with no pin is the form's as it is. The held fingerprint of a build that
// stands is kept while its pins are the ones it was built with, else its import form takes the new pins.
func pinnedOf(f form, held map[string]meshcatalog.ModulesByModuleValue, released map[string]string) (string, sdkstep.PackageVersions) {
pins := releasedPins(f.versions, held, released)
func pinnedOf(f form, series map[string]SeriesPackage, m catalogue.Manifest) (string, sdkstep.PackageVersions) {
pins := releasedPins(f.versions, series, m)
if f.stands {
if maps.Equal(f.built, map[string]string(pins)) {
return f.fp, pins
@@ -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
@@ -223,6 +223,15 @@
"loads": [
"mesh-delivery-indexer-tools"
]
},
{
"name": "takein",
"kind": "package",
"language": "go",
"paths": [
"takein"
],
"series": "0.1"
}
]
}
+13 -2
View File
@@ -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) {
+12
View File
@@ -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"
}
]
},
+7 -3
View File
@@ -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 {
+12
View File
@@ -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"
}
]
},
+11
View File
@@ -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) {
+18
View File
@@ -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"
}
]
}