E4b: keep the run a module was applied from in its have
The engine kept the applied run in its memory only, so a restarted engine applied an older run's want again. The have, the record of what the engine applied, carries the run (the node-engine seat's form 2): the engine reads it from the have before it applies a want that carries one, a write that names none keeps the last have's, and every have is written at the seat's form. Builds: design 47 H2 §813 (1); H-A-355, H-A-384 (2), H-A-388 (1)
This commit is contained in:
@@ -368,10 +368,30 @@ func TestAWantAndItsCompositionApplyTheModuleAndTheHaveNamesBoth(t *testing.T) {
|
||||
t.Errorf("a want of run %s after run 7: applied %d times, want %d", row.run, got, row.applied)
|
||||
}
|
||||
}
|
||||
// H-A-384 (2), H-A-388: the run is kept in the have, never in memory: the have names run 8, and a have an earlier life of
|
||||
// the engine wrote at run 20 holds a want of run 10 back, though this one applied run 8 last.
|
||||
if h := b.haves.last("web"); h.Run != "8" {
|
||||
t.Errorf("the have names run %q after run 8 was applied", h.Run)
|
||||
}
|
||||
h := b.haves.last("web")
|
||||
h.Run = "20"
|
||||
b.haves.Write(context.Background(), h)
|
||||
before = len(b.appliedList())
|
||||
fpr := fpOf("9")
|
||||
ckr, crawr, digr := composition(t, "web", fpr, false, archive("a", d1))
|
||||
b.comps.put(ckr, crawr)
|
||||
wkr, _ := wantFor(t, "web", fpr, digr, "")
|
||||
rawr, _ := bucketstest.Want(meshwants.WantsByWantNodeModuleValue{Fp: fpr, Run: "10"})
|
||||
b.wants.put(wkr, rawr)
|
||||
b.idle()
|
||||
if got := len(b.appliedList()) - before; got != 0 {
|
||||
t.Errorf("a want of run 10 after a have of run 20: applied %d times, want none", got)
|
||||
}
|
||||
b.mu.Lock()
|
||||
said := strings.Join(b.said, "\n")
|
||||
b.mu.Unlock()
|
||||
for _, want := range []string{"from run 7", "from run 8", "carries run 5, and the engine applied it from run 7"} {
|
||||
for _, want := range []string{"from run 7", "from run 8", "carries run 5, and the engine applied it from run 7",
|
||||
"carries run 10, and the engine applied it from run 20"} {
|
||||
if !strings.Contains(said, want) {
|
||||
t.Errorf("the journal does not say %q:\n%s", want, said)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user