The builder adopts meshcatalogclient's branch follower on its views reader (A-5, A-15): the modules, their manifests (kept from the entry that holds them, by its digest), their packages and each package's name in its ecosystem are read from the catalog half's entries, never the indexer's modules, manifests, candidates and packages views; an entry of a branch other than the module's first builds its fingerprint and supersedes only its own branch's older one; the start's sweep runs once every followed half's first view is in; the builder's tools bundle reads package names through the same follower. A run's candidate is no input of the builder (A-84): its read of the indexer's candidates view goes, and the entry point for a run's build ask is not built (no line gives the ask's form). The seats' events the builder's own handler takes are named per seat so the follower's events have one taker. Builds: design 47 G §348, §479, §614, A-5, A-15, A-84 Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
29 lines
1.5 KiB
Go
29 lines
1.5 KiB
Go
package build
|
|
|
|
import (
|
|
"reflect"
|
|
"testing"
|
|
|
|
"git.novox.be/novox/mesh-delivery/contracts/go/seats/meshcatalog"
|
|
)
|
|
|
|
// TestAnEntryOfTheCatalogHalfIsTheFormTheBuilderBuildsBy: a catalog graph entry gives the builder its fingerprint, manifest digest,
|
|
// source, the toolchains its fingerprint was computed with, its bases, packages, needs and the named paths of its artifacts by path
|
|
// (design 47 G §348, §614).
|
|
func TestAnEntryOfTheCatalogHalfIsTheFormTheBuilderBuildsBy(t *testing.T) {
|
|
e := meshcatalog.CatalogEntry{Module: "netcheck", Repository: "novox/mesh-catalog", Path: "modules/netcheck", Commit: "abc", Fp: "src2:f",
|
|
ManifestDigest: "sha256:m", Bases: []string{"base"}, Packages: map[string]string{"p": "1"}, Needs: []string{"n"},
|
|
Inputs: &meshcatalog.EntryInputs{Src: 7, Toolchains: map[string]meshcatalog.ToolchainUsed{"go": {Version: "go1", Recipe: "1"}},
|
|
Paths: map[string][]string{"lib": {"a/b", "c"}}}}
|
|
got := ModuleOf(e)
|
|
if got.Fp2 != "src2:f" || got.Manifest != "sha256:m" || got.Path != "modules/netcheck" || got.Commit != "abc" || got.Src != 7 ||
|
|
got.Toolchains["go"].Version != "go1" || got.Packages["p"] != "1" || !reflect.DeepEqual(got.Needs, []string{"n"}) ||
|
|
got.Inputs2 == nil || !reflect.DeepEqual(got.Inputs2.Bases, []string{"base"}) ||
|
|
!reflect.DeepEqual(got.Inputs2.Paths, map[string]string{"a/b": "lib", "c": "lib"}) {
|
|
t.Errorf("ModuleOf = %+v", got)
|
|
}
|
|
if bare := ModuleOf(meshcatalog.CatalogEntry{Module: "m"}); bare.Inputs2 != nil || bare.Fp2 != "" {
|
|
t.Errorf("ModuleOf of an entry with none = %+v, want nothing set", bare)
|
|
}
|
|
}
|