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.
This commit is contained in:
2026-11-15 17:56:58 +01:00
parent 310d4817ca
commit ba2a7d73b7
4 changed files with 42 additions and 26 deletions
+4 -2
View File
@@ -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:<seat>.<verb> nor <module>.<tool>", l)
}
}
return nil
+17 -11
View File
@@ -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