Class a new module by its own name, so adding a core module is not called leaf (issue 403, review 69)
mesh/delivery-group group fix/403-fix-time checking: composed check out of date: novox/mesh-controller@7ca5a45ecc5a was judged against trunk ?, the trunk is no…
mesh/merge-gate out of date: judged against trunk 84deb530ee5a, the trunk is now 4dbd4066ca54; judged again on a recheck or when it is merged
mesh/repo-check out of date: judged against trunk 84deb530ee5a, the trunk is now 4dbd4066ca54; judged again on a recheck or when it is merged
mesh/delivery superseded: a newer head of the same pull request
mesh/delivery-group group fix/403-fix-time checking: composed check out of date: novox/mesh-controller@7ca5a45ecc5a was judged against trunk ?, the trunk is no…
mesh/merge-gate out of date: judged against trunk 84deb530ee5a, the trunk is now 4dbd4066ca54; judged again on a recheck or when it is merged
mesh/repo-check out of date: judged against trunk 84deb530ee5a, the trunk is now 4dbd4066ca54; judged again on a recheck or when it is merged
mesh/delivery superseded: a newer head of the same pull request
This commit is contained in:
@@ -2,6 +2,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"path"
|
||||||
"slices"
|
"slices"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
@@ -114,12 +115,21 @@ const classNone = "none"
|
|||||||
|
|
||||||
// changeClassOf is a change plan's class (novox/hq ADR 0313 §2): that of the slowest-budgeted module it moves,
|
// changeClassOf is a change plan's class (novox/hq ADR 0313 §2): that of the slowest-budgeted module it moves,
|
||||||
// itself or as a dependent — core when one is on the controller's own path or holds the mesh's resolver, leaf
|
// itself or as a dependent — core when one is on the controller's own path or holds the mesh's resolver, leaf
|
||||||
// otherwise, a module it adds a directory for included — and none when it moves nothing.
|
// otherwise — and none when it moves nothing. A module it adds a directory for counts by its own class: the
|
||||||
|
// catalogue names a module's directory by the module, so the directory's last element is its name. The graph holds
|
||||||
|
// no manifest of it yet, so a new module is core by its name alone (on the controller's own path), never by a
|
||||||
|
// resolver claim its manifest makes.
|
||||||
func changeClassOf(p link.ChangePlan, entries []inventory.Entry) string {
|
func changeClassOf(p link.ChangePlan, entries []inventory.Entry) string {
|
||||||
if len(p.Moved) == 0 && len(p.Dependents) == 0 && len(p.New) == 0 {
|
if len(p.Moved) == 0 && len(p.Dependents) == 0 && len(p.New) == 0 {
|
||||||
return classNone
|
return classNone
|
||||||
}
|
}
|
||||||
return classOfModules(append(append([]string{}, p.Moved...), p.Dependents...), entries)
|
modules := append(append([]string{}, p.Moved...), p.Dependents...)
|
||||||
|
for _, dir := range p.New {
|
||||||
|
if name := path.Base(strings.Trim(dir, "/")); name != "." && name != "/" && name != "" {
|
||||||
|
modules = append(modules, name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return classOfModules(modules, entries)
|
||||||
}
|
}
|
||||||
|
|
||||||
// grantsStepWord names the grants step (novox/hq issue 490): the bus's user list sent alone to the machine
|
// grantsStepWord names the grants step (novox/hq issue 490): the bus's user list sent alone to the machine
|
||||||
|
|||||||
@@ -43,6 +43,9 @@ func TestAChangePlanSaysTheClassOfWhatItMoves(t *testing.T) {
|
|||||||
{"the mesh's resolver", []string{"modules/dnsmasq/module.json"}, inventory.ClassCore},
|
{"the mesh's resolver", []string{"modules/dnsmasq/module.json"}, inventory.ClassCore},
|
||||||
{"a leaf and a core module together: the slowest-budgeted", []string{"modules/gitea/index.ts", "modules/dnsmasq/module.json"}, inventory.ClassCore},
|
{"a leaf and a core module together: the slowest-budgeted", []string{"modules/gitea/index.ts", "modules/dnsmasq/module.json"}, inventory.ClassCore},
|
||||||
{"nothing any module's build reads", []string{"README.md"}, "none"},
|
{"nothing any module's build reads", []string{"README.md"}, "none"},
|
||||||
|
{"a new leaf module alone", []string{"modules/weather/module.json"}, inventory.ClassLeaf},
|
||||||
|
{"a new module on the controller's own path, by its own class", []string{"next/mesh-delivery/module.json"}, inventory.ClassCore},
|
||||||
|
{"a new leaf module beside a core one moved", []string{"modules/weather/module.json", "modules/dnsmasq/module.json"}, inventory.ClassCore},
|
||||||
} {
|
} {
|
||||||
if got := plan(c.paths...).Class; got != c.want {
|
if got := plan(c.paths...).Class; got != c.want {
|
||||||
t.Errorf("%s: class %q, want %q", c.why, got, c.want)
|
t.Errorf("%s: class %q, want %q", c.why, got, c.want)
|
||||||
|
|||||||
Reference in New Issue
Block a user