Registry holders take a one-part publish made while the build runs: a reserved artifact with no digest yet accepts it (A-490j)
Builds: design 47 G A-490j, §381, A-415 Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
This commit is contained in:
@@ -683,6 +683,39 @@ 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
|
||||
|
||||
@@ -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. 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 or none yet (A-490j). 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,7 +34,10 @@ 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 {
|
||||
if art.Digest == digest {
|
||||
// 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 == "" {
|
||||
return true, "", nil
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ 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"},
|
||||
|
||||
Reference in New Issue
Block a user