Keep a restricted message past its stream's age as a record without its body, as ADR 0376 §3 says (issue 728)

Reverts 45b6c347, which kept nothing of such a message and raised an aged-out
condition: that departed from an accepted decision on a lead's word alone. The
concern behind it (the record keeps the subject, with no age) is its own issue.
This commit is contained in:
jochen
2026-10-15 14:56:24 +02:00
parent 15a374659e
commit 9aeb5f4493
5 changed files with 45 additions and 139 deletions
@@ -2,7 +2,6 @@ package main
import (
"context"
"strings"
"testing"
"time"
@@ -68,31 +67,3 @@ func TestADeadLetterThatAgesOutClearsItsConditionAndSaysSo(t *testing.T) {
t.Fatalf("not plain: %s", why)
}
}
// **A message past its restricted stream's age is not kept, only counted** (novox/hq ADR 0376, as the feature's lead
// decided): its advisory is said as a condition whose words give how many aged out undelivered and from which stream.
func TestMessagesNotKeptPastTheirAgeAreCounted(t *testing.T) {
now := time.Date(2026, 10, 15, 12, 0, 0, 0, time.UTC)
f := calm(now)
f.advisories = []link.Advisory{{Kind: link.AdvisoryMaxDeliveries, ID: "MAIL.ace_mailer", Stream: "MAIL",
Consumer: "ace_mailer", Token: link.AdvisoryAgedOut, Said: "the consumer gave up after the stream's age",
First: now.Add(-10 * time.Minute), Last: now.Add(-time.Minute), Count: 2}}
var found []conditions.Observation
for _, o := range watchAdvisories(f) {
if o.Token == link.AdvisoryAgedOut {
found = append(found, o)
}
}
if len(found) != 1 {
t.Fatalf("said %+v", found)
}
o := found[0]
if o.Headline != "2 messages of the stream MAIL aged out undelivered" || o.Times != 2 ||
!strings.Contains(o.Summary, "2 messages of the stream MAIL aged out undelivered") {
t.Fatalf("%+v", o)
}
if why, ok := conditions.PlainWords(conditions.Words{Headline: o.Headline, Explanation: o.Explanation,
Resolved: o.Resolved, Needs: o.Needs}); !ok {
t.Fatalf("not plain: %s", why)
}
}
-12
View File
@@ -584,18 +584,6 @@ func watchAdvisories(f *signalFacts) []conditions.Observation {
"for you yet. It tries again every minute."
o.Resolved = "Resolved: the message is kept"
}
if a.Kind == link.AdvisoryMaxDeliveries && a.Token == link.AdvisoryAgedOut {
// Given up on after its restricted stream's age, so not kept at all, only counted (novox/hq ADR 0376).
counted := link.AgedOutWords(a.Count, a.Stream)
o.Machine = consumerMachine(a.Stream, a.Consumer)
o.Summary = fmt.Sprintf("%s in the last hour: %s", counted, a.Said)
o.Headline = clip(conditions.Capital(counted), 60)
o.Explanation = conditions.Capital(fmt.Sprintf("%s could not handle %s, and by the time it gave up the "+
"stream's time limit had passed, so the mesh did not keep them. Nothing to do; this clears an hour "+
"after the last one.", consumerWho(a.Stream, a.Consumer), map[bool]string{true: "some messages",
false: "a message"}[a.Count > 1]))
o.Resolved = "Resolved: no more messages of the stream " + a.Stream + " aged out undelivered"
}
out = append(out, o)
}
if f.busFaultsErr != nil {