From 16f9ad295009a011e6c849e764bdff735abc875a Mon Sep 17 00:00:00 2001 From: jochen Date: Fri, 20 Nov 2026 17:23:19 +0100 Subject: [PATCH 1/3] builder: a published of other bytes leaves a kept versions entry as it is MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The reservation's published of nodeengine 0.1.4 (9724da7a) was taken into the state versions' entry 0.1.4, numbered for an older fingerprint, which turned published and kept the old digest c0ef9a3d. Builds: design 47 H H-A-159, G §369, A-415; ADR 0605 §4 --- modules/mesh-delivery-builder/internal/versions/heard.go | 5 +++++ .../internal/versions/versions_test.go | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/modules/mesh-delivery-builder/internal/versions/heard.go b/modules/mesh-delivery-builder/internal/versions/heard.go index 6352849d..12dc34c6 100644 --- a/modules/mesh-delivery-builder/internal/versions/heard.go +++ b/modules/mesh-delivery-builder/internal/versions/heard.go @@ -43,6 +43,11 @@ func (n *Numberer) Heard(ctx context.Context, seat, event, id string, o Outcome) var change func(*Entry) switch event { case HeardPublished: + // A published of other bytes than an entry records under its number is no publish of that entry: the reservation + // numbered it and takes it in (design 47 H H-A-159, G §369, A-415; ADR 0605 §4), and the entry stays as it is. + if e, ok, _, err := n.Versions.Recorded(ctx, o.Name, o.Version, o.Digest); err == nil && !ok && e.Digest != "" && o.Digest != "" && e.Digest != o.Digest { + return wake, fmt.Errorf("%s@%s is recorded with digest %s, so %s's published of %s is %w", o.Name, o.Version, e.Digest, seat, o.Digest, ErrNotNumbered) + } change = func(e *Entry) { e.State, e.Reason = Published, "" if e.Digest == "" { diff --git a/modules/mesh-delivery-builder/internal/versions/versions_test.go b/modules/mesh-delivery-builder/internal/versions/versions_test.go index 6b04ce65..c099156b 100644 --- a/modules/mesh-delivery-builder/internal/versions/versions_test.go +++ b/modules/mesh-delivery-builder/internal/versions/versions_test.go @@ -440,6 +440,13 @@ func TestTheBuildersVersions(t *testing.T) { if wake, _ := n.Heard(ctx, SeatGoPackages, HeardPublished, "e2", Outcome{Name: "m/x", Digest: "sha256:dd"}); !reflect.DeepEqual(wake, []string{"m/lib"}) { t.Fatalf("a published on the Go seat woke %v, want m/lib, whose seat was silent", wake) } + // Design 47 G §369, A-415; ADR 0605 §4: a published of other bytes under the number is the reservation's, never this entry's. + if _, err := n.Heard(ctx, SeatArtifacts, HeardPublished, "e5", Outcome{Name: "m/program", Version: "0.1.14", Digest: "sha256:new"}); !errors.Is(err, ErrNotNumbered) { + t.Fatalf("a published of other bytes under 0.1.14: %v, want ErrNotNumbered", err) + } + if all, _ := n.Versions.Of(ctx, "m/program"); all[0].State != Numbered || all[0].Digest != "sha256:aa" { + t.Fatalf("after a published of other bytes: %+v, want it numbered with sha256:aa", all[0]) + } for _, h := range []struct{ event, state, reason string }{{HeardRefused, Refused, "bytes differ"}, {HeardPublished, Published, ""}, {HeardRefused, Published, ""}, {HeardRemoved, Removed, "retention"}} { if _, err := n.Heard(ctx, SeatArtifacts, h.event, "e3", Outcome{Name: "m/program", Version: "0.1.14", Digest: "sha256:aa", Reason: h.reason}); err != nil { t.Fatal(err) -- 2.54.0 From a47c8e7922c534e5f80844b314178cf1dad53a59 Mon Sep 17 00:00:00 2001 From: jochen Date: Fri, 20 Nov 2026 17:24:48 +0100 Subject: [PATCH 2/3] builder: number nothing of its own; the reservation numbers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Every look numbered one more patch in the state versions (claims carry no source revision since H-A-48): nodeengine 0.1.5 to 0.1.36, beside the reservation's numbers. Builds: design 47 H H-A-159, G §348, §349, §369 --- .../mesh-delivery-builder/integration_test.go | 35 ++++++++----------- .../cmd/mesh-delivery-builder/main.go | 4 ++- 2 files changed, 18 insertions(+), 21 deletions(-) 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")) -- 2.54.0 From d2c9dc7de6c7fbed8a895156a6e8cf271b00491f Mon Sep 17 00:00:00 2001 From: jochen Date: Fri, 20 Nov 2026 17:30:49 +0100 Subject: [PATCH 3/3] builder: builder_floor_again refuses; it asks no floor any more MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With nothing numbered of the builder's own, the tool answered that a floor would be asked at the next claim and looked again, doing nothing. Builds: design 47 H H-A-159, G §369 --- .../cmd/mesh-delivery-builder/main.go | 6 ++-- .../internal/build/run.go | 2 +- .../internal/versions/again.go | 33 +++++-------------- .../internal/versions/versions_test.go | 12 ++++--- 4 files changed, 19 insertions(+), 34 deletions(-) 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 b706c365..83e916f4 100644 --- a/modules/mesh-delivery-builder/cmd/mesh-delivery-builder/main.go +++ b/modules/mesh-delivery-builder/cmd/mesh-delivery-builder/main.go @@ -156,9 +156,9 @@ func run(ctx context.Context, getenv func(string) string, logOut io.Writer) erro conn.SetReconnectHandler(func(*nats.Conn) { hearing.Again(); heard.Nudge("") }) // The builder asks the controller, as its own account, whether the artifact store still holds a done key's blobs // (the seat verb held, novox/hq issue 1937) before it leaves the key done, on its calls connection. - // The builder numbers each trunk build at its claim (novox/hq design 51 *The versions*): its state versions, bound once - // the bus holds it; the floor's three sources asked as its own account. - versionsKV := process.AwaitBucket(ctx, js, conn, own.versions, "no trunk build is numbered: each is built unnumbered and published by its digest", logger.Printf) + // The state versions, kept from before G (design 51 *The versions*) and read through builder_versions until G §372 removes + // it, bound once the bus holds it; the builder numbers nothing in it (design 47 H H-A-159). + versionsKV := process.AwaitBucket(ctx, js, conn, own.versions, "builder_versions answers nothing of the versions numbered before G", logger.Printf) found := &findings{module: cred.Module, w: fw, logf: logger.Printf, now: time.Now} floorWaits := &versions.FloorWaits{Holder: versions.HolderOf(branches), Logf: logger.Printf, Said: found.floorSaid(context.WithoutCancel(ctx))} // The names waiting on their floor are kept in the state floor-waits (DLV-B4): a restarted builder takes them in, so diff --git a/modules/mesh-delivery-builder/internal/build/run.go b/modules/mesh-delivery-builder/internal/build/run.go index fcabe73a..81b04151 100644 --- a/modules/mesh-delivery-builder/internal/build/run.go +++ b/modules/mesh-delivery-builder/internal/build/run.go @@ -103,7 +103,7 @@ type Builder struct { Now func() time.Time Node string // Numbers numbers each trunk build at its claim and records what it was built with (design 51 *The versions*); nil - // numbers nothing. + // numbers nothing, as the builder's program leaves it (design 47 H H-A-159: the reservation numbers, G §369). Numbers Numbers // Reserved reserves the version of a trunk build at its start (design 47 G §369); nil reserves nothing. Reserved Reservations diff --git a/modules/mesh-delivery-builder/internal/versions/again.go b/modules/mesh-delivery-builder/internal/versions/again.go index 5f9d2f61..30f11bb4 100644 --- a/modules/mesh-delivery-builder/internal/versions/again.go +++ b/modules/mesh-delivery-builder/internal/versions/again.go @@ -3,16 +3,14 @@ package versions import ( "context" "fmt" - "strings" "time" ) // The tools' descriptions. const ( - FloorAgainDescription = "Ask the floor of one name again now, by hand (design 51 *The floor*): the seat's versions, the seat git's " + - "git.tags and the indexer's indexer_requirements, as the builder asks them by itself when a silent source says something. " + - "Answers which sources were silent and whether the floor is now known. A name the builder's versions already hold needs no floor: " + - "refused, saying so. A hand act." + FloorAgainDescription = "Refused for every name: the builder numbers nothing of its own and asks no floor (design 47 H H-A-159); " + + "a version is numbered by the reservation (design 47 G §369, builder_reserved). Kept until design 47 G §372 removes it with " + + "the state versions." ) // Acts are the builder's hand acts on its versions, answered by its program (the tools bundle writes them to reasks). @@ -31,24 +29,9 @@ type Acts struct { DropReserved func(ctx context.Context, module, series, by, why string, at time.Time) (string, error) } -// FloorAgain is builder_floor_again of name: the floor counts only for a name the versions hold nothing of. -func (a Acts) FloorAgain(ctx context.Context, name string) (string, error) { - entries, err := a.Numberer.Versions.Of(ctx, name) - if err != nil { - return "", err - } - if len(entries) > 0 { - return "", fmt.Errorf("%s holds %d versions: its floor counts only for its first number, so nothing is asked", name, len(entries)) - } - answer := name + " waits on no floor in this builder: the floor is asked at its next claim" - if a.Numberer.Waits != nil { - for _, w := range a.Numberer.Waits.Waiting() { - if w.Name == name { - answer = fmt.Sprintf("the floor of %s is asked again (%s were silent)", name, strings.Join(w.Silent, ", ")) - } - } - a.Numberer.Waits.Wake(WakeByHand, "", "", name) - } - a.Reconsider(ctx) - return answer + "; builder_versions shows its version once numbered", nil +// FloorAgain is builder_floor_again of name: refused, since the builder numbers nothing of its own and no claim asks a floor +// (design 47 H H-A-159; the reservation numbers, G §369). The tool stays until G §372 removes it with the state versions. +func (a Acts) FloorAgain(_ context.Context, name string) (string, error) { + return "", fmt.Errorf("the floor of %s is not asked: the builder numbers nothing of its own and asks no floor (design 47 H H-A-159); "+ + "a version is numbered by the reservation (G §369, builder_reserved)", name) } diff --git a/modules/mesh-delivery-builder/internal/versions/versions_test.go b/modules/mesh-delivery-builder/internal/versions/versions_test.go index c099156b..4999f0b6 100644 --- a/modules/mesh-delivery-builder/internal/versions/versions_test.go +++ b/modules/mesh-delivery-builder/internal/versions/versions_test.go @@ -588,11 +588,13 @@ func TestTheBuildersVersions(t *testing.T) { } _, _ = v.Mark(ctx, "m/p", "0.1.4", func(e *Entry) { e.State = Published }) acts := Acts{Numberer: &Numberer{Versions: v, Waits: &FloorWaits{}}, Reconsider: func(context.Context) {}} - if _, err := acts.FloorAgain(ctx, "m/p"); err == nil { - t.Error("a name with versions asks its floor again") - } - if ans, err := acts.FloorAgain(ctx, "m/new"); err != nil || ans == "" { - t.Errorf("floor again of a new name: %q %v", ans, err) + reconsidered := false + acts.Reconsider = func(context.Context) { reconsidered = true } + // H-A-159: the builder numbers nothing of its own, so no claim asks a floor: the tool refuses, saying so, and does nothing. + for _, name := range []string{"m/p", "m/new"} { + if ans, err := acts.FloorAgain(ctx, name); err == nil || !strings.Contains(err.Error(), "numbers nothing of its own") || reconsidered { + t.Errorf("floor again of %s: %q %v, looked again %v; want refused naming H-A-159, nothing looked at", name, ans, err, reconsidered) + } } }) } -- 2.54.0