From d0de4a74972b9b794b3bf7bd7f3da587590e515b Mon Sep 17 00:00:00 2001 From: jochen Date: Mon, 23 Nov 2026 12:20:34 +0100 Subject: [PATCH] I14: the release's pins record an npm package's version as they do a Go one's An npm import of another repository enters an entry's packages as a Go one does (H-A-546 (3)), but the pins matched only a series' Go module path, so an npm pin stayed empty and the builder waited out its bound. A series now pins by its Go module path, or by its package name when it has none. Builds: design 47 H2 H-A-553 (1), H-A-546 (3) --- .../internal/index/repin_test.go | 11 +++++++---- .../mesh-delivery-indexer/internal/index/versions.go | 7 ++++--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/modules/mesh-delivery-indexer/internal/index/repin_test.go b/modules/mesh-delivery-indexer/internal/index/repin_test.go index 65baaf3ad..2ed679109 100644 --- a/modules/mesh-delivery-indexer/internal/index/repin_test.go +++ b/modules/mesh-delivery-indexer/internal/index/repin_test.go @@ -17,17 +17,20 @@ import ( // Design 47 H-A-204, H-A-201, H-A-165: an entry's packages name every requirement of its module graph of another // repository: one the form's versions leave out (an import form naming only what the build imported) is pinned by its -// series' newest published version, and one none publishes yet is kept with no version, never left out. +// series' newest published version, and one none publishes yet is kept with no version, never left out. H2 H-A-553 (1): an npm +// package is pinned by its series' newest published version as a Go one is. func TestAnEntryNamesEveryRequirementPinnedOrWaiting(t *testing.T) { const ( wireguard = "git.novox.be/novox/mesh-networking/modules/mesh-wireguard/go" busgrants = "git.novox.be/novox/mesh-delivery/modules/mesh-grants/busgrants" sdk = "git.novox.be/novox/mesh-sdk/go" + npm = "@novox/mesh-sdk" ) series := map[string]SeriesPackage{"wg": {Name: "mesh-wireguard/go", GoModule: wireguard, Series: catalogue.DefaultSeries, - Newest: &meshcatalog.PackagesByPackageSeriesValueNewest{Version: "0.1.47"}}} - pins := releasedPins(sdkstep.PackageVersions{sdk: "c0ffee"}, series, catalogue.Manifest{}, "novox/mesh-catalog", []string{busgrants, sdk, wireguard}) - want := sdkstep.PackageVersions{sdk: "", wireguard: "v0.1.47", busgrants: ""} + Newest: &meshcatalog.PackagesByPackageSeriesValueNewest{Version: "0.1.47"}}, + "npm": {Name: npm, Series: catalogue.DefaultSeries, Newest: &meshcatalog.PackagesByPackageSeriesValueNewest{Version: "0.1.9"}}} + pins := releasedPins(sdkstep.PackageVersions{sdk: "c0ffee", npm: "d00d"}, series, catalogue.Manifest{}, "novox/mesh-catalog", []string{busgrants, sdk, wireguard}) + want := sdkstep.PackageVersions{sdk: "", wireguard: "v0.1.47", busgrants: "", npm: "v0.1.9"} if len(pins) != len(want) { t.Fatalf("pins = %v, want %v", pins, want) } diff --git a/modules/mesh-delivery-indexer/internal/index/versions.go b/modules/mesh-delivery-indexer/internal/index/versions.go index 9bba033c5..12e79d817 100644 --- a/modules/mesh-delivery-indexer/internal/index/versions.go +++ b/modules/mesh-delivery-indexer/internal/index/versions.go @@ -419,8 +419,8 @@ func isFloor(raw []byte) bool { } // releasedPins are a module's pins (its catalog entry's packages, which the builder builds it against) from the versions its -// fingerprint was computed with (design 47 H-A-161, H-A-183, H-A-184, H-A-185, G §370): each package is pinned to the -// newest version the registry published for its path (the seats' published, kept in the package's series by HearVersion) +// fingerprint was computed with (design 47 H-A-161, H-A-183, H-A-184, H-A-185, G §370; H2 H-A-553 (1)): each package, a Go +// module path or an npm package name, is pinned to the newest version the registry published for it (the seats' published, kept in the package's series by HearVersion) // within the series the module accepts, the one its manifest m names or the default (Manifest.AcceptedSeries), whether // or not that series holds contents yet; a publish in another series pins nothing and moves nothing, and a module's // release number is never a pin. A package with none published in that series is kept with no version, so its kind-1 @@ -446,7 +446,8 @@ func releasedPins(versions sdkstep.PackageVersions, series map[string]SeriesPack out[p] = "" for _, s := range series { pinned := pinnedVersion(s) - if s.GoModule != p || pinned == nil || s.Series != m.AcceptedSeries(s.Name) { + // A Go package by its module path, an npm one by its package name (H2 H-A-553 (1)): one rule for both. + if (s.GoModule != p && (s.GoModule != "" || s.Name != p)) || pinned == nil || s.Series != m.AcceptedSeries(s.Name) { continue } v := strings.TrimPrefix(pinned.Version, "v")