Carry mesh package versions in build asks and fingerprints

ADR 0573 §2 has every module build against the latest published version of
each mesh package it uses, chosen by the planner and written by the build,
never pinned by hand (issue 1585, S4). The ask, the fetch request and the
merge preview now carry the packages and their versions, and the new-form
fingerprint takes each version, so a package's trunk merge changes every
dependent's fingerprint. A module using no package keeps its fingerprint.

Claude-Session: https://claude.ai/code/session_01NcbgfJ9Gum47zkFKWRaovL
This commit is contained in:
2026-11-01 01:57:26 +01:00
parent ff5e00f1f8
commit af4e4e60a3
14 changed files with 356 additions and 22 deletions
+32
View File
@@ -1,6 +1,7 @@
package delivery
import (
"reflect"
"strings"
"testing"
)
@@ -163,4 +164,35 @@ func TestModuleKeepsInputs2(t *testing.T) {
if _, err := EncodeModule(m); err == nil {
t.Error("Inputs2 without a manifest digest was encoded")
}
// Issue 1585 (ADR 0573 §2): the mesh packages a go.sum names, those of other repositories, and the latest published
// version of each: the trunk commit of the deepest module of its repository whose directory holds it.
sum := "git.novox.be/novox/mesh-sdk/go v0.1.7 h1:a=\ngit.novox.be/novox/mesh-sdk/go v0.1.7/go.mod h1:b=\n" +
"git.novox.be/novox/mesh-controller/modules/route-proxy/contract v0.1.0 h1:c=\n" +
"github.com/nats-io/nats.go v1.0.0 h1:d=\ngit.novox.be/novox/mesh-host v0.0.0-1 h1:e=\n"
pkgs := MeshPackagesOf([]byte(sum))
if want := []string{"git.novox.be/novox/mesh-controller/modules/route-proxy/contract", "git.novox.be/novox/mesh-host", "git.novox.be/novox/mesh-sdk/go"}; !reflect.DeepEqual(pkgs, want) {
t.Errorf("the packages of a go.sum: %v, want %v", pkgs, want)
}
if got := OtherPackages(pkgs, "novox/mesh-controller"); len(got) != 2 || got[0] != "git.novox.be/novox/mesh-host" {
t.Errorf("the packages of other repositories: %v", got)
}
held := map[string]Module{
"mesh-sdk": {Repository: "novox/mesh-sdk", Path: RootPath, Commit: "c-sdk"},
"route-proxy": {Repository: "novox/mesh-controller", Path: "modules/route-proxy", Commit: "c-rp"},
"controller": {Repository: "novox/mesh-controller", Path: RootPath, Commit: "c-ctl"},
"route-proxy2": {Repository: "novox/mesh-controller", Path: "modules/route", Commit: "c-wrong"},
"no-path": {Repository: "novox/mesh-host", Commit: "c-host"},
}
versions, missing := PackageVersionsOf(pkgs, held)
if want := (PackageVersions{"git.novox.be/novox/mesh-sdk/go": "c-sdk", "git.novox.be/novox/mesh-controller/modules/route-proxy/contract": "c-rp"}); !reflect.DeepEqual(versions, want) {
t.Errorf("versions %v, want %v", versions, want)
}
if len(missing) != 1 || missing[0] != "git.novox.be/novox/mesh-host" {
t.Errorf("missing %v: a module that names no directory holds no package", missing)
}
kept.Packages = []string{"git.novox.be/novox/mesh-sdk/go", "git.novox.be/novox/mesh-host"}
if fp, none := SourceFingerprint2(kept.WithPackages("m", tc, versions)); fp != "" || !strings.HasPrefix(none, NoPackageVersion) {
t.Errorf("a package with no version: %q %q", fp, none)
}
}