From c67bfcdc0fe67c770748720c08c3c3546ea8ce82 Mon Sep 17 00:00:00 2001 From: jochen Date: Fri, 20 Nov 2026 03:07:22 +0100 Subject: [PATCH] A3: the assigner keeps no order waits; the order on a machine is its node-engine's MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The order waits go whole: orderwaits.go (order... in the state waits, their wait-held and wait-ended, the catalog entries read for a form change), the package internal/acting, the want rule's acting edges (Module.Acting, actingWaiting, ActingRuns, Nodes.Serves), the why record's acting reads, the release how `now` and the order rows of assigner_waits, and the consumption of the indexer's take-in.taken that fed the taken-in edge. assigner_waits and assigner_release keep the outside waits and the puts. Builds: design 47 H §771, §764; H-A-55 Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy --- .../cmd/mesh-delivery-assigner/buildended.go | 14 - .../cmd/mesh-delivery-assigner/main.go | 3 - .../cmd/mesh-delivery-assigner/orderwaits.go | 323 ---------------- .../mesh-delivery-assigner/orderwaits_test.go | 351 ------------------ .../mesh-delivery-assigner/outside_tools.go | 75 +--- .../cmd/mesh-delivery-assigner/pass.go | 10 - .../mesh-delivery-assigner/placeorder_test.go | 200 ++++++++++ .../cmd/mesh-delivery-assigner/tools.go | 2 +- .../cmd/mesh-delivery-assigner/why.go | 14 +- .../cmd/mesh-delivery-assigner/world.go | 13 - .../internal/acting/acting.go | 114 ------ .../internal/assign/wants.go | 73 ---- .../internal/assign/wants_test.go | 36 -- .../mesh-delivery-assigner/manifest_test.go | 2 +- modules/mesh-delivery-assigner/module.json | 1 - 15 files changed, 207 insertions(+), 1024 deletions(-) delete mode 100644 modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/orderwaits.go delete mode 100644 modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/orderwaits_test.go create mode 100644 modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/placeorder_test.go delete mode 100644 modules/mesh-delivery-assigner/internal/acting/acting.go diff --git a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/buildended.go b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/buildended.go index 43d2af42..6b02c229 100644 --- a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/buildended.go +++ b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/buildended.go @@ -193,20 +193,6 @@ func hearBuilds(ctx context.Context, js jetstream.JetStream, ends *builtEnds, wa }() } -// hearTaken registers the hub's taker of the indexer's take-in.taken, each waking the pass (orderwaits.go, §298, A-260); before -// the hub starts. -func hearTaken(hub *process.EventHub, taken *takenSources, wake func(), logf func(string, ...any)) error { - return hub.Handle(takenSubject, func(m jetstream.Msg) { - if err := taken.put(m.Data()); err != nil { - logf("%s is not kept: %v", m.Subject(), err) - } - if err := m.Ack(); err != nil { - logf("acknowledging %s: %v", m.Subject(), err) - } - wake() - }) -} - // compareVersion orders two MAJOR.MINOR.PATCH versions by their numbers; a part that is no number counts as 0. func compareVersion(a, b string) int { pa, pb := strings.Split(a, "."), strings.Split(b, ".") diff --git a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/main.go b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/main.go index 50f328f7..a4bbd374 100644 --- a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/main.go +++ b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/main.go @@ -678,9 +678,6 @@ func follow(ctx context.Context, js jetstream.JetStream, nc process.Subscriber, } hearReleases(ctx, js, w, wake, findings, logger.Printf) // version-released, machine-away and machine-back hearBuilds(ctx, js, &w.ends, wake, findings, logger.Printf) - if err := hearTaken(hub, &w.taken, wake, logger.Printf); err != nil { - logger.Printf("the indexer's take-ins are not heard, so an entry held by an order edge waits until the assigner starts again: %v", err) - } hearReadsChanged(ctx, js, hub, reads, findings, gate.EventsLive, logger.Printf) hearRunning(ctx, js, w, wake, findings, logger.Printf) } diff --git a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/orderwaits.go b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/orderwaits.go deleted file mode 100644 index 73647dc4..00000000 --- a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/orderwaits.go +++ /dev/null @@ -1,323 +0,0 @@ -package main - -import ( - "context" - "encoding/json" - "fmt" - "strconv" - "sync" - - "git.novox.be/novox/mesh-contracts/go/seats/meshbroker" - mma "git.novox.be/novox/mesh-contracts/go/seats/meshmoduleassigner" - "git.novox.be/novox/mesh-contracts/go/seats/nodeengine" - mwc "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/clients/meshwantsclient" - "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshcatalog" - "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshdelivery" - seat "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshwants" - "git.novox.be/novox/mesh-sdk/go/catalogue" - "git.novox.be/novox/mesh-sdk/go/process" - "git.novox.be/novox/mesh-sdk/go/seatdef" - - "mesh-delivery-assigner/internal/acting" - "mesh-delivery-assigner/internal/assign" - "mesh-delivery-assigner/internal/assigngraph" - "mesh-delivery-assigner/internal/assignment" - "mesh-delivery-assigner/internal/buckets" -) - -// The three order edges of a delivery that crosses a form change (design 47 G §298, A-245, A-258, A-259, A-260). Each is an acting wait of the -// assigner, kept in the state `waits` under `order...` beside the acting waits, in the step placing, said as wait-held -// when a want is held for it and wait-ended (ran, released, replaced) when it moves; assigner_waits reads them and assigner_release with -// how `now` releases them, as it does an acting wait. The holders of the seats are read from the seat holders the assignments compose -// (assignment.SeatHoldersOf), never named: -// - the node-backup holder's and the bus module's (the holder of the seat mesh-broker) new versions run before a module whose kept data's -// form changes is moved, since the restore point needs both (OrderBackup); -// - at a revert a node's node-engine goes back last on that node, after every module it restores there runs the reverted build, which it -// starts only once it has said `restored` (OrderEngineLast); -// - the reverted assigner and gate are wanted only once the indexer's take-in.taken of the trunk branch names a source revision at least -// the trunk's head, the highest `src` of the trunk branch's module values (OrderTakenIn, A-260). - -// takenSubject is the indexer's event take-in.taken on its own stream, as the manifest's consumes names it. -var takenSubject = process.ModuleStreamSubject(buckets.IndexerModule, "take-in.taken") - -// takenSources are the newest source revisions a take-in.taken named, by watched branch, as heard (hearBuildsAndReleases). -type takenSources struct { - mu sync.Mutex - own map[string]int64 -} - -// put takes one take-in.taken in. A hand drop, and a taken with no source revision (one said before G), take nothing in. -func (t *takenSources) put(data []byte) error { - var e meshcatalog.TakeInTaken - if err := json.Unmarshal(data, &e); err != nil { - return fmt.Errorf("a take-in.taken that is none: %w", err) - } - if e.Dropped || e.Source == 0 || e.Branch == "" { - return nil - } - t.mu.Lock() - defer t.mu.Unlock() - if t.own == nil { - t.own = map[string]int64{} - } - t.own[e.Branch] = max(t.own[e.Branch], e.Source) - return nil -} - -// of is the newest source revision of branch taken in; 0 before one is heard. -func (t *takenSources) of(branch string) int64 { - t.mu.Lock() - defer t.mu.Unlock() - return t.own[branch] -} - -// orderEdge is one order edge held on module's want on node: part's version fp must run on partNode (OrderBackup, OrderEngineLast), or the -// trunk's source revision source be taken in (OrderTakenIn). -type orderEdge struct { - node, module, part, partNode, fp, entry, order string - source int64 -} - -func (e orderEdge) key() string { return acting.OrderKey(e.node, e.module, e.part) } - -func (e orderEdge) acting() assign.ActingEdge { - return assign.ActingEdge{Node: e.partNode, Part: e.part, Fp: e.fp, Step: seatdef.StepPlace} -} - -// orderRuns says an order edge is met: its part runs the version, or the source revision is taken in. -func (p *passer) orderRuns(n assign.Nodes, e orderEdge) bool { - if e.order == acting.OrderTakenIn { - return p.w.taken.of(p.w.trunkName()) >= e.source - } - return n.Runs(e.acting()) -} - -// seatHolders are the holders of each seat as the assignments compose them, by seat name. -func (p *passer) holdersBySeat() map[string][]mma.SeatHoldersHoldersItem { - out := map[string][]mma.SeatHoldersHoldersItem{} - for _, sh := range assignment.SeatHoldersOf(p.w.assignments()) { - out[sh.Seat] = append(out[sh.Seat], sh.Holders...) - } - return out -} - -// orderEdgesOf computes §298's edges on the wants of module m on each of its nodes, into p.orders. wanted is m's wants by node; trunk the -// trunk's module values. A node that has no running build heard, runs m at its trunk version already, or is wanted that version already -// has none: nothing moves. It answers, by node, whether an edge still stands that cannot be recorded as a wait because the catalog entry -// it reads is not answered yet (asked, and its answer wakes a pass): the want is held meanwhile, never written across a form change unread. -func (p *passer) orderEdgesOf(ctx context.Context, m assign.Module, wanted map[string]mwc.Want, trunk map[string]meshcatalog.ModulesByModuleValue) map[string]bool { - unread := map[string]bool{} - p.orderVisited[m.Name] = true - if m.FP == "" || p.graph == nil || p.entries == nil { - return unread - } - var holders map[string][]mma.SeatHoldersHoldersItem - for _, node := range m.Nodes { - if w, ok := wanted[node]; ok && !w.Removed && w.Fp == m.FP { - continue // the version is wanted already: nothing moves, so nothing waits - } - run, heard := p.w.runningOf(node, m.Name) - if !heard || run.Stopped || run.Fingerprint == "" || run.Fingerprint == m.FP { - continue - } - if holders == nil { - holders = p.holdersBySeat() - } - held := func(seatName string) bool { - for _, h := range holders[seatName] { - if h.Module == m.Name && h.Node == node { - return true - } - } - return false - } - add := func(e orderEdge) { - e.node, e.module, e.entry = node, m.Name, m.FP - p.orders[e.key()] = e - } - // 1. a kept data's form changes: the restore point needs the new node-backup holder and bus module. - changes, known := p.formChange(ctx, m.Name, run.Fingerprint, m.FP) - if !known { - unread[node] = true - } - if len(changes) > 0 { - for seatName, onNode := range map[string]bool{catalogue.BackupSeat: true, meshbroker.Seat: false} { - for _, h := range holders[seatName] { - if h.Module == m.Name || (onNode && h.Node != node) || trunk[h.Module].Fp2 == "" { - continue - } - add(orderEdge{part: h.Module, partNode: h.Node, fp: trunk[h.Module].Fp2, order: acting.OrderBackup}) - } - } - } - if !held(nodeengine.Seat) && !held(mma.Seat) && !held(meshdelivery.Seat) { - continue - } - reverted, err := assigngraph.Reverted(ctx, p.graph.objects, node, m.Name, run.Fingerprint, m.FP) - if err != nil { - p.logf("whether the want of %s on %s at %s is a revert is not read: %v", m.Name, node, m.FP, err) - continue - } - if !reverted { - continue - } - // 2. at a revert the node-engine goes back last on its node: after every module that is set back there across a form change runs. - if held(nodeengine.Seat) { - for module, byNode := range p.w.wantsOf() { - // What it is set back to is its trunk version, which the rules write as its want in this pass. - target := trunk[module].Fp2 - if w, ok := byNode[node]; module == m.Name || !ok || w.Removed || target == "" { - continue - } - xrun, heard := p.w.runningOf(node, module) - if !heard || xrun.Stopped || xrun.Fingerprint == "" || xrun.Fingerprint == target { - continue - } - if back, err := assigngraph.Reverted(ctx, p.graph.objects, node, module, xrun.Fingerprint, target); err != nil || !back { - continue - } - xchanges, known := p.formChange(ctx, module, xrun.Fingerprint, target) - if !known { - unread[node] = true - } - if len(xchanges) > 0 { - add(orderEdge{part: module, partNode: node, fp: target, order: acting.OrderEngineLast}) - } - } - } - // 3. the reverted assigner and gate wait for the indexer to take in the trunk's head. - if held(mma.Seat) || held(meshdelivery.Seat) { - var head int64 - for _, v := range p.w.trunkOf(p.w.trunkName()) { - head = max(head, v.Src) - } - if head > 0 { - add(orderEdge{part: buckets.IndexerModule, fp: strconv.FormatInt(head, 10), source: head, order: acting.OrderTakenIn}) - } - } - } - return unread -} - -// orderReleased is the order waits released by hand and not yet run, by `@`. -func (p *passer) orderReleased() map[string]bool { - out := map[string]bool{} - for key, raw := range p.w.read(buckets.Waits()) { - if w, err := acting.Decode(raw); err == nil && w.Released && acting.IsOrder(key) { - out[key+"@"+w.Fp] = true - } - } - return out -} - -// orderActing is the order edges of module on node that still hold its want, as acting edges: those not met, and not released by hand. A -// node whose catalog entry is not read yet holds its want too, on a stand-in edge no part runs. -func (p *passer) orderActing(module string, released map[string]bool, unread map[string]bool, n func() assign.Nodes) func(node string) []assign.ActingEdge { - return func(node string) []assign.ActingEdge { - var out []assign.ActingEdge - nodes := n() - for _, e := range p.orders { - if e.module == module && e.node == node && !released[e.key()+"@"+e.fp] && !p.orderRuns(nodes, e) { - out = append(out, assign.ActingEdge{Node: e.partNode, Part: e.part, Fp: e.fp, Step: seatdef.StepPlace}) - } - } - if unread[node] { - out = append(out, assign.ActingEdge{Node: node, Part: "the catalog entry", Step: seatdef.StepPlace}) - } - return out - } -} - -// orderWaits keeps the order waits after the pass's wants: it starts the wait of each edge not met, -// ends the wait of one that ran, was replaced or was released, and says each. -func (p *passer) orderWaits(ctx context.Context, n assign.Nodes, wanted map[string]map[string]mwc.Want) { - if p.kvs[buckets.Waits()] == nil { - return - } - now := p.clock() - kept := p.w.read(buckets.Waits()) - trunk := p.w.trunk() - if p.orderSaid == nil { - p.orderSaid = map[string]bool{} - } - standing := map[string]bool{} - for key, e := range p.orders { - if w, ok := wanted[e.module][e.node]; ok && !w.Removed && w.Fp == e.entry { - continue - } - if p.orderRuns(n, e) { - continue - } - standing[key] = true - if raw := kept[key]; raw != nil { - if w, err := acting.Decode(raw); err == nil && w.Entry == e.entry && w.Fp == e.fp { - if !w.Released && !p.orderSaid[key] { - // A wait still held after a restart is said again, as wait-held (A-260). - if err := p.wantsSay(seat.EventWaitHeld, acting.Body(w, assignment.Module()), key+"."+e.fp+"."+e.entry+".again"); err != nil { - p.logf("the wait of %s on %s for %s is not said again, and is said at the next pass: %v", e.module, e.node, e.part, err) - } else { - p.orderSaid[key] = true - } - } - p.orderReleaseSaid(ctx, key, w) - continue - } - } - if !n.Online[e.node] { - continue // a node away holds only itself, and its clock has not started (§268) - } - w := acting.Wait{Step: seatdef.StepPlace, Node: e.node, Module: e.module, Part: e.part, PartNode: e.partNode, Fp: e.fp, Entry: e.entry, Order: e.order, - Since: now, ClockFrom: now, Bound: acting.BoundOf(seat.Edge{Step: seatdef.StepPlace}).String()} - if err := p.wantsSay(seat.EventWaitHeld, acting.Body(w, assignment.Module()), key+"."+e.fp+"."+e.entry); err != nil { - p.logf("the wait of %s on %s for %s is not said, and is said at the next pass: %v", e.module, e.node, e.part, err) - continue - } - p.put(ctx, buckets.Waits(), key, func() ([]byte, error) { return acting.Encode(w) }) - p.orderSaid[key] = true - } - for key, raw := range kept { - if !acting.IsOrder(key) || standing[key] { - continue - } - w, err := acting.Decode(raw) - if err != nil { - continue - } - if _, there := trunk[w.Module]; there && !p.orderVisited[w.Module] { - continue // the module was not looked at in this pass (no pipeline passed for it yet): its wait stands as kept - } - how := acting.HowRan - switch e, there := p.orders[key]; { - case w.Released: - how = acting.HowReleased - case there && e.fp != w.Fp, !there && wanted[w.Module][w.Node].Fp != w.Entry: - how = acting.HowReplaced - } - if !w.EndSaid { - body := acting.Body(w, assignment.Module()) - body.How = how - if err := p.wantsSay(seat.EventWaitEnded, body, key+"."+w.Fp+"."+w.Entry+"."+how); err != nil { - p.logf("the end of the wait of %s on %s for %s is not said, and is said at the next pass: %v", w.Module, w.Node, w.Part, err) - continue - } - } - p.remove(ctx, buckets.Waits(), key) - delete(p.orderSaid, key) - } -} - -// orderReleaseSaid says wait-ended of an order wait released by hand, once, and keeps its record so the entry is not held again. -func (p *passer) orderReleaseSaid(ctx context.Context, key string, w acting.Wait) { - if !w.Released || w.EndSaid { - return - } - body := acting.Body(w, assignment.Module()) - body.How = acting.HowReleased - body.By = w.By - if err := p.wantsSay(seat.EventWaitEnded, body, key+"."+w.Fp+"."+w.Entry+"."+acting.HowReleased); err != nil { - p.logf("the release of the wait of %s on %s for %s is not said, and is said at the next pass: %v", w.Module, w.Node, w.Part, err) - return - } - w.EndSaid = true - p.put(ctx, buckets.Waits(), key, func() ([]byte, error) { return acting.Encode(w) }) -} diff --git a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/orderwaits_test.go b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/orderwaits_test.go deleted file mode 100644 index 44b4fdca..00000000 --- a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/orderwaits_test.go +++ /dev/null @@ -1,351 +0,0 @@ -package main - -import ( - "context" - "encoding/json" - "fmt" - "strings" - "testing" - "time" - - mmac "git.novox.be/novox/mesh-contracts/go/clients/meshmoduleassignerclient" - "git.novox.be/novox/mesh-contracts/go/clients/nodeengineclient" - "git.novox.be/novox/mesh-contracts/go/seats/meshbroker" - mma "git.novox.be/novox/mesh-contracts/go/seats/meshmoduleassigner" - "git.novox.be/novox/mesh-contracts/go/seats/nodeengine" - oc "git.novox.be/novox/mesh-contracts/operator-and-conversation/go/seats/operatorchannel" - "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/clients/meshcatalogclient" - mwc "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/clients/meshwantsclient" - "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshcatalog" - "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshdelivery" - meshwants "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshwants" - "git.novox.be/novox/mesh-delivery/modules/mesh-grants/grantsstate" - "git.novox.be/novox/mesh-sdk/go/catalogue" - "git.novox.be/novox/mesh-sdk/go/seatdef" - - "mesh-delivery-assigner/internal/acting" - "mesh-delivery-assigner/internal/assigngraph" - plc "mesh-delivery-assigner/internal/assignment" - "mesh-delivery-assigner/internal/buckets" -) - -// orderFP is a fingerprint of the form the trunk keeps, made of one letter. -func orderFP(c string) string { - return meshcatalogclient.SourcePrefix2 + strings.Repeat(fmt.Sprintf("%x", c[0]&15), 64) -} - -// orderMod is one module of an order test: the fingerprint it runs on ace and the one the trunk holds, the form of its kept data at each -// fingerprint (0: it keeps none), the seats it holds and the source revision of its trunk value. -type orderMod struct { - name string - run, trunk string - forms map[string]int - holds []string - src int64 -} - -type orderFixture struct { - t *testing.T - p *passer - wants *memKV - events []string - bodies []meshwants.Wait - answers chan struct{} -} - -// newOrderFixture is a pass on node ace, which composes its own modules, with each module running its fingerprint healthy, built and -// granted at the trunk's, an older want, the catalog's entries answered and each held seat as the assignments say it. history lists the -// fingerprints of each module by assignment graph revision, oldest first (the objects Reverted reads). -func newOrderFixture(t *testing.T, mods []orderMod, history ...map[string]string) *orderFixture { - t.Helper() - ctx := context.Background() - f := &orderFixture{t: t, wants: &memKV{values: map[string][]byte{}}, answers: make(chan struct{}, 64)} - f.p = newPasser(kvSet{buckets.Wants(): f.wants, buckets.Asks(): &memKV{values: map[string][]byte{}}, buckets.Waits(): &memKV{values: map[string][]byte{}}}, time.Now()) - p := f.p - p.logf = t.Logf - p.say = func(oc.Condition) error { return nil } - p.publishWants = func(event string, body any, id string) error { - f.events = append(f.events, event) - f.bodies = append(f.bodies, body.(meshwants.Wait)) - return nil - } - digest := "sha256:" + strings.Repeat("c", 64) - pl := mma.Assignments{Node: "ace"} - forms := map[string]int{} // by fingerprint: each module's own - modules := []string{} - for _, m := range mods { - modules = append(modules, m.name) - pl.Modules = append(pl.Modules, mma.PlacedModule{Module: m.name}) - for _, seat := range m.holds { - scope := "node" - if seat != catalogue.BackupSeat && seat != nodeengine.Seat { - scope = "mesh" - } - pl.Holds = append(pl.Holds, mma.Holding{Claim: seat, Module: m.name, Scope: scope}) - } - for fp, form := range m.forms { - forms[fp] = form - } - mdigest := fmt.Sprintf("%064x", len(modules)) - mod, _ := meshcatalogclient.EncodeModule(meshcatalog.ModulesByModuleValue{Fp2: m.trunk, Manifest: mdigest, Repository: "novox/" + m.name, Commit: strings.Repeat("1", 40), Path: meshcatalogclient.RootPath, Src: m.src}) - putModuleRaw(p.w, trunkBranch, m.name, mod) - p.w.manifests[mdigest] = parsed{module: m.name, manifest: catalogue.Manifest{Module: m.name}} - endDone(t, p.w, m.name, m.trunk, mdigest) - gkey, _ := grantsstate.PartGrantKey(m.name, m.trunk) - grant, _ := grantsstate.EncodeGrant(grantsstate.Grant{}) - p.w.put(buckets.Grants, gkey, grant) - f.runs(m.name, m.run) - wkey, _ := mwc.WantKey("ace", m.name) - old, _ := mwc.EncodeWant(mwc.Want{Fp: m.run, Self: true}) - p.w.put(buckets.Wants(), wkey, old) - f.wants.values[wkey] = old - } - composes(t, p.w, "ace", digest) - values, err := mmac.AssignmentsValues(pl) - if err != nil { - t.Fatal(err) - } - for key, raw := range values { - p.w.put(plc.AssignmentsBucket(), key, raw) - } - p.w.heardPresence("ace", false, time.Now()) // ace is online: its last presence event heard is machine-back - objects := memObjects{} - for i, at := range history { - half := meshcatalogclient.Half{Revision: meshcatalog.CatalogRevision{Branch: trunkBranch, Kind: "trunk", Revision: int64(i + 1), Source: int64(i + 1)}, - Entries: map[string]meshcatalog.CatalogEntry{}} - for _, module := range modules { - digest := fmt.Sprintf("sha256:%064x", (i+1)*1000+len(half.Entries)) - half.Revision.Entries = append(half.Revision.Entries, meshcatalog.EntryRef{Module: module, Digest: digest}) - half.Entries[module] = meshcatalog.CatalogEntry{Module: module, Fp: at[module]} - } - placed := mma.Assignments{Node: "ace"} - for _, module := range modules { - placed.Modules = append(placed.Modules, mma.PlacedModule{Module: module}) - } - in := assigngraph.Inputs{Halves: map[string]meshcatalogclient.Half{trunkBranch: half}, FirstBranch: func(string) string { return trunkBranch }, - Placements: map[string]mma.Assignments{"ace": placed}} - if _, _, err := assigngraph.Keep(ctx, objects, assigngraph.Compute(in), "test", time.Now()); err != nil { - t.Fatal(err) - } - } - p.graph = &graphKeeper{objects: objects} - p.entries = meshcatalogclient.NewEntries(func(_ string, body any) (json.RawMessage, error) { - in := body.(meshcatalog.EntryInput) - entry := meshcatalog.CatalogEntry{Module: "m", Fp: in.Fingerprint, Manifest: map[string]any{"module": "m"}} - if form := forms[in.Fingerprint]; form > 0 { - entry.Manifest = map[string]any{"module": "m", "state": []any{map[string]any{"name": "sessions", "form": form}}} - } - return json.Marshal(meshcatalog.EntryAnswer{Entry: entry}) - }) - p.entries.Changed = func(meshcatalogclient.EntryRow) { f.answers <- struct{}{} } - return f -} - -// runs says module runs fp healthy on ace, heard as the node-engine seat's running and in the have. -func (f *orderFixture) runs(module, fp string) { - have, _ := nodeengineclient.EncodeHave(nodeengine.HaveByNodeModuleValue{Fp: fp, Composed: "sha256:" + strings.Repeat("c", 64), Phase: nodeengineclient.PhaseRunning, Health: nodeengineclient.HealthOK}) - f.p.w.put(buckets.Have, "ace."+module, have) - f.p.w.running["ace."+module] = nodeengine.Running{Node: "ace", Module: module, Fingerprint: fp} -} - -// pass makes a pass, and after it every catalog entry it asked is answered. -func (f *orderFixture) pass() { - f.t.Helper() - f.p.wants(context.Background()) - asked := 0 - for _, row := range f.p.entries.Rows() { - if row.State == meshcatalogclient.EntryAsked { - asked++ - } - } - for range asked { - select { - case <-f.answers: - case <-time.After(10 * time.Second): // a bound on a failure only: the answers come at once - f.t.Fatal("an entry asked was not answered") - } - } -} - -// wantAt is the fingerprint module is wanted at on ace. -func (f *orderFixture) wantAt(module string) string { - f.t.Helper() - key, _ := mwc.WantKey("ace", module) - w, err := mwc.DecodeWant(f.wants.values[key]) - if err != nil { - f.t.Fatal(err) - } - return w.Fp -} - -func (f *orderFixture) waits() []string { - var out []string - for key := range f.p.w.read(buckets.Waits()) { - if acting.IsOrder(key) { - out = append(out, key) - } - } - return out -} - -// Design 47 G §298 first edge, A-258, A-259: a module whose kept data's form changes is not moved until the new version of the node-backup -// holder and of the holder of the seat mesh-broker run; the wait is kept under `order.` in the state waits, said as wait-held, and ends -// ran (wait-ended) when the holders run; a module whose kept data keeps its form is moved at once. -func TestAModuleWhoseKeptDataChangesFormWaitsForTheNewBackupHolderAndTheBusModule(t *testing.T) { - f := newOrderFixture(t, []orderMod{ - {name: "web", run: orderFP("a"), trunk: orderFP("b"), forms: map[string]int{orderFP("a"): 1, orderFP("b"): 2}}, - {name: "plain", run: orderFP("c"), trunk: orderFP("d"), forms: map[string]int{orderFP("c"): 1, orderFP("d"): 1}}, - {name: "backup", run: orderFP("e"), trunk: orderFP("f"), holds: []string{catalogue.BackupSeat}}, - {name: "bus", run: orderFP("g"), trunk: orderFP("h"), holds: []string{meshbroker.Seat}}, - }) - f.pass() // the entries are asked: no want crosses a form change unread - if got := f.wantAt("web"); got != orderFP("a") { - t.Fatalf("web is wanted at %s before the entries are read", got) - } - f.pass() - if got := f.wantAt("web"); got != orderFP("a") { - t.Fatalf("web moved across a form change at %s while the new node-backup holder and bus module do not run", got) - } - if got := f.wantAt("plain"); got != orderFP("d") { - t.Errorf("a module whose kept data keeps its form is wanted at %s, not moved", got) - } - if len(f.waits()) != 2 || len(f.events) != 2 || f.events[0] != meshwants.EventWaitHeld || f.bodies[0].Step != seatdef.StepPlace || f.bodies[0].Module != "web" { - t.Fatalf("waits %v events %v bodies %+v: want two wait-held in the step place, `order.ace.web.backup` and `order.ace.web.bus`", f.waits(), f.events, f.bodies) - } - if _, err := acting.Decode(f.p.w.read(buckets.Waits())[acting.OrderKey("ace", "web", "backup")]); err != nil { - t.Fatalf("the wait is not kept under its key: %v", err) - } - f.pass() - if len(f.events) != 2 { - t.Fatalf("a pass that changed nothing said %v", f.events) - } - f.runs("backup", orderFP("f")) - f.pass() - if got := f.wantAt("web"); got != orderFP("a") || len(f.events) != 3 || f.events[2] != meshwants.EventWaitEnded || f.bodies[2].How != acting.HowRan { - t.Fatalf("with the bus module still old: web at %s, events %v", got, f.events) - } - f.runs("bus", orderFP("h")) - f.pass() - f.pass() - if got := f.wantAt("web"); got != orderFP("b") || len(f.waits()) != 0 || len(f.events) != 4 { - t.Fatalf("with both running: web at %s, waits %v, events %v", got, f.waits(), f.events) - } -} - -// §298 first edge, the hand: assigner_waits reads an order wait and assigner_release with how `now` lets the module move. -func TestAnOrderWaitIsReadAndReleasedByTheExistingTools(t *testing.T) { - f := newOrderFixture(t, []orderMod{ - {name: "web", run: orderFP("a"), trunk: orderFP("b"), forms: map[string]int{orderFP("a"): 1, orderFP("b"): 2}}, - {name: "backup", run: orderFP("e"), trunk: orderFP("f"), holds: []string{catalogue.BackupSeat}}, - }) - f.pass() - f.pass() - var acts []string - s := newPutTools(memStore{waitsState: f.p.kvs[buckets.Waits()].(*memKV)}, func(key string, body any) (json.RawMessage, error) { - acts = append(acts, key) - return json.RawMessage(`{"ok":true,"log":"logged"}`), nil - }) - got, err := s.doWaits(map[string]any{"module": "web"}) - if list := got.(map[string]any)["waits"].([]any); err != nil || len(list) != 1 || list[0].(actingSaid).Key != "order.ace.web.backup" { - t.Fatalf("assigner_waits = %+v %v", got, err) - } - if _, err := s.doRelease(map[string]any{"node": "ace", "module": "web", "how": "now", "why": "the restore point is taken by hand"}, "shanks.node-tools"); err != nil || len(acts) == 0 { - t.Fatalf("%v %v", err, acts) - } - f.p.w.put(buckets.Waits(), "order.ace.web.backup", f.p.kvs[buckets.Waits()].(*memKV).values["order.ace.web.backup"]) - f.pass() - f.pass() - if got := f.wantAt("web"); got != orderFP("b") || f.bodies[len(f.bodies)-1].How != acting.HowReleased { - t.Fatalf("after the release: web at %s, last %+v", got, f.bodies[len(f.bodies)-1]) - } -} - -// §298 second edge, A-259: at a revert the node-engine goes back last on its node, after every module that is set back there across a -// form change runs the reverted build. -func TestAtARevertTheNodeEngineGoesBackLast(t *testing.T) { - old, now := map[string]string{"web": orderFP("a"), "engine": orderFP("c")}, map[string]string{"web": orderFP("b"), "engine": orderFP("d")} - f := newOrderFixture(t, []orderMod{ - {name: "web", run: orderFP("b"), trunk: orderFP("a"), forms: map[string]int{orderFP("a"): 1, orderFP("b"): 2}}, - {name: "engine", run: orderFP("d"), trunk: orderFP("c"), holds: []string{nodeengine.Seat}}, - }, old, now) - f.pass() - f.pass() - if f.wantAt("web") != orderFP("a") { - t.Fatalf("web is wanted at %s: the module set back is not held", f.wantAt("web")) - } - if got := f.wantAt("engine"); got != orderFP("d") { - t.Fatalf("the node-engine is set back to %s before web runs its reverted build", got) - } - if w := f.waits(); len(w) != 1 || w[0] != "order.ace.engine.web" || f.bodies[len(f.bodies)-1].Module != "engine" { - t.Fatalf("waits %v bodies %+v", w, f.bodies) - } - f.runs("web", orderFP("a")) - f.pass() - f.pass() - if got := f.wantAt("engine"); got != orderFP("c") || len(f.waits()) != 0 { - t.Fatalf("with web back: the node-engine is wanted at %s, waits %v", got, f.waits()) - } -} - -// §298 third edge, A-259, A-260: the reverted assigner and gate are wanted only once the indexer's take-in.taken of the trunk branch names a -// source revision at least the trunk's head (the highest src of the trunk's module values). -func TestTheRevertedAssignerAndGateWaitForTheIndexerToTakeInTheTrunksHead(t *testing.T) { - old, now := map[string]string{"asg": orderFP("a"), "gate": orderFP("c"), "idx": orderFP("e")}, map[string]string{"asg": orderFP("b"), "gate": orderFP("d"), "idx": orderFP("f")} - f := newOrderFixture(t, []orderMod{ - {name: "asg", run: orderFP("b"), trunk: orderFP("a"), holds: []string{mma.Seat}, src: 6}, - {name: "gate", run: orderFP("d"), trunk: orderFP("c"), holds: []string{meshdelivery.Seat}, src: 7}, - {name: "idx", run: orderFP("e"), trunk: orderFP("e"), src: 7}, - }, old, now) - f.pass() - f.pass() - if f.wantAt("asg") != orderFP("b") || f.wantAt("gate") != orderFP("d") { - t.Fatalf("the reverted assigner (%s) and gate (%s) are wanted before the head is taken in", f.wantAt("asg"), f.wantAt("gate")) - } - if len(f.waits()) != 2 || f.bodies[0].Part != "mesh-delivery-indexer" { - t.Fatalf("waits %v bodies %+v", f.waits(), f.bodies) - } - taken := func(branch string, source int64) { - raw, _ := json.Marshal(meshcatalog.TakeInTaken{Kind: "taken", Key: "m.1", Branch: branch, Source: source}) - if err := f.p.w.taken.put(raw); err != nil { - t.Fatal(err) - } - } - taken("beta", 9) // another branch, and - taken(trunkBranch, 6) - f.pass() - if f.wantAt("asg") != orderFP("b") { - t.Fatal("a source revision before the trunk's head was taken in, and the assigner was wanted") - } - taken(trunkBranch, 7) - f.pass() - f.pass() - if f.wantAt("asg") != orderFP("a") || f.wantAt("gate") != orderFP("c") || len(f.waits()) != 0 { - t.Fatalf("after the head is taken in: asg %s gate %s waits %v", f.wantAt("asg"), f.wantAt("gate"), f.waits()) - } -} - -// A-260: an order wait still held after a restart is said again as wait-held, by a pass that remembers nothing, and ends at the next -// take-in.taken that names the trunk's head. -func TestAnOrderWaitHeldAfterARestartIsSaidAgain(t *testing.T) { - old, now := map[string]string{"asg": orderFP("a")}, map[string]string{"asg": orderFP("b")} - f := newOrderFixture(t, []orderMod{{name: "asg", run: orderFP("b"), trunk: orderFP("a"), holds: []string{mma.Seat}, src: 7}}, old, now) - f.pass() - f.pass() - if len(f.events) != 1 { - t.Fatalf("events %v", f.events) - } - f.p.orderSaid = nil // a process started again - f.pass() - if len(f.events) != 2 || f.events[1] != meshwants.EventWaitHeld || len(f.waits()) != 1 { - t.Fatalf("events %v waits %v", f.events, f.waits()) - } - raw, _ := json.Marshal(meshcatalog.TakeInTaken{Kind: "taken", Key: "m.1", Branch: trunkBranch, Source: 8}) - if err := f.p.w.taken.put(raw); err != nil { - t.Fatal(err) - } - f.pass() - f.pass() - if f.wantAt("asg") != orderFP("a") || len(f.waits()) != 0 || f.events[len(f.events)-1] != meshwants.EventWaitEnded { - t.Fatalf("asg at %s, waits %v, events %v", f.wantAt("asg"), f.waits(), f.events) - } -} diff --git a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/outside_tools.go b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/outside_tools.go index a65b2a87..2209af6c 100644 --- a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/outside_tools.go +++ b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/outside_tools.go @@ -11,7 +11,6 @@ import ( "git.novox.be/novox/mesh-contracts/health-and-repair/go/clients/meshhandactsclient" stdio "git.novox.be/novox/mesh-sdk/go" - "mesh-delivery-assigner/internal/acting" "mesh-delivery-assigner/internal/buckets" "mesh-delivery-assigner/internal/outside" ) @@ -34,13 +33,6 @@ type waitSaid struct { BoundEnds string `json:"bound-ends,omitempty"` } -// actingSaid is one order wait as assigner_waits answers it (orderwaits.go). -type actingSaid struct { - Key string `json:"key"` - acting.Wait - BoundEnds string `json:"bound-ends,omitempty"` -} - // doWaits is the tool assigner_waits. func (s *putTools) doWaits(args map[string]any) (any, error) { keys, err := s.st.keys(waitsState) @@ -54,16 +46,6 @@ func (s *putTools) doWaits(args map[string]any) (any, error) { if err != nil || !found { continue } - if acting.IsOrder(key) { - if a, err := acting.Decode(raw); err == nil && (arg(args, "node") == "" || a.Node == arg(args, "node")) && (arg(args, "module") == "" || a.Module == arg(args, "module")) { - said := actingSaid{Key: key, Wait: a} - if d, err := time.ParseDuration(a.Bound); err == nil && !a.Released { - said.BoundEnds = a.ClockFrom.Add(d).UTC().Format("2006-01-02T15:04:05Z") - } - out = append(out, said) - } - continue - } w, err := outside.Decode(raw) if err != nil || (arg(args, "node") != "" && w.Node != arg(args, "node")) || (arg(args, "module") != "" && w.Module != arg(args, "module")) { continue @@ -83,9 +65,6 @@ func (s *putTools) doWaits(args map[string]any) (any, error) { // module, which the assigner's process takes at its next pass. func (s *putTools) doReleaseWait(args map[string]any, by string) (any, error) { node, module, how, why := arg(args, "node"), arg(args, "module"), arg(args, "how"), arg(args, "why") - if how == acting.HowNow { - return s.doReleaseActing(node, module, why, by) - } if !slices.Contains([]string{outside.HowGoOn, outside.HowFailed, outside.HowRejudge}, how) { return nil, fmt.Errorf("how is %s, %s or %s, not %q", outside.HowGoOn, outside.HowFailed, outside.HowRejudge, how) } @@ -131,61 +110,9 @@ func (s *putTools) doReleaseWait(args map[string]any, by string) (any, error) { return map[string]any{"released": key, "how": how, "by": by, "hand-act": taken.Log}, nil } -// doReleaseActing is assigner_release with how `now`: the entry of module on node moves with its order parts' running versions. The -// hand act is recorded first; the release is written on each standing wait of the entry, and the process says wait-ended at its next pass. -func (s *putTools) doReleaseActing(node, module, why, by string) (any, error) { - if why == "" { - return nil, errors.New("release says why: it is kept in the hand-act log") - } - keys, err := s.st.keys(waitsState) - if err != nil { - return nil, fmt.Errorf("the waits cannot be listed: %w", err) - } - type one struct { - key string - w acting.Wait - } - var held []one - orderPrefix := acting.OrderPrefix + node + "." + module + "." - for _, k := range keys { - if !strings.HasPrefix(k, orderPrefix) { - continue - } - raw, _, found, err := s.st.get(waitsState, k) - if err != nil || !found { - continue - } - if w, err := acting.Decode(raw); err == nil && !w.Released { - held = append(held, one{k, w}) - } - } - if len(held) == 0 { - return nil, fmt.Errorf("%s holds no order wait of %s: assigner_waits lists them", node, module) - } - rec := meshhandactsclient.Recorder{Ask: s.ask} - taken, err := rec.Record(meshhandactsclient.Request{What: fmt.Sprintf("assigner_release %s %s %s", node, module, acting.HowNow), Why: why, - Cause: "order-wait", Verb: "mesh-wants.assigner_release"}) - if err != nil { - return nil, fmt.Errorf("the hand act could not be recorded, so nothing was released: %w", err) - } - released := []string{} - for _, h := range held { - h.w.Released, h.w.By, h.w.Why = true, by+": "+why, why - data, err := acting.Encode(h.w) - if err != nil { - return nil, err - } - if err := s.st.put(waitsState, h.key, data); err != nil { - return nil, fmt.Errorf("the release of %s on %s is not written: %w", module, node, err) - } - released = append(released, h.key) - } - return map[string]any{"released": released, "how": acting.HowNow, "by": by, "hand-act": taken.Log}, nil -} - // waitsTool is assigner_waits as the runtime serves it. func (s *putTools) waitsTool() stdio.Tool { - return stdio.Tool{Name: toolWaits, Description: "Every wait of the delivery and where it stands: an entry waiting in placing for the order of a delivery (§298), with its part, version, step, clock-from and bound; and a moved module's failing health check on a " + + return stdio.Tool{Name: toolWaits, Description: "Every wait of the delivery and where it stands: a moved module's failing health check on a " + "machine whose open conditions name a cause outside the delivery (design 47 G §706), with its module, machine, fingerprint, the " + "condition's key, what it stands `on`, its clock-from, bound, its ask and its state; a settle shows as settling with its end. Narrowed by " + "machine or module. Read-only.", diff --git a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/pass.go b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/pass.go index c205946d..b665e4b9 100644 --- a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/pass.go +++ b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/pass.go @@ -120,11 +120,6 @@ type passer struct { publishWants publisher // graph keeps the assignment graph revision the wants follow (graphkept.go, design 47 G §292, A-67); nil: none is kept. graph *graphKeeper - // orders are §298's order edges computed in this pass, by their wait's key, and orderVisited the modules they were computed for (orderwaits.go). - orders map[string]orderEdge - orderVisited map[string]bool - // orderSaid are the order waits whose wait-held this process said. - orderSaid map[string]bool // entries are the catalog entries by fingerprint asked of the seat mesh-catalog's verb `entry` (design 47 G §614, A-217): a // held revert's running entry and its want's (revert.go); nil: no revert is asked about. entries *meshcatalogclient.Entries @@ -314,9 +309,6 @@ func (p *passer) wants(ctx context.Context) { defer func() { p.sayNeither(neither, stale, left) }() // Where grants are read from, once for the pass: the grants part's (issue 774, ADR 0571 clause 9). grants := p.w.grantsBucket() - released := p.orderReleased() - p.orders, p.orderVisited = map[string]orderEdge{}, map[string]bool{} - defer func() { p.orderWaits(ctx, viewOf(p.w.trunkName()).nodes, wanted) }() for name := range names { groups := p.groups(name, nodesOf[name], assignedBranches[name]) for gi, g := range groups { @@ -410,8 +402,6 @@ func (p *passer) wants(ctx context.Context) { m.MachineHeld = p.outside.Held nodes = p.outsideReview(ctx, name, fp, m.Nodes, nodes, manifests[name].ClaimsSeat(mcseat.Seat), p.movedTo(wanted, nodes)) } - unread := p.orderEdgesOf(ctx, m, wantedOf[name], trunk) - m.Acting = p.orderActing(name, released, unread, func() assign.Nodes { return nodes }) out := assign.Wants(m, nodes, wantedOf[name], last) p.sayWhy(ctx, name, m.Nodes, wantWhy{Branch: g.branch, Fp: fp, Step: whyRules}, wantedOf[name], &out, &m) p.sayParts(name, m, nodes, out, wantedOf[name]) diff --git a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/placeorder_test.go b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/placeorder_test.go new file mode 100644 index 00000000..761b7271 --- /dev/null +++ b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/placeorder_test.go @@ -0,0 +1,200 @@ +package main + +import ( + "context" + "encoding/json" + "fmt" + "strings" + "testing" + "time" + + mmac "git.novox.be/novox/mesh-contracts/go/clients/meshmoduleassignerclient" + "git.novox.be/novox/mesh-contracts/go/clients/nodeengineclient" + "git.novox.be/novox/mesh-contracts/go/seats/meshbroker" + mma "git.novox.be/novox/mesh-contracts/go/seats/meshmoduleassigner" + "git.novox.be/novox/mesh-contracts/go/seats/nodeengine" + oc "git.novox.be/novox/mesh-contracts/operator-and-conversation/go/seats/operatorchannel" + "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/clients/meshcatalogclient" + mwc "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/clients/meshwantsclient" + "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshcatalog" + meshwants "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshwants" + "git.novox.be/novox/mesh-delivery/modules/mesh-grants/grantsstate" + "git.novox.be/novox/mesh-sdk/go/catalogue" + + "mesh-delivery-assigner/internal/assigngraph" + plc "mesh-delivery-assigner/internal/assignment" + "mesh-delivery-assigner/internal/buckets" +) + +// orderFP is a fingerprint of the form the trunk keeps, made of one letter. +func orderFP(c string) string { + return meshcatalogclient.SourcePrefix2 + strings.Repeat(fmt.Sprintf("%x", c[0]&15), 64) +} + +// orderMod is one module of an order test: the fingerprint it runs on ace and the one the trunk holds, the form of its kept data at each +// fingerprint (0: it keeps none), the seats it holds and the source revision of its trunk value. +type orderMod struct { + name string + run, trunk string + forms map[string]int + holds []string + src int64 +} + +type orderFixture struct { + t *testing.T + p *passer + wants *memKV + events []string + bodies []meshwants.Wait + answers chan struct{} +} + +// newOrderFixture is a pass on node ace, which composes its own modules, with each module running its fingerprint healthy, built and +// granted at the trunk's, an older want, the catalog's entries answered and each held seat as the assignments say it. history lists the +// fingerprints of each module by assignment graph revision, oldest first (the objects Reverted reads). +func newOrderFixture(t *testing.T, mods []orderMod, history ...map[string]string) *orderFixture { + t.Helper() + ctx := context.Background() + f := &orderFixture{t: t, wants: &memKV{values: map[string][]byte{}}, answers: make(chan struct{}, 64)} + f.p = newPasser(kvSet{buckets.Wants(): f.wants, buckets.Asks(): &memKV{values: map[string][]byte{}}, buckets.Waits(): &memKV{values: map[string][]byte{}}}, time.Now()) + p := f.p + p.logf = t.Logf + p.say = func(oc.Condition) error { return nil } + p.publishWants = func(event string, body any, id string) error { + f.events = append(f.events, event) + f.bodies = append(f.bodies, body.(meshwants.Wait)) + return nil + } + digest := "sha256:" + strings.Repeat("c", 64) + pl := mma.Assignments{Node: "ace"} + forms := map[string]int{} // by fingerprint: each module's own + modules := []string{} + for _, m := range mods { + modules = append(modules, m.name) + pl.Modules = append(pl.Modules, mma.PlacedModule{Module: m.name}) + for _, seat := range m.holds { + scope := "node" + if seat != catalogue.BackupSeat && seat != nodeengine.Seat { + scope = "mesh" + } + pl.Holds = append(pl.Holds, mma.Holding{Claim: seat, Module: m.name, Scope: scope}) + } + for fp, form := range m.forms { + forms[fp] = form + } + mdigest := fmt.Sprintf("%064x", len(modules)) + mod, _ := meshcatalogclient.EncodeModule(meshcatalog.ModulesByModuleValue{Fp2: m.trunk, Manifest: mdigest, Repository: "novox/" + m.name, Commit: strings.Repeat("1", 40), Path: meshcatalogclient.RootPath, Src: m.src}) + putModuleRaw(p.w, trunkBranch, m.name, mod) + p.w.manifests[mdigest] = parsed{module: m.name, manifest: catalogue.Manifest{Module: m.name}} + endDone(t, p.w, m.name, m.trunk, mdigest) + gkey, _ := grantsstate.PartGrantKey(m.name, m.trunk) + grant, _ := grantsstate.EncodeGrant(grantsstate.Grant{}) + p.w.put(buckets.Grants, gkey, grant) + f.runs(m.name, m.run) + wkey, _ := mwc.WantKey("ace", m.name) + old, _ := mwc.EncodeWant(mwc.Want{Fp: m.run, Self: true}) + p.w.put(buckets.Wants(), wkey, old) + f.wants.values[wkey] = old + } + composes(t, p.w, "ace", digest) + values, err := mmac.AssignmentsValues(pl) + if err != nil { + t.Fatal(err) + } + for key, raw := range values { + p.w.put(plc.AssignmentsBucket(), key, raw) + } + p.w.heardPresence("ace", false, time.Now()) // ace is online: its last presence event heard is machine-back + objects := memObjects{} + for i, at := range history { + half := meshcatalogclient.Half{Revision: meshcatalog.CatalogRevision{Branch: trunkBranch, Kind: "trunk", Revision: int64(i + 1), Source: int64(i + 1)}, + Entries: map[string]meshcatalog.CatalogEntry{}} + for _, module := range modules { + digest := fmt.Sprintf("sha256:%064x", (i+1)*1000+len(half.Entries)) + half.Revision.Entries = append(half.Revision.Entries, meshcatalog.EntryRef{Module: module, Digest: digest}) + half.Entries[module] = meshcatalog.CatalogEntry{Module: module, Fp: at[module]} + } + placed := mma.Assignments{Node: "ace"} + for _, module := range modules { + placed.Modules = append(placed.Modules, mma.PlacedModule{Module: module}) + } + in := assigngraph.Inputs{Halves: map[string]meshcatalogclient.Half{trunkBranch: half}, FirstBranch: func(string) string { return trunkBranch }, + Placements: map[string]mma.Assignments{"ace": placed}} + if _, _, err := assigngraph.Keep(ctx, objects, assigngraph.Compute(in), "test", time.Now()); err != nil { + t.Fatal(err) + } + } + p.graph = &graphKeeper{objects: objects} + p.entries = meshcatalogclient.NewEntries(func(_ string, body any) (json.RawMessage, error) { + in := body.(meshcatalog.EntryInput) + entry := meshcatalog.CatalogEntry{Module: "m", Fp: in.Fingerprint, Manifest: map[string]any{"module": "m"}} + if form := forms[in.Fingerprint]; form > 0 { + entry.Manifest = map[string]any{"module": "m", "state": []any{map[string]any{"name": "sessions", "form": form}}} + } + return json.Marshal(meshcatalog.EntryAnswer{Entry: entry}) + }) + p.entries.Changed = func(meshcatalogclient.EntryRow) { f.answers <- struct{}{} } + return f +} + +// runs says module runs fp healthy on ace, heard as the node-engine seat's running and in the have. +func (f *orderFixture) runs(module, fp string) { + have, _ := nodeengineclient.EncodeHave(nodeengine.HaveByNodeModuleValue{Fp: fp, Composed: "sha256:" + strings.Repeat("c", 64), Phase: nodeengineclient.PhaseRunning, Health: nodeengineclient.HealthOK}) + f.p.w.put(buckets.Have, "ace."+module, have) + f.p.w.running["ace."+module] = nodeengine.Running{Node: "ace", Module: module, Fingerprint: fp} +} + +// pass makes a pass, and after it every catalog entry it asked is answered. +func (f *orderFixture) pass() { + f.t.Helper() + f.p.wants(context.Background()) + asked := 0 + for _, row := range f.p.entries.Rows() { + if row.State == meshcatalogclient.EntryAsked { + asked++ + } + } + for range asked { + select { + case <-f.answers: + case <-time.After(10 * time.Second): // a bound on a failure only: the answers come at once + f.t.Fatal("an entry asked was not answered") + } + } +} + +// wantAt is the fingerprint module is wanted at on ace. +func (f *orderFixture) wantAt(module string) string { + f.t.Helper() + key, _ := mwc.WantKey("ace", module) + w, err := mwc.DecodeWant(f.wants.values[key]) + if err != nil { + f.t.Fatal(err) + } + return w.Fp +} + +func (f *orderFixture) waits() []string { + var out []string + for key := range f.p.w.read(buckets.Waits()) { + out = append(out, key) + } + return out +} + +// A3/AC1 (design 47 H §771, §764): given a module whose kept data's form changes while the new versions of the node-backup holder and +// of the bus module do not run, when the assigner passes, then the module is wanted at its new version, no `order.` key is kept and no +// wait is said: the order on a machine is its node-engine's apply order, by rank. +func TestNoWantWaitsForTheOrderOfADelivery(t *testing.T) { + f := newOrderFixture(t, []orderMod{ + {name: "web", run: orderFP("a"), trunk: orderFP("b"), forms: map[string]int{orderFP("a"): 1, orderFP("b"): 2}}, + {name: "backup", run: orderFP("e"), trunk: orderFP("f"), holds: []string{catalogue.BackupSeat}}, + {name: "bus", run: orderFP("g"), trunk: orderFP("h"), holds: []string{meshbroker.Seat}}, + }) + f.pass() + f.pass() + if got := f.wantAt("web"); got != orderFP("b") || len(f.waits()) != 0 || len(f.events) != 0 { + t.Fatalf("web at %s, waits %v, events %v: want web at its new version, no wait kept or said", got, f.waits(), f.events) + } +} diff --git a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/tools.go b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/tools.go index 892e88ad..8caf8846 100644 --- a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/tools.go +++ b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/tools.go @@ -346,7 +346,7 @@ func (s *putTools) tools() []stdio.Tool { "rules write the machine's want again from their next pass. Nothing changes on the machine until they move it.", Input: schema(map[string]string{"node": "the machine", "module": "the module", "why": "why, kept with the put", "how": "with how, the wait of the delivery on an outside cause (assigner_waits) is released, not a put: go-on (the module counts healthy there), " + - "failed (the failing check is the delivery's), rejudge (judge it again now), or now (the entry waiting in placing for an order part's version moves with the running one); written in the hand-act log first"}, + "failed (the failing check is the delivery's), or rejudge (judge it again now); written in the hand-act log first"}, []string{"module", "why"}), Run: func(a map[string]any) (any, error) { return s.doRelease(a, stdio.CallerOf(a)) }}, s.waitsTool(), diff --git a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/why.go b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/why.go index 6f959387..ce6e58d4 100644 --- a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/why.go +++ b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/why.go @@ -43,10 +43,9 @@ type wantWhy struct { // Rule is the rule holding the node back from Fp, with its words. Rule string `json:"rule,omitempty"` // What the rules read of the module. - Built, BuildFailed, Held, Granted, Released, Kept bool `json:",omitempty"` - BuildError string `json:"build-error,omitempty"` - Acting []string `json:"acting,omitempty"` - Words string `json:"words,omitempty"` + Built, BuildFailed, Held, Granted, Released, Kept bool `json:",omitempty"` + BuildError string `json:"build-error,omitempty"` + Words string `json:"words,omitempty"` } func whyKey(node, module string) string { return whyPrefix + node + "." + module } @@ -76,11 +75,6 @@ func (p *passer) sayWhy(ctx context.Context, module string, nodes []string, w wa } if m != nil { one.Built, one.BuildFailed, one.BuildError, one.Held, one.Granted, one.Released, one.Kept = m.Built, m.BuildFailed, m.BuildError, m.Held, m.Granted, m.Released, m.Kept - if m.Acting != nil { - for _, e := range m.Acting(node) { - one.Acting = append(one.Acting, e.Step+" "+e.Node+"/"+e.Part+"@"+shortHex(e.Fp)+" (seat "+e.Seat+")") - } - } } same := one same.At = time.Time{} @@ -103,7 +97,7 @@ func (p *passer) sayWhy(ctx context.Context, module string, nodes []string, w wa // whyTools is the tool assigner_why: every want's why, or those of one module or one node. func whyTools(st store) []stdio.Tool { - return []stdio.Tool{{Name: whyTool, Description: "why a want is what it is: per node and module, the step of the assigner's last pass that decided the want (no passed pipeline, or the six rules with the rule holding it back), the fingerprint the trunk names, the want before and the one written, and what the rules read (built, held, granted, acting waits). A time that stands still says the pass no longer judges that module. Arguments: module and node narrow it.", + return []stdio.Tool{{Name: whyTool, Description: "why a want is what it is: per node and module, the step of the assigner's last pass that decided the want (no passed pipeline, or the six rules with the rule holding it back), the fingerprint the trunk names, the want before and the one written, and what the rules read (built, held, granted). A time that stands still says the pass no longer judges that module. Arguments: module and node narrow it.", Input: schema(map[string]string{"module": "a module's name", "node": "a node's name"}, nil), Run: func(args map[string]any) (any, error) { ks, err := st.keys(writtenState) diff --git a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/world.go b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/world.go index e99b1fe7..3c2d6d5f 100644 --- a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/world.go +++ b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/world.go @@ -45,8 +45,6 @@ type world struct { released releasedVersions // edges are, by watched branch and module, the edges into the module's artifacts its catalog entry names (§374's kinds). edges map[string]map[string][]meshcatalog.Edge - // taken is the newest source revision of each watched branch the indexer's take-in.taken named, as heard (orderwaits.go, §298, A-260). - taken takenSources // assignments is the seat's state assignments assembled node by node from its keys in either form (mesh-sdk // mmac.Keys; research 072 row 37): the one reader of its keys in the assigner. assignmentKeys *mmac.Keys @@ -407,17 +405,6 @@ func (w *world) nodes(manifests map[string]catalogue.Manifest, assigned map[stri n := assign.Nodes{Online: map[string]bool{}, Running: w.runningNow(), Haves: map[string]map[string]nodeengine.HaveByNodeModuleValue{}, Providers: map[string]map[string][]string{}, Reads: map[string][]string{}, Capable: map[string][]string{}} n.Online = w.online() - // The build a running statement names serves an acting edge's seat when its manifest claims it (design 47 G A-426). - n.Serves = func(r nodeengine.Running, seat string) (bool, bool) { - if r.Manifest == "" { - return false, false - } - got := w.manifest(r.Manifest) - if got.err != "" { - return false, false - } - return got.manifest.ClaimsSeat(seat), true - } for key, value := range w.read(buckets.Have) { node, module, isNode, err := nodeengineclient.ParseHaveKey(key) if err != nil { diff --git a/modules/mesh-delivery-assigner/internal/acting/acting.go b/modules/mesh-delivery-assigner/internal/acting/acting.go deleted file mode 100644 index 7906ef24..00000000 --- a/modules/mesh-delivery-assigner/internal/acting/acting.go +++ /dev/null @@ -1,114 +0,0 @@ -// Package acting is the kept record of the assigner's order waits (design 47 G §298): a want held until a part's version runs on a -// node, with the placing step's default bound. No want is held for an acting part's new version (design 47 H §750, §764; H-A-70). -package acting - -import ( - "encoding/json" - "fmt" - "strings" - "time" - - "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshwants" - "git.novox.be/novox/mesh-sdk/go/seatdef" -) - -// HowNow is the `how` of assigner_release for an order wait: the entry is wanted now, with the version running. -const HowNow = "now" - -// The ways a wait ends, as `wait-ended` says them. -const ( - HowRan = "ran" - HowReleased = "released" - HowReplaced = "replaced" -) - -// OrderPrefix opens the key of an order wait (design 47 G §298, A-259): a want held for the order of a delivery that crosses a form change, -// kept in the state `waits` apart from the outside waits' `..`, as `order...`. -const OrderPrefix = "order." - -// The three order edges of §298, as a kept wait's Order names them. -const ( - // OrderBackup: the new versions of the node-backup holder and of the holder of the bus module's seat run before a module whose kept - // data's form changes is moved. - OrderBackup = "backup-and-broker-first" - // OrderEngineLast: at a revert a node's node-engine goes back last on that node. - OrderEngineLast = "node-engine-last" - // OrderTakenIn: the reverted assigner and gate are wanted only once the reverted indexer took in the trunk's head. - OrderTakenIn = "taken-in-first" -) - -// Wait is one wait as kept: Module's entry on Node waits for Part's version Fp to run on PartNode, in Step. -type Wait struct { - V int `json:"v"` - Step string `json:"step"` - Node string `json:"node"` - Module string `json:"module"` - Part string `json:"part"` - PartNode string `json:"part-node"` - Fp string `json:"fp"` - Entry string `json:"entry"` - Since time.Time `json:"since"` - ClockFrom time.Time `json:"clock-from"` - Bound string `json:"bound"` - // Released is a release by hand: the entry moves on with the part's old version; EndSaid says wait-ended was said for it. - // Order is which of §298's edges the wait stands on; empty for an acting wait. - Order string `json:"order,omitempty"` - Released bool `json:"released,omitempty"` - EndSaid bool `json:"end-said,omitempty"` - By string `json:"by,omitempty"` - Why string `json:"why,omitempty"` -} - -// OrderKey is the key of an order wait in the state. -func OrderKey(node, module, part string) string { - return OrderPrefix + node + "." + module + "." + part -} - -// IsOrder says a kept value is an order wait's record. -func IsOrder(key string) bool { return strings.HasPrefix(key, OrderPrefix) } - -// Encode is w as JSON. -func Encode(w Wait) ([]byte, error) { w.V = 1; return json.Marshal(w) } - -// Decode reads a kept wait. -func Decode(raw []byte) (Wait, error) { - var w Wait - if err := json.Unmarshal(raw, &w); err != nil { - return w, err - } - if w.V != 1 || w.Step == "" || w.Node == "" || w.Module == "" || w.Part == "" { - return w, fmt.Errorf("acting: %q is not a kept order wait", raw) - } - return w, nil -} - -// BoundOf is the bound of the edge's wait: its rule's, else its step's default (seatdef.ActingRule.Wait). -func BoundOf(e meshwants.Edge) time.Duration { - return seatdef.ActingRule{Step: e.Step, Bound: e.Bound}.Wait() -} - -// Body is the wait as the seat mesh-wants says it. -func Body(w Wait, owner string) meshwants.Wait { - since, from := w.Since.UTC(), w.ClockFrom.UTC() - return meshwants.Wait{Step: w.Step, Owner: owner, Node: w.Node, Module: w.Module, Part: w.Part, Fp: w.Fp, Since: since, ClockFrom: &from, Bound: w.Bound, - Words: words(w)} -} - -func words(w Wait) string { - switch w.Order { - case OrderBackup: - return fmt.Sprintf("%s on %s moves its kept data across a form change: it waits in %s for %s at %s to run on %s, which the restore point needs", w.Module, w.Node, w.Step, w.Part, short(w.Fp), w.PartNode) - case OrderEngineLast: - return fmt.Sprintf("%s on %s goes back last on its node: it waits in %s for %s at %s to run on %s, restored", w.Module, w.Node, w.Step, w.Part, short(w.Fp), w.PartNode) - case OrderTakenIn: - return fmt.Sprintf("%s on %s goes back only once the indexer took in the trunk's head: it waits in %s for source revision %s to be taken in", w.Module, w.Node, w.Step, w.Fp) - } - return fmt.Sprintf("%s on %s waits in %s for %s at %s to run on %s", w.Module, w.Node, w.Step, w.Part, short(w.Fp), w.PartNode) -} - -func short(fp string) string { - if len(fp) > 19 { - return fp[:19] - } - return fp -} diff --git a/modules/mesh-delivery-assigner/internal/assign/wants.go b/modules/mesh-delivery-assigner/internal/assign/wants.go index c8091c54..96c9e288 100644 --- a/modules/mesh-delivery-assigner/internal/assign/wants.go +++ b/modules/mesh-delivery-assigner/internal/assign/wants.go @@ -101,36 +101,6 @@ type Module struct { // MachineHeld says whether the node's own network condition is open, which holds the machine as a whole: no want moves to it // until that clears (design 47 G §706 *M's own network*). Nil: none is held. MachineHeld func(node string) bool - // Acting are the acting edges of the assignment graph entry of this module on node that the assigner holds (composing, placing) - // and whose wait was not released by hand (design 47 G §266, §268): the want moves only once each acting part's version runs - // on the edge's node, as Nodes.Running says it. Nil: none. - Acting func(node string) []ActingEdge -} - -// ActingEdge is one acting edge: Part's version Fp acts in Step on Node, before the entry moves. -type ActingEdge struct{ Node, Part, Fp, Step, Seat string } - -// Runs says the part's version of the edge runs on its node, as the node-engine seat's `running` says it. -func (n Nodes) Runs(e ActingEdge) bool { - if n.Running != nil { - r, ok := n.Running[e.Node][e.Part] - return ok && !r.Stopped && r.Fingerprint == e.Fp - } - h, ok := n.Haves[e.Node][e.Part] - return ok && healthy(h, e.Fp) -} - -// actingWaiting says why the module's want on node waits for an acting part's new version (§266): the first edge not run. -func (m Module) actingWaiting(node string, n Nodes) (string, bool) { - if m.Acting == nil { - return "", false - } - for _, e := range m.Acting(node) { - if _, runs := n.ActingRuns(e); !runs { - return fmt.Sprintf("%s on %s waits in %s for %s at %s to run on %s", m.Name, node, e.Step, e.Part, short(e.Fp), e.Node), true - } - } - return "", false } // ReadsParts says whether node's node-engine reads a want's version, parts and kept-on: it states WantParts among its record's @@ -213,46 +183,6 @@ type Nodes struct { // Capable is, by node, the capabilities its node-engine states in its node record (nodeengine.NodeRecord.Capabilities): a // node-engine of G states WantParts there (design 47 G §525). Capable map[string][]string - // Serves says whether the build of a running statement serves an acting edge's seat, from that build's manifest: known false - // when its manifest cannot be read (design 47 G A-426). Nil: none is read. - Serves func(r nodeengine.Running, seat string) (serves, known bool) -} - -// ActingRuns says whether an acting edge's part runs a build serving the edge's seat on its node, and which build (design 47 G -// A-426): any running build of the part that serves the seat ends the wait, whatever version its newest is, so a wait on a version -// not yet built is never held for that alone. A build whose manifest cannot be read counts as serving it when it is the part's -// (the part holds the seat by its claim). Without the running statements the have is read as before: the edge's version only. -func (n Nodes) ActingRuns(e ActingEdge) (string, bool) { - if n.Running == nil { - return e.Fp, n.Runs(e) - } - r, ok := n.Running[e.Node][e.Part] - if !ok { - // No running statement names the part on its node: its node-engine states running only of what it applied itself (a - // part placed before, the node-engine itself, or an engine from before G states none), so the part is read from its - // have: a build running there, its health check not failed (such an engine may write no health), ends the wait, - // whatever its version, as a statement would (A-426). Read by the edge's version only, a part placed there waited for - // ever (lead-47 2026-11-16: the indexer on novox for the assigner on ace and novox's own node-engine). - if h, ok := n.Haves[e.Node][e.Part]; ok && h.Fp != "" && h.Phase == nodeengineclient.PhaseRunning && !failed(h) { - return h.Fp, true - } - // The node's own node-engine writes that node's haves and keeps it heard: a node online runs its node-engine, whatever - // phase or health its have of itself says (novox's said held, health unknown, while it composed every other module). - if h, ok := n.Haves[e.Node][e.Part]; ok && e.Seat == nodeengine.Seat && n.Online[e.Node] { - return h.Fp, true - } - return e.Fp, n.Runs(e) - } - if r.Stopped || r.Fingerprint == "" { - return "", false - } - if r.Fingerprint == e.Fp || e.Seat == "" || n.Serves == nil { - return r.Fingerprint, true - } - if serves, known := n.Serves(r, e.Seat); known && !serves { - return "", false - } - return r.Fingerprint, true } // healthy says whether a have runs fp healthy. @@ -320,9 +250,6 @@ func holds(m Module, node string, n Nodes, ordering bool) (bool, int, string) { if _, ok := m.composition(node, m.FP); !ok { return false, mwc.RuleComposed, fmt.Sprintf("%s has named no composition of its own for %s at %s yet", node, m.Name, short(m.FP)) } - if words, waiting := m.actingWaiting(node, n); waiting { - return false, mwc.RuleComposed, words - } if words, waiting := m.provisionWaiting(node); waiting { return false, mwc.RuleProvisions, words } diff --git a/modules/mesh-delivery-assigner/internal/assign/wants_test.go b/modules/mesh-delivery-assigner/internal/assign/wants_test.go index 92b98146..72ca21a7 100644 --- a/modules/mesh-delivery-assigner/internal/assign/wants_test.go +++ b/modules/mesh-delivery-assigner/internal/assign/wants_test.go @@ -1710,39 +1710,3 @@ func TestRuleOneSaysHowTheBuildStands(t *testing.T) { } } } - -// Design 47 G §266, §268 (AS9), A-426: an entry whose acting edge names a step the assigner holds waits, its want held, only while -// the acting part runs nothing that serves the edge's seat on the edge's node: any build of it serving the seat (an older one, a -// hand start) ends the wait at once, a build not serving it or a stopped part holds it, and a released wait is no edge. -func TestAWantWaitsForItsActingPartsNewVersion(t *testing.T) { - edge := ActingEdge{Node: "g14", Part: "mesh-host", Fp: fNew, Step: "compose", Seat: "node-engine"} - run := func(fp string, stopped bool, serves bool) Nodes { - _, n := ready() - n.Running = map[string]map[string]nodeengine.Running{"g14": {"mesh-host": {Fingerprint: fp, Stopped: stopped, Manifest: "m"}}} - n.Serves = func(nodeengine.Running, string) (bool, bool) { return serves, true } - return n - } - m, _ := ready() - m.Acting = func(string) []ActingEdge { return []ActingEdge{edge} } - m.Nodes = []string{"g14"} - out := Wants(m, run("", true, true), wantedOld(), nil) - if out.Wants["g14"].Fp == fNew || out.Rules["g14"].Rule != mwc.RuleComposed || !strings.Contains(out.Rules["g14"].Words, "waits in compose for mesh-host") { - t.Fatalf("the part stopped: want %+v rule %+v", out.Wants["g14"], out.Rules["g14"]) - } - if out := Wants(m, run(fOld, false, false), wantedOld(), nil); out.Wants["g14"].Fp == fNew { - t.Errorf("an old build not serving the seat runs: want %+v", out.Wants["g14"]) - } - if out := Wants(m, run(fOld, false, true), wantedOld(), nil); out.Wants["g14"].Fp != fNew { - t.Errorf("an old build serving the seat runs: want %+v, want the new version moved", out.Wants["g14"]) - } - if took, runs := run(fOld, false, true).ActingRuns(edge); !runs || took != fOld { - t.Errorf("ActingRuns took %q, %v: want the old build it runs", took, runs) - } - if out := Wants(m, run(fNew, false, true), wantedOld(), nil); out.Wants["g14"].Fp != fNew { - t.Errorf("the new version runs: want %+v", out.Wants["g14"]) - } - m.Acting = func(string) []ActingEdge { return nil } // a released wait is no edge - if out := Wants(m, run("", true, true), wantedOld(), nil); out.Wants["g14"].Fp != fNew { - t.Errorf("released: want %+v", out.Wants["g14"]) - } -} diff --git a/modules/mesh-delivery-assigner/manifest_test.go b/modules/mesh-delivery-assigner/manifest_test.go index b1fb71ca..4b89c73f 100644 --- a/modules/mesh-delivery-assigner/manifest_test.go +++ b/modules/mesh-delivery-assigner/manifest_test.go @@ -138,7 +138,7 @@ func TestManifest(t *testing.T) { // issue 1966 note 151: and the teller's ask-ended, its subject the one the assigner hears; §389: the watchman's machine-away // and machine-back, read whole at its start. A1/AC1 (design 47 H §750, §764): no version-delivered, delivery-waits, // delivered-again or assigner_delivered_again: a want waits on no dependency's delivery. - if !slices.Equal(m.Consumes, []string{"mesh-conditions.findings-asked", "mesh-conditions.condition-raised", "mesh-conditions.condition-changed", "mesh-conditions.condition-cleared", "mesh-catalog.catalog-revision", "mesh-catalog.registration-changed", "mesh-delivery.source-moved", "mesh-catalog.version-released", "mesh-watchdogs.machine-away", "mesh-watchdogs.machine-back", "mesh-catalog.seat-definition-changed", "mesh-catalog.seat-definition-removed", builds.BuilderModule + "." + builds.BuildsStreamEvents, buckets.IndexerModule + ".take-in.taken", buckets.TellerModule + "." + tellerevents.AskEnded, buckets.TellerModule + ".views." + buckets.AnswersState, "mesh-pipeline-runner.pipeline-ended", "mesh-pipeline-runner.group-ended", "node-build-go.step-ended", "node-build-go.ask-taken", "node-build-go.step-progress", "node-engine.manifest-reads-changed", "node-engine.running", "mesh-delivery.pinned", "mesh-delivery.freed", "mesh-delivery.heads-replaced", "mesh-delivery.pins-stated"}) { + if !slices.Equal(m.Consumes, []string{"mesh-conditions.findings-asked", "mesh-conditions.condition-raised", "mesh-conditions.condition-changed", "mesh-conditions.condition-cleared", "mesh-catalog.catalog-revision", "mesh-catalog.registration-changed", "mesh-delivery.source-moved", "mesh-catalog.version-released", "mesh-watchdogs.machine-away", "mesh-watchdogs.machine-back", "mesh-catalog.seat-definition-changed", "mesh-catalog.seat-definition-removed", builds.BuilderModule + "." + builds.BuildsStreamEvents, buckets.TellerModule + "." + tellerevents.AskEnded, buckets.TellerModule + ".views." + buckets.AnswersState, "mesh-pipeline-runner.pipeline-ended", "mesh-pipeline-runner.group-ended", "node-build-go.step-ended", "node-build-go.ask-taken", "node-build-go.step-progress", "node-engine.manifest-reads-changed", "node-engine.running", "mesh-delivery.pinned", "mesh-delivery.freed", "mesh-delivery.heads-replaced", "mesh-delivery.pins-stated"}) { t.Errorf("consumes = %v, want the catalog half's revisions (design 47 G §195), the teller's ask-ended, the engines' reads changed and what they run", m.Consumes) } if want := []string{"mesh-delivery-indexer.manifests", "mesh-delivery-indexer.modules", diff --git a/modules/mesh-delivery-assigner/module.json b/modules/mesh-delivery-assigner/module.json index 8e9dbb24..c320bb89 100644 --- a/modules/mesh-delivery-assigner/module.json +++ b/modules/mesh-delivery-assigner/module.json @@ -54,7 +54,6 @@ "mesh-catalog.seat-definition-changed", "mesh-catalog.seat-definition-removed", "mesh-delivery-builder.build.ended.**", - "mesh-delivery-indexer.take-in.taken", "mesh-delivery-teller.ask-ended", "mesh-delivery-teller.views.answers", "mesh-pipeline-runner.pipeline-ended",