mesh-delivery-checker: place no sibling for the controller's repository, which this group empties
ADR 0593 §11: the controller's repository holds nothing that builds once route-proxy moves, so its sibling rule goes; its tests fold into the sibling test, which now uses mesh-sdk's rule. Claude-Session: https://claude.ai/code/session_01NcbgfJ9Gum47zkFKWRaovL
This commit is contained in:
@@ -27,15 +27,14 @@ const (
|
||||
catalogueRepository = "novox/mesh-catalog"
|
||||
nodeEngineRepo = "novox/mesh-host"
|
||||
nodeEngineModule = "mesh-host"
|
||||
controllerRepo = "novox/mesh-controller"
|
||||
)
|
||||
|
||||
// besideRules are the repositories each core repository's tests read, as the tests state it (mesh-sdk go/internal/beside
|
||||
// beside.go): the catalogue, the node-engine, the SDK, and the delivery's pinned forge dependencies (mesh-catalog
|
||||
// checks/deps). Which commit of each is besideCommit's rule. No repository's tests read the controller, which ended by its
|
||||
// unassignment (novox/hq ADR 0590, issue 1126); its own repository keeps its siblings while it holds a module.
|
||||
// unassignment (novox/hq ADR 0590, issue 1126), and its repository is emptied and archived (ADR 0593 §11), so it has no
|
||||
// siblings placed either.
|
||||
var besideRules = map[string][]string{
|
||||
controllerRepo: {catalogueRepository, nodeEngineRepo, SDKRepository},
|
||||
nodeEngineRepo: {catalogueRepository, SDKRepository},
|
||||
SDKRepository: {catalogueRepository, nodeEngineRepo},
|
||||
catalogueRepository: {SDKRepository},
|
||||
|
||||
@@ -81,66 +81,46 @@ func besideOf(t *testing.T, b *bench, repository string) map[string]BesideRef {
|
||||
}
|
||||
|
||||
func TestTheSiblingsAreWhereTheTestsStateThem(t *testing.T) { // review D2, ADR 0484 clause 4
|
||||
const controller, catalogue, host = "novox/mesh-controller", "novox/mesh-catalog", "novox/mesh-host"
|
||||
const catalogue, host, controller = "novox/mesh-catalog", "novox/mesh-host", "novox/mesh-controller"
|
||||
hostRuns := strings.Repeat("7", 40)
|
||||
b := newBench(t)
|
||||
b.ex.Trunks = trunksOf(t, map[string]string{controller: trunkA, catalogue: trunkS, host: trunkA2, SDKRepository: "9999999999999999999999999999999999999999"})
|
||||
b.ex.Trunks = trunksOf(t, map[string]string{SDKRepository: trunkS, catalogue: trunkA, host: trunkA2})
|
||||
b.ex.Runs = runsAt{"mesh-host": hostRuns}
|
||||
// A group of the controller and the catalogue: the controller's tests read the group's catalogue head, the heads the group
|
||||
// merges (ADR 0482 §2, ADR 0573 §4; issue 1126: a judge in the group was judged against the catalogue's trunk).
|
||||
out := b.judge(t, caseOf(t, pullOf(controller, 7, head1), pullOf(catalogue, 12, head2)))
|
||||
// ADR 0548 §6, issue 568's own example: the verdict names the node-engine at the commit the mesh runs, and mesh-sdk at the
|
||||
// trunk the catalogue's tests read it at; the catalogue, a member here, is not named.
|
||||
if out.Beside[host] != hostRuns || out.Beside[catalogue] != "" || out.Beside[SDKRepository] != "9999999999999999999999999999999999999999" {
|
||||
t.Errorf("the siblings named for the verdict = %v, want the node-engine at %s and mesh-sdk at its trunk", out.Beside, hostRuns[:12])
|
||||
// A group of mesh-sdk and the catalogue: mesh-sdk's tests read the group's catalogue head, the heads the group merges
|
||||
// (ADR 0482 §2, ADR 0573 §4; issue 1126: a judge in the group was judged against the catalogue's trunk).
|
||||
out := b.judge(t, caseOf(t, pullOf(SDKRepository, 7, head1), pullOf(catalogue, 12, head2)))
|
||||
// ADR 0548 §6, issue 568's own example: the verdict names the node-engine at the commit the mesh runs; the catalogue,
|
||||
// a member here, is not named.
|
||||
if out.Beside[host] != hostRuns || out.Beside[catalogue] != "" {
|
||||
t.Errorf("the siblings named for the verdict = %v, want the node-engine at %s", out.Beside, hostRuns[:12])
|
||||
}
|
||||
got := besideOf(t, b, controller)
|
||||
got := besideOf(t, b, SDKRepository)
|
||||
if c := got[catalogue]; c.Commit != head2 || c.Ref != "refs/pull/12/head" {
|
||||
t.Errorf("the catalogue beside the controller in a group = %+v, want the member's head %s", c, head2)
|
||||
t.Errorf("the catalogue beside mesh-sdk in a group = %+v, want the member's head %s", c, head2)
|
||||
}
|
||||
if h := got[host]; h.Commit != hostRuns {
|
||||
t.Errorf("the node-engine beside the controller = %+v, want the commit the mesh runs %s", h, hostRuns)
|
||||
t.Errorf("the node-engine beside mesh-sdk = %+v, want the commit the mesh runs %s", h, hostRuns)
|
||||
}
|
||||
// ADR 0573 §2: the controller is built against mesh-sdk's latest published version, so its tests read that one too,
|
||||
// not the commit its go.mod names.
|
||||
if s := got[SDKRepository]; s.Commit != "9999999999999999999999999999999999999999" {
|
||||
t.Errorf("mesh-sdk beside the controller = %+v, want its trunk", s)
|
||||
// Alone, mesh-sdk's tests read the catalogue's trunk, and the verdict names it.
|
||||
b = newBench(t)
|
||||
b.ex.Trunks = trunksOf(t, map[string]string{SDKRepository: trunkS, catalogue: trunkA, host: trunkA2})
|
||||
if out := b.judge(t, caseOf(t, pullOf(SDKRepository, 7, head1))); out.Beside[catalogue] != trunkA {
|
||||
t.Errorf("the siblings named for the verdict alone = %v, want the catalogue at its trunk %s", out.Beside, trunkA)
|
||||
}
|
||||
// Alone, the controller's tests read the catalogue's trunk, and the verdict names it.
|
||||
if c := besideOf(t, b, SDKRepository)[catalogue]; c.Commit != trunkA || c.Ref != "" {
|
||||
t.Errorf("the catalogue beside mesh-sdk alone = %+v, want its trunk %s", c, trunkA)
|
||||
}
|
||||
// 1126/B8 (novox/hq ADR 0590, ADR 0593 §11): the controller's repository is emptied and archived, so no repository's
|
||||
// tests read it and it has no siblings of its own: a pull request of it has only its own trunk beside it.
|
||||
b = newBench(t)
|
||||
b.ex.Trunks = trunksOf(t, map[string]string{controller: trunkA, catalogue: trunkS, host: trunkA2, SDKRepository: trunkS})
|
||||
if out := b.judge(t, caseOf(t, pullOf(controller, 7, head1))); out.Beside[catalogue] != trunkS {
|
||||
t.Errorf("the siblings named for the verdict alone = %v, want the catalogue at its trunk %s", out.Beside, trunkS)
|
||||
}
|
||||
if c := besideOf(t, b, controller)[catalogue]; c.Commit != trunkS || c.Ref != "" {
|
||||
t.Errorf("the catalogue beside the controller alone = %+v, want its trunk %s", c, trunkS)
|
||||
}
|
||||
}
|
||||
|
||||
// 1126/B8 (novox/hq ADR 0590): the controller is gone, so no repository's tests read it: a mesh-host pull request has
|
||||
// the catalogue and mesh-sdk beside it and no mesh-controller, even where its trunk is known and the group holds one.
|
||||
func TestNoRepositorysTestsHaveTheControllerBesideThem(t *testing.T) {
|
||||
const host = "novox/mesh-host"
|
||||
b := newBench(t)
|
||||
b.ex.Trunks = trunksOf(t, map[string]string{host: trunkA, controllerRepo: trunkA2, catalogueRepository: trunkS, SDKRepository: trunkS})
|
||||
c, err := delivery.DecodeCandidate(candidateOf(t, "feat/x", pullOf(host, 5, head1), pullOf(controllerRepo, 9, head2)))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if v := b.judge(t, CaseOf(c, map[string]string{host: trunkA, controllerRepo: trunkA2})).Verdict; v.State == delivery.VerdictFail &&
|
||||
strings.Contains(v.Failed.Words, "mesh-controller") {
|
||||
t.Fatalf("verdict = %+v", v)
|
||||
}
|
||||
got := besideOf(t, b, host)
|
||||
if _, ok := got[controllerRepo]; ok {
|
||||
t.Errorf("the controller is beside the node-engine: %+v", got)
|
||||
}
|
||||
if _, ok := got[catalogueRepository]; !ok {
|
||||
t.Errorf("the catalogue is not beside the node-engine: %+v", got)
|
||||
b.judge(t, caseOf(t, pullOf(controller, 9, head2)))
|
||||
if got := besideOf(t, b, controller); len(got) != 1 || got[controller].Commit != trunkA {
|
||||
t.Errorf("beside the controller's own change = %+v, want its own trunk alone", got)
|
||||
}
|
||||
for repo, siblings := range besideRules {
|
||||
if repo != controllerRepo && slices.Contains(siblings, controllerRepo) {
|
||||
t.Errorf("the tests of %s read the controller", repo)
|
||||
if repo == controller || slices.Contains(siblings, controller) {
|
||||
t.Errorf("the tests of %s read the controller, or it has siblings", repo)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -160,10 +140,10 @@ func TestTheChangesOwnRepositoryIsBesideItAtItsTrunk(t *testing.T) {
|
||||
// the catalogue's shrink-only list tests read $MESH_CHECK_BESIDE/mesh-catalog.
|
||||
func TestACatalogueChangeHasTheCatalogueBesideItAtItsTrunk(t *testing.T) {
|
||||
b := newBench(t)
|
||||
b.ex.Trunks = trunksOf(t, map[string]string{catalogueRepository: trunkA, SDKRepository: trunkS, controllerRepo: trunkA2})
|
||||
b.ex.Trunks = trunksOf(t, map[string]string{catalogueRepository: trunkA, SDKRepository: trunkS, "novox/mesh-controller": trunkA2})
|
||||
out := b.judge(t, caseOf(t, pullOf(catalogueRepository, 12, head1)))
|
||||
// ADR 0548 §6: the outcome names the siblings read at their trunk's head, never the repository it merges.
|
||||
if out.Beside[SDKRepository] != trunkS || out.Beside[controllerRepo] != "" || out.Beside[catalogueRepository] != "" {
|
||||
if out.Beside[SDKRepository] != trunkS || out.Beside["novox/mesh-controller"] != "" || out.Beside[catalogueRepository] != "" {
|
||||
t.Errorf("the siblings named for the verdict = %v, want mesh-sdk at its trunk and neither the controller nor the catalogue", out.Beside)
|
||||
}
|
||||
got := besideOf(t, b, catalogueRepository)
|
||||
|
||||
Reference in New Issue
Block a user