diff --git a/modules/mesh-delivery-builder/cmd/mesh-delivery-builder/integration_test.go b/modules/mesh-delivery-builder/cmd/mesh-delivery-builder/integration_test.go index 58afc2be..62cb557d 100644 --- a/modules/mesh-delivery-builder/cmd/mesh-delivery-builder/integration_test.go +++ b/modules/mesh-delivery-builder/cmd/mesh-delivery-builder/integration_test.go @@ -522,9 +522,9 @@ func isState(state string) func(builds.BuilderBuild) bool { // the digests of both bundles, both build modules' toolchains, after a fetch and a build on one node (ADR 0478 clause 4). func TestBuilderMakesADoneKeyWithTheDigests(t *testing.T) { // 1607/AC7 b := startBed(t) - // DLV-B10 (design 51, round 2): the builder's versions, findings and the floor's three sources are on the bus; the seat - // answers 0.1.4, so netcheck's bundles are numbered from 0.1.5. Two merges close together, the first replaced before - // its claim: the second is numbered at once, and the first never. + // The builder's versions, findings and the floor's three sources are on the bus, the seat answering 0.1.4; two merges close + // together, the first replaced before its claim. The builder numbers neither in its state versions (design 47 H H-A-159, + // G §348, §369): the reservation is the one place a version is numbered. reg := b.registry(t, "n1", "0.1.4") const netcheck = "catalogue-a67f0196-netcheck.module.json" first := "src2:" + strings.Repeat("1", 64) @@ -534,8 +534,8 @@ func TestBuilderMakesADoneKeyWithTheDigests(t *testing.T) { // 1607/AC7 v := b.await(t, "netcheck", isState(builds.BuildDone)) for _, a := range []string{"tools-go", "tools-typescript"} { es := reg.of(t, "netcheck/"+a) - if len(es) != 1 || es[0].Version != "0.1.5" || es[0].Fingerprint != fp || es[0].State != versions.Numbered || es[0].Digest != digestOf(a) { - t.Errorf("versions of netcheck/%s = %+v, want the second merge numbered 0.1.5 at once with its digest, the first never", a, es) + if len(es) != 0 { + t.Errorf("versions of netcheck/%s = %+v, want none: the builder numbers nothing of its own (H-A-159)", a, es) } } if v.By != "n1.mesh-delivery-builder" || v.Manifest != digest || len(v.Artifacts) != 2 { @@ -565,13 +565,13 @@ func TestBuilderMakesADoneKeyWithTheDigests(t *testing.T) { // 1607/AC7 } // 1955/L7 (ADR 0571 §1): the build's start and end are in the module log build-log under the module's key, read as a // reader with the log's read reads them, the end naming the manifest and what was made. - // DLV-B10: between them the build log holds the build's narrations (build.said), each version numbered, and why. + // H-A-159: no version is numbered of the builder's own, so the build log holds no narration of one (build.said). var ended []builds.BuildLogEntry for _, e := range b.logged(t, "netcheck") { if e.Event != builds.BuildSaidEvent { ended = append(ended, e) - } else if e.Why != versions.SaidNumbered || !strings.Contains(e.Line, "numbered 0.1.5") || e.FP != fp { - t.Errorf("said = %+v, want netcheck's versions numbered", e) + } else if e.Why == versions.SaidNumbered || e.Why == versions.SaidKept { + t.Errorf("said = %+v, want no version of the builder's own numbered (H-A-159)", e) } } if len(ended) != 2 || ended[0].Event != builds.BuildStartedEvent || ended[1].Event != builds.BuildEndedEvent || @@ -596,7 +596,7 @@ func TestBuilderMakesADoneKeyWithTheDigests(t *testing.T) { // 1607/AC7 } } // Design 32, design 47 G §348: a package's name the catalog half's entry of the module gives later reaches the builder by the - // branch follower's view (never the indexer's state), and looks at the module again; the done bundles are kept, not numbered twice. + // branch follower's view (never the indexer's state), and looks at the module again. named := b.entry("netcheck", "modules/netcheck", commit, fp, digest, nil, bothToolchains, 0) named.Manifest = b.manifestOf(t, "catalogue-a67f0196-netcheck.module.json") named.Artifacts = []meshcatalog.Artifact{{Ref: "netcheck:lib", Language: "go", Package: &meshcatalog.ArtifactPackage{Ecosystem: "go", Name: "netcheck"}}} @@ -606,11 +606,12 @@ func TestBuilderMakesADoneKeyWithTheDigests(t *testing.T) { // 1607/AC7 if got := reg.numberedOf("netcheck/tools-go"); len(got) != 0 { t.Errorf("version.numbered of netcheck/tools-go said %v, want none", got) } - for _, a := range []string{"tools-go", "tools-typescript"} { - reg.published(t, "netcheck/"+a, "0.1.5", digestOf(a)) + // Versions numbered before G, which the state keeps until G §372 removes it: one a holder removes below, one it refuses. + kept, _ := json.Marshal(versions.Entry{Name: "netcheck/tools-typescript", Kind: versions.KindBundle, Series: "0.1", Version: "0.1.5", Module: "netcheck", + Fingerprint: fp, Digest: digestOf("tools-typescript"), Seat: ociartifactregistry.Seat, State: versions.Published, At: time.Now().UTC()}) + if _, err := reg.versions.Put(b.ctx, versions.Key("netcheck/tools-typescript", "0.1.5"), kept); err != nil { + t.Fatal(err) } - reg.awaitOf(t, "netcheck/tools-go", func(es []versions.Entry) bool { return len(es) == 1 && es[0].State == versions.Published }) - // A numbered version a holder will refuse below, written to the state as the builder numbers one. refusable, _ := json.Marshal(versions.Entry{Name: "netcheck/tools-go", Kind: versions.KindBundle, Series: "0.1", Version: "0.1.6", Module: "netcheck", Fingerprint: "src2:" + strings.Repeat("6", 64), Seat: ociartifactregistry.Seat, State: versions.Numbered, At: time.Now().UTC()}) if _, err := reg.versions.Put(b.ctx, versions.Key("netcheck/tools-go", "0.1.6"), refusable); err != nil { @@ -643,7 +644,7 @@ func TestBuilderMakesADoneKeyWithTheDigests(t *testing.T) { // 1607/AC7 t.Errorf("version.numbered of netcheck/tools-go said %v, want none", got) } // DLV-B10: a build module's bound running out fails the trunk build, which is the builder's finding build-failed; the - // fingerprint built again keeps its number, said with why, and its done build clears the finding. + // fingerprint built again clears it with its done build, numbering nothing of the builder's own (H-A-159). release := make(chan struct{}) b.fake.hang.Store(&release) third := "src2:" + strings.Repeat("4", 64) @@ -666,12 +667,6 @@ func TestBuilderMakesADoneKeyWithTheDigests(t *testing.T) { // 1607/AC7 close(release) b.moduleFP(t, "netcheck", netcheck, "modules/netcheck", bothToolchains, "89abcdef0123456789abcdef0123456789abcdef", third, 3) // the entry moves to a later commit, same fingerprint b.awaitFP(t, "netcheck", third, isState(builds.BuildDone)) - b.awaitSaid(t, "kept: fingerprint "+third+" is numbered under it") - if !slices.ContainsFunc(b.logged(t, "netcheck"), func(e builds.BuildLogEntry) bool { - return e.Event == builds.BuildSaidEvent && e.Why == versions.SaidKept && e.FP == third && strings.Contains(e.Line, "kept: fingerprint "+third) - }) { - t.Errorf("the build log of netcheck says no version kept at %s", third) - } reg.awaitFinding(t, failed, false) // DLV-B4: the seats' refused and removed, heard on the builder's durable consumer, move a numbered version: a retention // removal turns the entry removed with its reason, a refusal refused with the holder's reason and the bytes it refused. diff --git a/modules/mesh-delivery-builder/cmd/mesh-delivery-builder/main.go b/modules/mesh-delivery-builder/cmd/mesh-delivery-builder/main.go index 1435795a..b706c365 100644 --- a/modules/mesh-delivery-builder/cmd/mesh-delivery-builder/main.go +++ b/modules/mesh-delivery-builder/cmd/mesh-delivery-builder/main.go @@ -205,7 +205,9 @@ func run(ctx context.Context, getenv func(string) string, logOut io.Writer) erro unput := &unputs{bounds: pubBoundsKV.KV, store: b.Claimer.Store, looking: b.Looking, findings: found, bound: meshconditionsclient.CallUnansweredAfter, now: time.Now, logf: logger.Printf} b.Left, b.Ended = unput.left, unput.ended - b.Numbers = build.VersionNumbers{N: numberer} + // The builder numbers nothing of its own (design 47 H H-A-159, G §348, §349, §369): b.Numbers stays nil, so no trunk build + // is numbered in the state versions, waits on a floor or arms a publish-unanswered bound of it; the reservation is the one + // place a version is numbered. The state, kept from before G, is still read (builder_versions) until G §372 removes it. // The builder's toolchain waits (design 47 G §672): its state waits, and wait-held and wait-ended on its stream waits; its // bound is its setting toolchain-wait-minutes. waitBound, err := toolchainWaitOf(getenv("MESH_BUILDER_TOOLCHAIN_WAIT_FILE"))