From 0f7091e4ac7e81ed8635dfa3d0e1f21711e2dce2 Mon Sep 17 00:00:00 2001 From: jochen Date: Fri, 23 Oct 2026 15:35:20 +0200 Subject: [PATCH] =?UTF-8?q?Place=20the=20change's=20own=20repository=20bes?= =?UTF-8?q?ide=20it=20at=20its=20trunk,=20so=20a=20shrink-only=20list=20te?= =?UTF-8?q?st=20compares=20with=20the=20trunk's=20copy=20at=20$MESH=5FCHEC?= =?UTF-8?q?K=5FBESIDE/=20(issue=201887=20A12,=20ADR=200529=20=C2=A72?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../internal/check/beside.go | 7 ++++- .../internal/check/examiner_test.go | 19 +++++++++++++- .../internal/check/judged_test.go | 2 +- .../internal/check/pins_test.go | 26 +++++++++++++++++++ 4 files changed, 51 insertions(+), 3 deletions(-) diff --git a/modules/mesh-delivery-checker/internal/check/beside.go b/modules/mesh-delivery-checker/internal/check/beside.go index 32ba99a..06bc799 100644 --- a/modules/mesh-delivery-checker/internal/check/beside.go +++ b/modules/mesh-delivery-checker/internal/check/beside.go @@ -35,13 +35,18 @@ var besideRules = map[string][]string{ // besideFor are the siblings a pull request's tests read (ADR 0484 clause 4): the catalogue at its trunk, always, even in a // group holding a catalogue pull request; the node-engine at the commit the mesh runs (the commit of the indexer's module // mesh-host, its trunk head when none is known); mesh-sdk, for the controller's tests, at the commit the controller's go.mod -// pins; any other sibling at the head of the group's pull request for it when the group holds one, else at its trunk. +// pins; any other sibling at the head of the group's pull request for it when the group holds one, else at its trunk. And +// first, the change's own repository at the trunk it is merged onto, so a test comparing a shrink-only list with the +// trunk's copy reads it at $MESH_CHECK_BESIDE/ (issue 1887 A12, ADR 0529 ยง2). func (j *Examiner) besideFor(ctx context.Context, c *Case, p Pull) ([]BesideRef, error) { var heads map[string]string if j.Trunks != nil { heads = j.Trunks.Heads() } var out []BesideRef + if p.Trunk != "" { + out = append(out, BesideRef{Repository: p.Repository, Commit: p.Trunk}) + } for _, repo := range besideRules[p.Repository] { switch { case repo == catalogueRepository: diff --git a/modules/mesh-delivery-checker/internal/check/examiner_test.go b/modules/mesh-delivery-checker/internal/check/examiner_test.go index 1c4ee01..88ce8fb 100644 --- a/modules/mesh-delivery-checker/internal/check/examiner_test.go +++ b/modules/mesh-delivery-checker/internal/check/examiner_test.go @@ -137,7 +137,7 @@ func newBench(t testing.TB) *bench { b.steps.handlers = map[string]func(stepCall) (any, error){ "build_go_fetch": func(stepCall) (any, error) { return b.fetch, nil }, "build_node_fetch": func(stepCall) (any, error) { return b.fetch, nil }, - "build_go_digest": func(c stepCall) (any, error) { return b.digest[c.args["level"].(string)], nil }, + "build_go_digest": func(c stepCall) (any, error) { return echoBeside(b, b.digest[c.args["level"].(string)]), nil }, "build_go_test": func(c stepCall) (any, error) { return b.test(c) }, "build_node_test": func(c stepCall) (any, error) { return b.test(c) }, } @@ -571,6 +571,8 @@ func trunksOf(t *testing.T, heads map[string]string) *Trunks { func TestNothingIsKeptForAWorkspaceGivenSiblingsWhenTheDigestDoesNotSayItCoversThem(t *testing.T) { // review D1, ADR 0444, issue 1287 b := newBench(t) + // A build module whose digest does not echo the siblings (before DigestVersion 3). + b.steps.handlers["build_go_digest"] = func(c stepCall) (any, error) { return b.digest[c.args["level"].(string)], nil } b.ex.Trunks = trunksOf(t, map[string]string{repoSDK: trunkS, "novox/mesh-catalog": trunkA}) b.judge(t, caseOf(t, pullOf(repoA, 7, head1))) if got := len(b.steps.tool("fetch")); got != 1 || b.steps.tool("fetch")[0].args["beside"] == nil { @@ -592,6 +594,21 @@ func TestNothingIsKeptForAWorkspaceGivenSiblingsWhenTheDigestDoesNotSayItCoversT // besideDigest stands for the Go build module's digest over a workspace with siblings (DigestVersion 3, lead decision L5): // each package's digest folds the siblings' commits in, and the answer echoes the lines it folded. +// echoBeside is d with the siblings the fetches placed, as the Go build module's digest echoes them (its DigestResult's +// Beside): every check now places the change's own repository at its trunk (issue 1887 A12). +func echoBeside(b *bench, d Digested) Digested { + var lines []string + for _, f := range b.steps.tool("fetch") { + refs, _ := f.args["beside"].([]BesideRef) + for _, r := range refs { + lines = append(lines, r.Repository+" "+r.Commit) + } + } + sort.Strings(lines) + d.Beside = lines + return d +} + func besideDigest(b *bench) func(c stepCall) (any, error) { return func(c stepCall) (any, error) { level := c.args["level"].(string) diff --git a/modules/mesh-delivery-checker/internal/check/judged_test.go b/modules/mesh-delivery-checker/internal/check/judged_test.go index f90febd..e915b39 100644 --- a/modules/mesh-delivery-checker/internal/check/judged_test.go +++ b/modules/mesh-delivery-checker/internal/check/judged_test.go @@ -30,7 +30,7 @@ func candidateBench(t *testing.T, takesRunner bool) *bench { return "installed" } b.steps.handlers["build_go_digest"] = func(c stepCall) (any, error) { - d := b.digest[c.args["level"].(string)] + d := echoBeside(b, b.digest[c.args["level"].(string)]) d.JudgedBy = judged(c) return d, nil } diff --git a/modules/mesh-delivery-checker/internal/check/pins_test.go b/modules/mesh-delivery-checker/internal/check/pins_test.go index 703a11b..dabdfe3 100644 --- a/modules/mesh-delivery-checker/internal/check/pins_test.go +++ b/modules/mesh-delivery-checker/internal/check/pins_test.go @@ -265,3 +265,29 @@ func TestAForgeThatIsNotHeardFailsAtTheForgeAndIsJudgedAgainWhenTheNodesChange(t t.Errorf("a forge that was not heard is not the change's failure: %+v is not judged again when the nodes change", v.Failed) } } + +// 1887/A12: the change's own repository is placed beside it at the trunk it is merged onto, for every repository, so a +// shrink-only list test reads the trunk's copy at $MESH_CHECK_BESIDE/. +func TestTheChangesOwnRepositoryIsBesideItAtItsTrunk(t *testing.T) { + b := newBench(t) + b.judge(t, caseOf(t, pullOf(repoA, 7, head1))) + got := besideOf(t, b, repoA) + if own := got[repoA]; own.Commit != trunkA || own.Ref != "" { + t.Fatalf("the repository beside its own change = %+v, want its trunk %s", own, trunkA) + } +} + +// 1887/A12: a catalogue change's siblings hold the catalogue itself at the trunk it is merged onto, beside mesh-sdk and +// mesh-controller, so 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.judge(t, caseOf(t, pullOf(catalogueRepository, 12, head1))) + got := besideOf(t, b, catalogueRepository) + if c := got[catalogueRepository]; c.Commit != trunkA || c.Ref != "" { + t.Fatalf("the catalogue beside its own change = %+v, want its trunk %s", c, trunkA) + } + if _, ok := got[SDKRepository]; !ok { + t.Errorf("mesh-sdk is no longer beside a catalogue change: %v", got) + } +}