Builder: a published kept at a version whose recorded digests none matches raises the finding at once, the version taken and never released (A-490j)
Builds: design 47 G A-490j Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
This commit is contained in:
@@ -141,6 +141,10 @@ func (rv *reservations) Built(ctx context.Context, module, version string, diges
|
||||
}
|
||||
for _, h := range unmatched {
|
||||
rv.logf("a published of %s@%s kept on %s %s marks no artifact: its digest %s is none of the built digests %v", h.Name, h.Version, module, version, h.Digest, cur.Artifacts)
|
||||
// A build whose recorded digest differs from what the holder holds at its version fails loudly at once: the version is taken
|
||||
// and no artifact is marked for it, so it is never released (design 47 G A-490j).
|
||||
rv.unreleased(ctx, cur, fmt.Sprintf("the holder holds %s@%s under digest %s, which no artifact of the build carries (%v): the version is taken and is never released",
|
||||
h.Name, h.Version, h.Digest, cur.Artifacts))
|
||||
}
|
||||
for _, m := range marked {
|
||||
rv.sayPublished(ctx, m, m.Reserved.Artifacts[m.Artifact])
|
||||
|
||||
@@ -221,13 +221,14 @@ func TestAReleasedVersionIsTaggedAtTheCommitItWasBuiltFrom(t *testing.T) {
|
||||
// is said in the log.
|
||||
func TestAPublishedHeardBeforeTheDigestsIsSaidWhenTheBuildRecordsThem(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
fs := &memFindings{vals: map[string][]byte{}}
|
||||
var logs []string
|
||||
logf := func(f string, a ...any) { logs = append(logs, fmt.Sprintf(f, a...)) }
|
||||
none := func(string, any) (json.RawMessage, error) {
|
||||
return json.Marshal(meshcatalog.VersionsAnswer{Module: "m"})
|
||||
}
|
||||
rv := newReservations(&memReserve{vals: map[string][]byte{}, revs: map[string]uint64{}}, none, func() jetstream.KeyValue { return &boundsKV{keys: map[string]bool{}} },
|
||||
&findings{module: builds.BuilderModule, w: &memFindings{vals: map[string][]byte{}}, logf: t.Logf, now: time.Now}, nil, logf)
|
||||
&findings{module: builds.BuilderModule, w: fs, logf: t.Logf, now: time.Now}, nil, logf)
|
||||
var said []meshbuilds.PackagePublished
|
||||
rv.say = func(_ context.Context, p meshbuilds.PackagePublished) error { said = append(said, p); return nil }
|
||||
rv.filled.Store(true)
|
||||
@@ -249,6 +250,14 @@ func TestAPublishedHeardBeforeTheDigestsIsSaidWhenTheBuildRecordsThem(t *testing
|
||||
if log := strings.Join(logs, "\n"); !strings.Contains(log, "is kept on") || !strings.Contains(log, "m-x@"+res.Version+" kept on m "+res.Version+" marks no artifact") {
|
||||
t.Fatalf("log = %q, want the published kept and the one never matching said", logs)
|
||||
}
|
||||
// A-490j: the one that never matched is raised at once, naming the version taken and the holder's digest.
|
||||
raised := ""
|
||||
for _, v := range fs.vals {
|
||||
raised += string(v)
|
||||
}
|
||||
if !strings.Contains(raised, "sha256:x") || !strings.Contains(raised, "is taken and is never released") {
|
||||
t.Fatalf("no finding raised for the digest the holder holds: %s", raised)
|
||||
}
|
||||
// Taken in once: a published of m:a heard again says nothing more.
|
||||
rv.published(ctx, versions.Outcome{Name: "m-a", Version: res.Version, Digest: "sha256:a"})
|
||||
if len(said) != 1 {
|
||||
|
||||
Reference in New Issue
Block a user