From d9596548f910a0037c05e12fb6ddc1202ac1fd6b Mon Sep 17 00:00:00 2001 From: jochen Date: Thu, 19 Nov 2026 21:39:21 +0100 Subject: [PATCH] publishconformance: a version held under another digest is refused though reserved with no digest yet (A-490j, A-490a) Builds: design 47 G A-490j, A-490a Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy --- .../publishconformance/publishconformance.go | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/modules/mesh-delivery-sdk/publishconformance/publishconformance.go b/modules/mesh-delivery-sdk/publishconformance/publishconformance.go index aa8164bf..33658320 100644 --- a/modules/mesh-delivery-sdk/publishconformance/publishconformance.go +++ b/modules/mesh-delivery-sdk/publishconformance/publishconformance.go @@ -92,22 +92,27 @@ type ReservedBed struct { // Reserve makes the builder hold the case's name at its version as reserved, its artifact as r says. A case that never calls // it has the builder hold no reservation. Reserve func(r Reservation) + // Hold makes the holder hold the case's name at its version under another digest than the file's, as the first publish of it + // stored (A-490, A-490j): a second publish with another digest is refused as the holder holds the first. + Hold func() // PublishWhole sends the one-part publish of the case's file (its own digest) and reports what the holder did. PublishWhole func() Outcome } // RunReserved runs the cases of a publish made while the build runs, over beds made by fresh (design 47 G A-490j): the builder -// records a build's digests only when it ends, so a reserved artifact naming no digest yet takes the publish. +// records a build's digests only when it ends, so a reserved artifact naming no digest yet takes the publish while the holder's own refusal of a version it holds under another digest stands. Package holders only: an image holder is no case of it (A-490j). func RunReserved(t *testing.T, fresh func(t *testing.T) ReservedBed) { t.Helper() for _, c := range []struct { name string reserve Reservation // 0: nothing reserved + held bool // the holder holds the version under another digest already ok bool words string }{ {name: "reserved, no digest yet: published", reserve: NoDigestYet, ok: true}, {name: "reserved with the digest: published", reserve: SameDigest, ok: true}, + {name: "reserved with no digest yet, the version held under another digest: refused, nothing published", reserve: NoDigestYet, held: true, words: "is published with"}, {name: "reserved for another digest: refused, naming the reservation", reserve: OtherDigest, words: "did not reserve"}, {name: "nothing reserved: refused", words: "did not"}, } { @@ -116,7 +121,17 @@ func RunReserved(t *testing.T, fresh func(t *testing.T) ReservedBed) { if c.reserve != 0 { b.Reserve(c.reserve) } + if c.held { + b.Hold() + } o := b.PublishWhole() + if c.held { + // Refused whether it ends with an error or only with the event refused, and never said published. + if o.Event != "refused" || !strings.Contains(o.Reason, c.words) { + t.Fatalf("answered %+v; want refused with %q in its reason, and nothing published", o, c.words) + } + return + } if c.ok { if o.Err != nil || o.Event != "published" { t.Fatalf("answered %+v; want no error and published said", o)