A build step whose revision the picture passed ends superseded, not failed

The builder's check of a step's revision against its picture ran before
the judgement of the fingerprint and ended failed when the kept catalog
revision named a newer fingerprint of the module (main.338, 00:57). One
outcome for one fact: such a step ends superseded naming the superseding
fingerprint; failed stays for any other mismatch.

Builds: design 47 H2 H-A-508 second addendum
This commit is contained in:
2026-11-23 01:00:31 +01:00
parent c0c6228ebb
commit e76e49e6a3
2 changed files with 24 additions and 7 deletions
@@ -80,7 +80,8 @@ func (b *Builder) holdsRevision(branch string, source int64, entries []meshbuild
}
// keptRevisionHolds answers no outcome when the catalog keeps the ask's revision (its catalog revision by number) and that
// revision names every entry of the ask (H-A-205, H-A-222); else failed or could not run, with its words.
// revision names every entry of the ask (H-A-205, H-A-222); superseded below the picture when it names a newer fingerprint of
// an entry (H-A-508 second addendum); else failed or could not run, with its words.
func (b *Builder) keptRevisionHolds(ctx context.Context, run meshbuilds.StepRun, held int64) (outcome, said string) {
below := fmt.Sprintf("revision %d of %s is not named by the builder's picture, which holds source revision %d", run.Source, run.Branch, held)
if run.Source < held {
@@ -100,11 +101,25 @@ func (b *Builder) keptRevisionHolds(ctx context.Context, run meshbuilds.StepRun,
b.logf("%s: %s, and the catalog's revision %d is of source revision %d, the ask names %d: the step fails, nothing is built", run.Pipeline, below, run.Revision, source, run.Source)
return meshbuilds.StepEndedOutcomeFailed, fmt.Sprintf("%s, and the catalog's revision %d is of source revision %d, the ask names %d", below, run.Revision, source, run.Source)
}
// A step whose revision the picture has passed, and whose fingerprint the catalog's revision no longer names but names a
// newer one of its module, ends superseded with the superseding fingerprint in its why, never failed (design 47 H2 H-A-508
// second addendum: one outcome for one fact). Failed stays for any other mismatch.
var superseded []string
for _, e := range run.Entries {
if fps[e.Module] != e.Fingerprint {
b.logf("%s: %s, and the catalog's revision %d names %s at %q, not %s: the step fails, nothing is built", run.Pipeline, below, run.Revision, e.Module, fps[e.Module], e.Fingerprint)
return meshbuilds.StepEndedOutcomeFailed, fmt.Sprintf("%s, and the catalog's revision %d names %s at %q, not %s", below, run.Revision, e.Module, fps[e.Module], e.Fingerprint)
if fps[e.Module] == e.Fingerprint {
continue
}
if run.Source < held && fps[e.Module] != "" {
superseded = append(superseded, stepSuperseded(e.Module, e.Fingerprint, fps[e.Module]))
continue
}
b.logf("%s: %s, and the catalog's revision %d names %s at %q, not %s: the step fails, nothing is built", run.Pipeline, below, run.Revision, e.Module, fps[e.Module], e.Fingerprint)
return meshbuilds.StepEndedOutcomeFailed, fmt.Sprintf("%s, and the catalog's revision %d names %s at %q, not %s", below, run.Revision, e.Module, fps[e.Module], e.Fingerprint)
}
if len(superseded) > 0 {
said := strings.Join(superseded, "; ")
b.logf("%s: %s, and the catalog's revision %d names newer fingerprints: %s; nothing is built", run.Pipeline, below, run.Revision, said)
return meshbuilds.StepEndedOutcomeSuperseded, said
}
// Each asked fingerprint is recorded as the branch's, so its build reserves its version (H-A-155) as one the picture
// took in does; what the picture heard stays as it is, so the newer fingerprint's build is not superseded. Once the picture
@@ -477,7 +477,7 @@ func aStepAskWaitsForItsRevision(t *testing.T) {
// H-A-205: two pipelines of consecutive revisions run at once; the picture holds source revision 46, while the older pipeline
// asks the build of revision 45. Its kept catalog revision is read by number and the build runs while the picture never heard
// a newer entry of m (a restart); once it heard one on the first branch, H-A-489 overrides H-A-205 and the older ask is refused
// superseded. A kept revision naming another fingerprint fails the step, naming it.
// superseded. A kept revision naming another fingerprint ends the step superseded, naming it (H-A-508 second addendum).
func anOlderKeptRevisionIsReadByNumber(t *testing.T) {
var held atomic.Int64
held.Store(46)
@@ -524,8 +524,10 @@ func anOlderKeptRevisionIsReadByNumber(t *testing.T) {
r2.b.KeptRevision = func(context.Context, string, int64) (int64, map[string]string, error) {
return 45, map[string]string{"m": "src2:other"}, nil
}
if end := r2.b.BuildStep(t.Context(), "a1", run); end.Outcome != meshbuilds.StepEndedOutcomeFailed || !strings.Contains(end.Said, "names m at \"src2:other\"") {
t.Errorf("end = %+v; want failed naming the fingerprint the kept revision names", end)
// H-A-508 second addendum: below the picture, a kept revision naming another fingerprint of the module superseded the
// ask's: the step ends superseded naming it, never failed with the "below" words.
if end := r2.b.BuildStep(t.Context(), "a1", run); end.Outcome != meshbuilds.StepEndedOutcomeSuperseded || end.Said != stepSuperseded("m", fp1, "src2:other") {
t.Errorf("end = %+v; want superseded naming the fingerprint the kept revision names", end)
}
// H-A-222: an ask of the very source the picture holds, whose entries the picture no longer names (a re-pin kept revision 48
// of the same source 46 and the picture took its entries in), is held by its revision read by number, never waited for.