From 8f24d9804bef485951be618a5710eadfab26c57f Mon Sep 17 00:00:00 2001 From: jochen Date: Mon, 23 Nov 2026 12:05:53 +0100 Subject: [PATCH] I12: a take-in names no version for a package one of its movers publishes, in an import-form importer's entry At the take-in the version a mover's pipeline will publish is not released, so the import-form importer's entry names its package with no version and its build waits for that pipeline's publish (design 47 H2 H-A-532 DMC-1, H-A-547 Q5); a version-line entry keeps its pins, which its fingerprint takes. Builds: design 47 H2 H-A-521, H-A-532 (DMC-1), H-A-547 (Q5) --- .../internal/index/movers.go | 41 +++++++++++++++++++ .../internal/index/movers_test.go | 17 ++++++++ .../internal/index/takein_source.go | 1 + 3 files changed, 59 insertions(+) diff --git a/modules/mesh-delivery-indexer/internal/index/movers.go b/modules/mesh-delivery-indexer/internal/index/movers.go index a1cd9efef..3c89bda16 100644 --- a/modules/mesh-delivery-indexer/internal/index/movers.go +++ b/modules/mesh-delivery-indexer/internal/index/movers.go @@ -60,3 +60,44 @@ func moversOf(before []meshcatalog.CatalogEntry, after map[string]meshcatalog.Ca } return out } + +// unpinnedByMovers are the entries of a take-in with no version named, in an importer's packages, for a package a mover of +// the same take-in publishes (design 47 H2 H-A-532 DMC-1, H-A-547 Q5): the version that pipeline publishes is not released +// at the take-in, so the importer's build waits for that package's publish and is made against it (H-A-165, H-A-521). Only +// an entry on the import form is touched (its import set reported, H-A-538): a version-line entry's fingerprint takes its +// pins (H-A-167, H-A-530), so it keeps them. A mover's own packages are left as they are. The entries are written anew where +// one changes; the others are the same values. +func unpinnedByMovers(entries map[string]meshcatalog.CatalogEntry, movers []meshcatalog.TakeInEntry) map[string]meshcatalog.CatalogEntry { + published := map[string]string{} // package name to the mover that publishes it + for _, m := range movers { + for _, a := range entries[m.Module].Artifacts { + if a.Package != nil && a.Package.Name != "" { + published[a.Package.Name] = m.Module + } + } + } + if len(published) == 0 { + return entries + } + out := make(map[string]meshcatalog.CatalogEntry, len(entries)) + for name, e := range entries { + out[name] = e + if _, reported := importSetOf(e); !reported { + continue + } + var pkgs map[string]string + for p, v := range e.Packages { + if by, ok := published[p]; ok && by != name && v != "" { + if pkgs == nil { + pkgs = maps.Clone(e.Packages) + } + pkgs[p] = "" + } + } + if pkgs != nil { + e.Packages = pkgs + out[name] = e + } + } + return out +} diff --git a/modules/mesh-delivery-indexer/internal/index/movers_test.go b/modules/mesh-delivery-indexer/internal/index/movers_test.go index 137d25383..1a860e13f 100644 --- a/modules/mesh-delivery-indexer/internal/index/movers_test.go +++ b/modules/mesh-delivery-indexer/internal/index/movers_test.go @@ -71,4 +71,21 @@ func TestMoversOf(t *testing.T) { } }) } + // I12 (design 47 H2 H-A-532 DMC-1, H-A-547 Q5): an import-form importer of a package a mover of the take-in publishes names + // no version for it in the revision's entry, so its build waits for that pipeline's publish; a version-line importer keeps + // its pin (its fingerprint takes it), and a take-in that moves no publisher touches nothing. + t.Run("an import-form importer names no version for a package a mover publishes", func(t *testing.T) { + after := entries(sdk("2"), importer, reported("a2")) + got := unpinnedByMovers(after, moversOf([]meshcatalog.CatalogEntry{sdk("1"), importer, reported("a")}, after, []string{"novox/mesh-sdk"})) + if v, named := got["avahi"].Packages["git.novox.be/novox/mesh-sdk/go"]; !named || v != "" { + t.Errorf("the import-form importer's packages = %v, want mesh-sdk/go named with no version", got["avahi"].Packages) + } + if got["gate"].Packages["git.novox.be/novox/mesh-sdk/go"] != "v0.1.20" || after["avahi"].Packages["git.novox.be/novox/mesh-sdk/go"] != "v0.1.20" { + t.Errorf("the version-line importer's packages = %v (the entry given %v), want both pinned as they were", got["gate"].Packages, after["avahi"].Packages) + } + still := entries(sdk("1"), reported("a")) + if got := unpinnedByMovers(still, moversOf([]meshcatalog.CatalogEntry{sdk("1"), reported("a")}, still, []string{"novox/mesh-sdk"})); got["avahi"].Packages["git.novox.be/novox/mesh-sdk/go"] != "v0.1.20" { + t.Errorf("a take-in moving no publisher unpinned %v", got["avahi"].Packages) + } + }) } diff --git a/modules/mesh-delivery-indexer/internal/index/takein_source.go b/modules/mesh-delivery-indexer/internal/index/takein_source.go index 4d108e3a5..ee666fa4c 100644 --- a/modules/mesh-delivery-indexer/internal/index/takein_source.go +++ b/modules/mesh-delivery-indexer/internal/index/takein_source.go @@ -111,6 +111,7 @@ func (ix *Indexer) takeInSource(ctx context.Context, e meshdelivery.SourceMovedE if e.Start { movers = nil // a branch's first revision moves nothing: its entries are the base later take-ins are held against (ยง768, H-A-19) } + entries = unpinnedByMovers(entries, movers) // an importer waits for the publish of a package a mover of this take-in publishes (DMC-1) number, err := ix.keepBranchEntries(ctx, e.Branch, e.Source, takeInCall(e.Call), entries, movers) if err != nil { if errors.Is(err, ErrObjectsFull) {