From ba2a7d73b721027dbc5199a4b06a12868335fc0a Mon Sep 17 00:00:00 2001 From: jochen Date: Sun, 15 Nov 2026 17:56:58 +0100 Subject: [PATCH] graph: a node may leave out a package's seat call word it does not invoke itself (A-361) The indexer leaves out a package's call word on a cycle (withCallsLeftOut, A-361), but the node check refused a left-out word the module's own invokes do not name: once the node-engine's manifest stopped naming mesh-catalog.registrations (mesh-host #229), the trunk revision the indexer wrote could not be read back, and the indexer stopped at its start. --- modules/mesh-delivery-sdk/graph/graph.go | 6 ++-- modules/mesh-delivery-sdk/graph/graph_test.go | 28 +++++++++++-------- sdk/graph/graph.go | 6 ++-- sdk/graph/graph_test.go | 28 +++++++++++-------- 4 files changed, 42 insertions(+), 26 deletions(-) diff --git a/modules/mesh-delivery-sdk/graph/graph.go b/modules/mesh-delivery-sdk/graph/graph.go index 0b9e78a4..653904f6 100644 --- a/modules/mesh-delivery-sdk/graph/graph.go +++ b/modules/mesh-delivery-sdk/graph/graph.go @@ -171,9 +171,11 @@ func (g Node) check() error { } } } + // A left-out word is an invoked verb or a seat call word of a package the module builds against (A-361), which its + // own invokes need not name; so it is a verb word, invoked or not. for _, l := range g.LeftOut { - if !slices.Contains(g.Invokes, l) { - return fmt.Errorf("graph: the graph node leaves out %q, which it does not invoke", l) + if !isVerb(l) { + return fmt.Errorf("graph: the graph node leaves out %q, which is neither seat:. nor .", l) } } return nil diff --git a/modules/mesh-delivery-sdk/graph/graph_test.go b/modules/mesh-delivery-sdk/graph/graph_test.go index 0d6fc75d..86fedf53 100644 --- a/modules/mesh-delivery-sdk/graph/graph_test.go +++ b/modules/mesh-delivery-sdk/graph/graph_test.go @@ -255,17 +255,17 @@ func nodeValues(t *testing.T) { change func(*Node) word string }{ - "both": {func(g *Node) { g.None = "why" }, "both"}, - "neither": {func(g *Node) { g.FP = "" }, "neither"}, - "an old form": {func(g *Node) { g.FP = "src1:x" }, "src2:"}, - "a dotted base": {func(g *Node) { g.Bases = []string{"a.b"} }, "a.b"}, - "a foreign package": {func(g *Node) { g.Packages = []string{"example.com/x"} }, "example.com/x"}, - "a toolchain of no module": {func(g *Node) { g.Toolchains = map[string]Toolchain{"go": {Version: "go1", Recipe: "1"}} }, "build module"}, - "a toolchain of no recipe": {func(g *Node) { g.Toolchains = map[string]Toolchain{"go": {Module: "b", Version: "go1"}} }, "recipe"}, - "awaiting what it does not require": {func(g *Node) { g.Awaits = []string{"other"} }, "other"}, - "no repository": {func(g *Node) { g.Repository = "" }, "repositor"}, - "leaving out what it does not invoke": {func(g *Node) { g.LeftOut = []string{"x.y"} }, "x.y"}, - "an invoke of no verb": {func(g *Node) { g.Invokes = []string{"seat:nothing"} }, "seat:nothing"}, + "both": {func(g *Node) { g.None = "why" }, "both"}, + "neither": {func(g *Node) { g.FP = "" }, "neither"}, + "an old form": {func(g *Node) { g.FP = "src1:x" }, "src2:"}, + "a dotted base": {func(g *Node) { g.Bases = []string{"a.b"} }, "a.b"}, + "a foreign package": {func(g *Node) { g.Packages = []string{"example.com/x"} }, "example.com/x"}, + "a toolchain of no module": {func(g *Node) { g.Toolchains = map[string]Toolchain{"go": {Version: "go1", Recipe: "1"}} }, "build module"}, + "a toolchain of no recipe": {func(g *Node) { g.Toolchains = map[string]Toolchain{"go": {Module: "b", Version: "go1"}} }, "recipe"}, + "awaiting what it does not require": {func(g *Node) { g.Awaits = []string{"other"} }, "other"}, + "no repository": {func(g *Node) { g.Repository = "" }, "repositor"}, + "leaving out no verb": {func(g *Node) { g.LeftOut = []string{"seat:nothing"} }, "seat:nothing"}, + "an invoke of no verb": {func(g *Node) { g.Invokes = []string{"seat:nothing"} }, "seat:nothing"}, } { g := sampleNode() c.change(&g) @@ -273,6 +273,12 @@ func nodeValues(t *testing.T) { t.Errorf("a node with %s: %v, want it refused naming %q", name, err, c.word) } } + // A-361: a package's seat call word left out on a cycle is kept though the module's own invokes do not name it. + kept := sampleNode() + kept.LeftOut = []string{"seat:mesh-catalog.registrations"} + if _, err := Encode(kept); err != nil { + t.Errorf("a node leaving out a package's call word is refused: %v", err) + } } // readersOfTheSeatList (D-31): a module whose manifest invokes the seat mesh-catalog's seat-definitions waits, by the verb diff --git a/sdk/graph/graph.go b/sdk/graph/graph.go index c8086e93..47e35a3e 100644 --- a/sdk/graph/graph.go +++ b/sdk/graph/graph.go @@ -171,9 +171,11 @@ func (g Node) check() error { } } } + // A left-out word is an invoked verb or a seat call word of a package the module builds against (A-361), which its + // own invokes need not name; so it is a verb word, invoked or not. for _, l := range g.LeftOut { - if !slices.Contains(g.Invokes, l) { - return fmt.Errorf("graph: the graph node leaves out %q, which it does not invoke", l) + if !isVerb(l) { + return fmt.Errorf("graph: the graph node leaves out %q, which is neither seat:. nor .", l) } } return nil diff --git a/sdk/graph/graph_test.go b/sdk/graph/graph_test.go index 54379bba..3573f79a 100644 --- a/sdk/graph/graph_test.go +++ b/sdk/graph/graph_test.go @@ -255,17 +255,17 @@ func nodeValues(t *testing.T) { change func(*Node) word string }{ - "both": {func(g *Node) { g.None = "why" }, "both"}, - "neither": {func(g *Node) { g.FP = "" }, "neither"}, - "an old form": {func(g *Node) { g.FP = "src1:x" }, "src2:"}, - "a dotted base": {func(g *Node) { g.Bases = []string{"a.b"} }, "a.b"}, - "a foreign package": {func(g *Node) { g.Packages = []string{"example.com/x"} }, "example.com/x"}, - "a toolchain of no module": {func(g *Node) { g.Toolchains = map[string]Toolchain{"go": {Version: "go1", Recipe: "1"}} }, "build module"}, - "a toolchain of no recipe": {func(g *Node) { g.Toolchains = map[string]Toolchain{"go": {Module: "b", Version: "go1"}} }, "recipe"}, - "awaiting what it does not require": {func(g *Node) { g.Awaits = []string{"other"} }, "other"}, - "no repository": {func(g *Node) { g.Repository = "" }, "repositor"}, - "leaving out what it does not invoke": {func(g *Node) { g.LeftOut = []string{"x.y"} }, "x.y"}, - "an invoke of no verb": {func(g *Node) { g.Invokes = []string{"seat:nothing"} }, "seat:nothing"}, + "both": {func(g *Node) { g.None = "why" }, "both"}, + "neither": {func(g *Node) { g.FP = "" }, "neither"}, + "an old form": {func(g *Node) { g.FP = "src1:x" }, "src2:"}, + "a dotted base": {func(g *Node) { g.Bases = []string{"a.b"} }, "a.b"}, + "a foreign package": {func(g *Node) { g.Packages = []string{"example.com/x"} }, "example.com/x"}, + "a toolchain of no module": {func(g *Node) { g.Toolchains = map[string]Toolchain{"go": {Version: "go1", Recipe: "1"}} }, "build module"}, + "a toolchain of no recipe": {func(g *Node) { g.Toolchains = map[string]Toolchain{"go": {Module: "b", Version: "go1"}} }, "recipe"}, + "awaiting what it does not require": {func(g *Node) { g.Awaits = []string{"other"} }, "other"}, + "no repository": {func(g *Node) { g.Repository = "" }, "repositor"}, + "leaving out no verb": {func(g *Node) { g.LeftOut = []string{"seat:nothing"} }, "seat:nothing"}, + "an invoke of no verb": {func(g *Node) { g.Invokes = []string{"seat:nothing"} }, "seat:nothing"}, } { g := sampleNode() c.change(&g) @@ -273,6 +273,12 @@ func nodeValues(t *testing.T) { t.Errorf("a node with %s: %v, want it refused naming %q", name, err, c.word) } } + // A-361: a package's seat call word left out on a cycle is kept though the module's own invokes do not name it. + kept := sampleNode() + kept.LeftOut = []string{"seat:mesh-catalog.registrations"} + if _, err := Encode(kept); err != nil { + t.Errorf("a node leaving out a package's call word is refused: %v", err) + } } // readersOfTheSeatList (D-31): a module whose manifest invokes the seat mesh-catalog's seat-definitions waits, by the verb