H2 H-A-504: every have read gives the run, pipeline and want revision

Review round 1: sessionHaves.Read gave no run, pipeline or want revision,
so on the live engine every have written over an apply (held, failed,
waiting, not composed) dropped the want revision, and the next want
counted as nothing applied. Read now maps the have value the same way as
ReadAt, through one function.

Builds: design 47 H2 §813 (1); H-A-504 fourth addendum
This commit is contained in:
2026-11-23 02:13:04 +01:00
parent 84ff92a407
commit 4adc35d5ce
3 changed files with 43 additions and 4 deletions
+22
View File
@@ -447,6 +447,28 @@ func testAWantAndItsCompositionApplyTheModuleAndTheHaveNamesBoth(t *testing.T) {
t.Errorf("%s: the have names want revision %d and run %q, want %d and %q", row.name, h.WantRevision, h.Run, next, row.run)
}
}
// H-A-504 fourth addendum: the want revision is written with every have, so a failed apply after one keeps the revision
// the module was applied from, and the next want is still ordered against it.
hf := b.haves.last("web")
hf.WantRevision = wantsRev() // the older row's earlier life ends: what was applied is at the latest write
b.haves.Write(context.Background(), hf)
applied := hf.WantRevision
b.mu.Lock()
b.failWith = "systemctl start web.service: exit status 1"
b.mu.Unlock()
fpf := fpOf("c")
ckf, crawf, digf := composition(t, "web", fpf, false, archive("a", d1))
b.comps.put(ckf, crawf)
wkf, _ := wantFor(t, "web", fpf, digf, "")
rawf, _ := bucketstest.Want(meshwants.WantsByWantNodeModuleValue{Fp: fpf, Run: "11"})
b.wants.put(wkf, rawf)
b.idle()
if h := b.haves.last("web"); h.Phase != string(nodeengineclient.PhaseFailed) || h.WantRevision != applied || h.Run != "3" {
t.Errorf("the failed have after an apply: phase %s, want revision %d, run %q; want failed, %d and \"3\"", h.Phase, h.WantRevision, h.Run, applied)
}
b.mu.Lock()
b.failWith = ""
b.mu.Unlock()
b.mu.Lock()
said := strings.Join(b.said, "\n")
b.mu.Unlock()