From ac2cd3749cb8b5f7a77f31cd4ddd05a2712a5400 Mon Sep 17 00:00:00 2001 From: jochen Date: Thu, 19 Nov 2026 21:39:35 +0100 Subject: [PATCH] Registry holders: the distribution holder keeps trunk's check; the package holders run the kit's held-under-another-digest case on both seats (A-490j, A-490a) Builds: design 47 G A-490j, A-490a Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy --- .../internal/holder/holder_test.go | 33 ------------------- .../distribution/internal/holder/reserved.go | 7 ++-- .../internal/holder/reserved_test.go | 1 - .../internal/packageseats/holder_test.go | 1 + 4 files changed, 3 insertions(+), 39 deletions(-) diff --git a/modules/distribution/internal/holder/holder_test.go b/modules/distribution/internal/holder/holder_test.go index aa57b8926..bec32edc6 100644 --- a/modules/distribution/internal/holder/holder_test.go +++ b/modules/distribution/internal/holder/holder_test.go @@ -683,39 +683,6 @@ func TestTheHolderOfTheTwoImageSeats(t *testing.T) { }} }) }) - // Design 47 G A-490j: the one-part publish a build module makes while it builds, as every publish holder is held to it, - // checked through the real Reserved against the builder's answer. - t.Run("the publish while the build runs", func(t *testing.T) { - publishconformance.RunReserved(t, func(t *testing.T) publishconformance.ReservedBed { - b := newBed(true) - answer := "" - b.h.Builder = Reserved{Ask: func(string, any) (json.RawMessage, error) { - if answer == "" { - return nil, errors.New("no reserved version of m/tools") - } - return json.RawMessage(answer), nil - }} - return publishconformance.ReservedBed{ - Reserve: func(r publishconformance.Reservation) { - d := map[publishconformance.Reservation]string{publishconformance.NoDigestYet: "", publishconformance.SameDigest: part.Digest, - publishconformance.OtherDigest: digestOf([]byte("another"))}[r] - answer = `{"module":"m","version":"0.1.0","artifacts":[{"artifact":"m:tools","digest":"` + d + `"}]}` - }, - PublishWhole: func() publishconformance.Outcome { - r := req("t-whole") - r.Version = "0.1.0" - a, err := b.h.Publish(ArtifactSeat, builder, r) - if err == nil && !a.Ended { - _, err = b.h.PublishPart(ArtifactSeat, builder, PartRequest{Transfer: "t-whole", Digest: part.Digest, Last: true, Data: blob}) - } - o := publishconformance.Outcome{Err: err} - if len(b.said) > 0 { - o.Event, o.Reason = b.said[len(b.said)-1].event, b.said[len(b.said)-1].body.Reason - } - return o - }} - }) - }) t.Run("a publish with a version and no parts tags the held digest at the store's size; one not held is not stored", func(t *testing.T) { // Design 47 G A-417, A-73, A-50: the build stored the bundle untagged; the builder's publish of its version with that // digest and no parts tags it and says published, nothing sent; a digest the store holds none of is refused as not diff --git a/modules/distribution/internal/holder/reserved.go b/modules/distribution/internal/holder/reserved.go index 4df57c131..b649431d5 100644 --- a/modules/distribution/internal/holder/reserved.go +++ b/modules/distribution/internal/holder/reserved.go @@ -9,7 +9,7 @@ import ( // Reserved is the holder's check of a publish against the builder's reservation (novox/hq design 47 §381, §478, §504): it asks the // seat mesh-builds' verb reserved with the publish's name and version, a package's name in its ecosystem, and accepts the publish -// only when that version is the one reserved and an artifact of it has the publish's digest or none yet (A-490j). It reads no catalog and a publish gains +// only when that version is the one reserved and an artifact of it has the publish's digest. It reads no catalog and a publish gains // no field. It is the Builder the holder's Check asks. type Reserved struct { // Ask is the runtime's request and reply over the bus (mesh-sdk stdio.Ask). @@ -34,10 +34,7 @@ func (r Reserved) Recorded(name, version, digest string) (bool, string, error) { return false, fmt.Sprintf("%s reserved %s for %s, not %s", a.Module, a.Version, name, version), nil } for _, art := range a.Artifacts { - // An artifact whose build has not recorded its digest yet takes the publish: the builder records a build's digests only when - // the build ends, while the build module publishes during it (design 47 G §369, A-415, A-490j). Its record then meets what - // the holder holds: the published kept on the reservation marks the artifact, and a digest that differs fails the build. - if art.Digest == digest || art.Digest == "" { + if art.Digest == digest { return true, "", nil } } diff --git a/modules/distribution/internal/holder/reserved_test.go b/modules/distribution/internal/holder/reserved_test.go index 5e0b33973..faa32b074 100644 --- a/modules/distribution/internal/holder/reserved_test.go +++ b/modules/distribution/internal/holder/reserved_test.go @@ -19,7 +19,6 @@ func reservedChecksAPublishAgainstTheReservation(t *testing.T) { }{ {name: "the reserved version and digest", answer: `{"module":"mesh-image","version":"0.1.7","artifacts":[{"artifact":"mesh-image:image","digest":"sha256:aa"}]}`, ok: true}, {name: "another artifact of it carries the digest", answer: `{"module":"mesh-image","version":"0.1.7","artifacts":[{"artifact":"mesh-image:aux"},{"artifact":"mesh-image:image","digest":"sha256:aa"}]}`, ok: true}, - {name: "the artifact is not built yet", answer: `{"module":"mesh-image","version":"0.1.7","artifacts":[{"artifact":"mesh-image:image"}]}`, ok: true}, {name: "another digest", answer: `{"module":"mesh-image","version":"0.1.7","artifacts":[{"artifact":"mesh-image:image","digest":"sha256:bb"}]}`, why: "another digest than sha256:aa"}, {name: "another version reserved", answer: `{"module":"mesh-image","version":"0.1.8","artifacts":[]}`, why: "reserved 0.1.8 for registry/mesh-image, not 0.1.7"}, {name: "the builder refused the name", err: errors.New("no entry carries registry/mesh-image"), why: "no entry carries registry/mesh-image"}, diff --git a/modules/gitea/internal/packageseats/holder_test.go b/modules/gitea/internal/packageseats/holder_test.go index 45674e492..405b9e210 100644 --- a/modules/gitea/internal/packageseats/holder_test.go +++ b/modules/gitea/internal/packageseats/holder_test.go @@ -203,6 +203,7 @@ func TestTheForgeHoldsBothPackageSeats(t *testing.T) { publishconformance.OtherDigest: digest([]byte("another"))}[r] answer = `{"module":"mesh-sdk","version":"0.1.19","artifacts":[{"artifact":"mesh-sdk:` + seat + `","digest":"` + d + `"}]}` }, + Hold: func() { b.forge.holdDigest(seat, "mesh-sdk", "0.1.19", digest([]byte("first"))) }, PublishWhole: func() publishconformance.Outcome { a, err := b.h.Publish(seat, goBuild, pub("mesh-sdk", "0.1.19", whole)) if err == nil && !a.Ended {