disk-load retires a reading only on its module's key, and measures as soon as its watch catches up (review round 1)

A round no longer retires readings missing from the watched set, which may be empty or partial;
a module's readings are retired when its key of mesh-host_data is deleted or names fewer items.
A round refused before the watch caught up runs once it has, not an hour later. disk_round reads
this machine's key alone, as its grant allows.

Claude-Session: https://claude.ai/code/session_01NcbgfJ9Gum47zkFKWRaovL
This commit is contained in:
2026-11-01 00:28:29 +01:00
parent 357a53d9ac
commit 6fe0ef321d
5 changed files with 56 additions and 36 deletions
+9 -3
View File
@@ -67,6 +67,7 @@ func TestTheItemsComeFromTheEnginesKeysAndARoundSaysHowFarItGot(t *testing.T) {
if r := round(); r.Ended == nil || !strings.Contains(r.Error, "not watched yet") {
t.Fatalf("the round before the watch is kept as %+v", r)
}
refusedAt := round().Started
for _, step := range []struct {
name string
change stdio.StateChange
@@ -88,11 +89,16 @@ func TestTheItemsComeFromTheEnginesKeysAndARoundSaysHowFarItGot(t *testing.T) {
}
w.Ready()
// A round measures every item it was handed; the missing one fails, and the round goes on and says it.
if _, _, err := k.Round(context.Background(), false); err != nil {
t.Fatalf("the round: %v", err)
// The round refused before the watch caught up runs once it has (Watched.Follow), not at the next hour: it measures
// every item it was handed; the missing one fails, and the round goes on and says it.
now = now.Add(time.Minute)
if !k.RoundIfRefused(context.Background()) || k.RoundIfRefused(context.Background()) {
t.Fatal("the round refused before the watch was not run once when the watch caught up")
}
r := round()
if !r.Started.After(refusedAt) {
t.Fatalf("the round's key still says the refused round: %+v", r)
}
if r.Ended == nil || r.Items != 3 || r.Measured != 3 || len(r.Failed) != 1 || r.Failed[0].Item != "pg.wal" ||
!strings.Contains(r.Failed[0].Why, "does not exist") || measured["/srv/pg"] != 1 || measured["/srv/web"] != 1 {
t.Fatalf("the round's key says %+v; measured %v", r, measured)