Finding 5 (review r1): a tier-late owed is said before a paused tier breaks

Builds: design 47 H2b §824 2., 4.; §832 4.
This commit is contained in:
2026-11-27 03:54:10 +01:00
parent 5e25feee3a
commit f3d678d88d
2 changed files with 29 additions and 0 deletions
@@ -274,6 +274,9 @@ func (p *passer) tiers(n assign.Nodes, placedOn func(module, branch string) []st
}
late := !runs && t.PausedFrom.IsZero() && !now.Before(clock.Add(bound))
if !runs && !t.PausedFrom.IsZero() {
if !t.TierLateAt.IsZero() && t.TierLateSaid.IsZero() {
p.sayTierLate(key, pipeline, branch, number, t, notRunning) // owed still: said while the tier is paused too (§824 2., §832 4.)
}
break // paused: no lateness, and no timer armed
}
if late {
@@ -356,6 +356,32 @@ func TestAPipelinesWantsAreWrittenTierByTier(t *testing.T) {
t.Errorf("AC-824d: said %+v, want tier-late then running", r.said)
}
})
// Design 47 H2b §824 2., §832 4. (review r1 finding 5): a tier-late owed and lost to a restart is said at the start pass even
// while the tier its key stands at is paused.
t.Run("a tier-late owed is said at a start while the tier is paused", func(t *testing.T) {
db, web := meshcatalogclient.SourcePrefix2+strings.Repeat("d", 64), meshcatalogclient.SourcePrefix2+strings.Repeat("c", 64)
pipeline := trunkBranch + ".5"
r := newTierRig(t, db, web, pipeline)
r.refuse = true
r.pass(30 * time.Minute) // tier 1 late: tier-late-at written, the say refused
raw, _ := json.Marshal(nodeengine.Running{Node: "g14", Module: "db", Fingerprint: db})
_ = r.p.w.hearRunning("running.g14.db", raw)
r.pass(31 * time.Minute) // tier 1 runs: tier 2's progress carries the fields
akey, _ := asks.RecordAskKey("g14", "web", "sha256:"+strings.Repeat("a", 64))
r.p.w.put(buckets.Asks(), akey, []byte(`{}`))
r.pass(32 * time.Minute)
prog, _, _ := r.p.ends.tiersOf(pipeline)
if prog.Tier != 2 || prog.PausedFrom.IsZero() || prog.TierLateAt.IsZero() || !prog.TierLateSaid.IsZero() {
t.Fatalf("tier 2 is not paused holding an owed tier-late: %+v", prog)
}
r.restart()
r.refuse = false
r.p.w.put(buckets.Asks(), akey, []byte(`{}`))
r.pass(33 * time.Minute)
if len(r.said) != 1 || r.said[0].Outcome != meshwants.PipelineWantedOutcomeTierLate {
t.Errorf("a start pass says %+v while its tier is paused, want the owed tier-late", r.said)
}
})
t.Run("a key of the earlier rule with a tier-late in the bucket says no second one; a tier past its bound pauses for no later ask; a refused clear holds the next tier", func(t *testing.T) {
db, web := meshcatalogclient.SourcePrefix2+strings.Repeat("d", 64), meshcatalogclient.SourcePrefix2+strings.Repeat("c", 64)
pipeline := trunkBranch + ".5"