From 0f5c186b9c30aacafd8c2d0a53fdeb0246908584 Mon Sep 17 00:00:00 2001 From: jochen Date: Sun, 8 Nov 2026 01:14:52 +0100 Subject: [PATCH 1/2] The judge knows the Go packages the trunk holds a record of (issue 1966, recovery) The indexer's judge refused manifests whose `packages` name a Go package that no manifest declares as a package artifact: such a package has no series key, and knownPackages took series keys only, though each module the trunk published has a per-module record in the packages state naming its Go module and packages. knownPackages (and the checker's PackageNames) now also count each record's module and packages[].package; an unreadable state still judges no name. Quick vs thorough: this is the quick fix, the smallest change that lets the trunk's own records name what the manifests name. The thorough fix is that a build module builds Go package artifacts, so every Go package gets a series (the registry milestone); then the records stop being a source of names. Done now because the 15 refused manifests hold the bootstrap of the registry delivery. --- .../cmd/mesh-delivery-checker/judge_test.go | 4 ++++ .../cmd/mesh-delivery-checker/packages.go | 14 +++++++++++++- .../internal/index/control_records_test.go | 12 ++++++++++++ .../internal/index/verdicts.go | 16 ++++++++++++---- modules/mesh-delivery-indexer/judge/packages.go | 4 +++- 5 files changed, 44 insertions(+), 6 deletions(-) diff --git a/modules/mesh-delivery-checker/cmd/mesh-delivery-checker/judge_test.go b/modules/mesh-delivery-checker/cmd/mesh-delivery-checker/judge_test.go index dd5a7abd..1380e687 100644 --- a/modules/mesh-delivery-checker/cmd/mesh-delivery-checker/judge_test.go +++ b/modules/mesh-delivery-checker/cmd/mesh-delivery-checker/judge_test.go @@ -158,6 +158,10 @@ func TestThePublishedVersionsAreTheIndexersPackagesState(t *testing.T) { if got := p.LatestPackages(); len(got) != 1 || got[sdk] == "" { t.Errorf("after a delete: %v", got) } + // Issue 1966: a module record names its module and its Go packages too, with no series to say them. + if got := p.PackageNames(); !reflect.DeepEqual(got, map[string]string{sdk: ""}) { + t.Errorf("the known packages from a module record = %v", got) + } // A series key names its package by its ecosystem name, the judge's known packages (DLV-I14, design 32), and is no // module's published version. now := time.Now().UTC() diff --git a/modules/mesh-delivery-checker/cmd/mesh-delivery-checker/packages.go b/modules/mesh-delivery-checker/cmd/mesh-delivery-checker/packages.go index 19b4118c..ec998c92 100644 --- a/modules/mesh-delivery-checker/cmd/mesh-delivery-checker/packages.go +++ b/modules/mesh-delivery-checker/cmd/mesh-delivery-checker/packages.go @@ -78,7 +78,8 @@ func (p *publishedPackages) LatestPackages() buildstep.PackageVersions { return out } -// PackageNames are the packages the state's series keys name, by the name in its own ecosystem: the `/` +// PackageNames are the packages the state's series keys name, and the Go module path and each Go package of each per-module record (issue 1966: +// the indexer's own knownPackages counts them the same way, with no `/` to say), by the name in its own ecosystem: the `/` // each is built from (empty when the key does not say). Nil while the state is not read yet (Answered), which judges no // name; once read never nil, an empty state included, so the judge judges every name against it. func (p *publishedPackages) PackageNames() map[string]string { @@ -93,6 +94,17 @@ func (p *publishedPackages) PackageNames() map[string]string { out[s.Name] = s.Package } } + for _, v := range p.byKey { + names := []string{v.Module} + for _, d := range v.Packages { + names = append(names, d.Package) + } + for _, n := range names { + if _, ok := out[n]; !ok && n != "" { + out[n] = "" + } + } + } return out } diff --git a/modules/mesh-delivery-indexer/internal/index/control_records_test.go b/modules/mesh-delivery-indexer/internal/index/control_records_test.go index 3c77f41a..f4407087 100644 --- a/modules/mesh-delivery-indexer/internal/index/control_records_test.go +++ b/modules/mesh-delivery-indexer/internal/index/control_records_test.go @@ -440,6 +440,18 @@ func TestTheControlRecords(t *testing.T) { if known := ix.knownPackages(ctx); len(known) != 2 || !known[sdkGo] || !known["@novox/mesh-sdk"] { t.Errorf("the judge's known packages = %v", known) } + // Issue 1966: a Go package of a module the trunk holds a per-module record of is known, though no series names it. + resticMod, at := "git.novox.be/novox/mesh-delivery/modules/restic", time.Unix(1, 0) + rec, err := EncodePublishedPackages(meshcatalog.PackagesByModuleValue{Module: resticMod, Repository: "novox/mesh-delivery", Dir: "modules/restic", At: &at, + Commit: strings.Repeat("a", 40), Requires: "h1:r", Packages: []meshcatalog.PackagesByModuleValuePackagesItem{{Package: resticMod + "/backupgood", Digest: "h1:a"}}}) + if err != nil { + t.Fatal(err) + } + ix.Packages.(*memStore).vals["restic"] = rec + if known := ix.knownPackages(ctx); len(known) != 4 || !known[resticMod] || !known[resticMod+"/backupgood"] || !known[sdkGo] || known["restic/go"] || known["unknown/pkg"] { + t.Errorf("the judge's known packages with a module record = %v", known) + } + delete(ix.Packages.(*memStore).vals, "restic") delete(ix.Packages.(*memStore).vals, SeriesKey("@novox/mesh-sdk", "0.3")) for _, h := range []HeardVersion{ {Package: sdkGo, Seat: "go-package-registry", Version: "0.1.15", Commit: "c15"}, diff --git a/modules/mesh-delivery-indexer/internal/index/verdicts.go b/modules/mesh-delivery-indexer/internal/index/verdicts.go index 18f9f444..f799481f 100644 --- a/modules/mesh-delivery-indexer/internal/index/verdicts.go +++ b/modules/mesh-delivery-indexer/internal/index/verdicts.go @@ -362,7 +362,9 @@ func namesAtMerge(module string, raw []byte, atMerge bool, known judge.KnownPack } // knownPackages are the packages a manifest's `packages` may name (DLV-I14, design 32): every name the packages state's -// series keys hold, as KeepPackageNames reads it at each merge. Nil, which judges no name, where the indexer keeps no +// series keys hold, as KeepPackageNames reads it at each merge, and the Go module path and each Go package of every +// per-module record the state holds from the trunk: while no build module builds Go package artifacts, a package the +// trunk holds a record of has no series and is known by that record (issue 1966). Nil, which judges no name, where the indexer keeps no // packages state or it cannot be listed (said): a state the judge cannot read refuses no manifest. func (ix *Indexer) knownPackages(ctx context.Context) judge.KnownPackages { if ix.Packages == nil { @@ -375,14 +377,20 @@ func (ix *Indexer) knownPackages(ctx context.Context) judge.KnownPackages { } known := judge.KnownPackages{} for _, key := range keys { - if !IsSeriesKey(key) { - continue - } value, _, found, err := ix.Packages.Get(ctx, key) if err != nil { ix.logf("judge: packages.%s cannot be read, so the names of packages are not judged: %v", key, err) return nil } + if !IsSeriesKey(key) { + if r, err := DecodePublishedPackages(value); found && err == nil && r.Module != "" { + known[r.Module] = true + for _, d := range r.Packages { + known[d.Package] = true + } + } + continue + } if s, err := DecodeSeriesPackage(value); found && err == nil { known[s.Name] = true } diff --git a/modules/mesh-delivery-indexer/judge/packages.go b/modules/mesh-delivery-indexer/judge/packages.go index 69cc60bb..7866c412 100644 --- a/modules/mesh-delivery-indexer/judge/packages.go +++ b/modules/mesh-delivery-indexer/judge/packages.go @@ -12,7 +12,9 @@ import ( // KnownPackages are the names of the packages the mesh knows, each by its name in its own ecosystem (design 32: a Go // package's go.mod module path, a TypeScript package's package.json name): the names the indexer's packages state holds // (its series keys, index.SeriesPackage's Name), read at each trunk merge, and, at the merge check, the names a member -// of the change's delivery group names at its head for a package new in the group. Both read a name with mesh-delivery's +// of the change's delivery group names at its head for a package new in the group, and the Go module path and each Go package of each per-module +// record the state holds: a package the trunk holds a record of is known while no build module builds Go package +// artifacts (issue 1966), as well as a declared series. Both read a name with mesh-delivery's // sdk/packagename. Nil is no list at hand: the names are then not judged, only their series. type KnownPackages map[string]bool -- 2.54.0 From 2e9f23f348282f822cd08920e99f01f3174811fe Mon Sep 17 00:00:00 2001 From: jochen Date: Sun, 8 Nov 2026 01:24:54 +0100 Subject: [PATCH 2/2] Round 1: known by the module path alone, never a package inside it The review of 0f5c186b: counting each record's packages made 94 sub-package paths, commands among them, known names, which design 32 forbids; the seven names refused live are each their record's module (issue 1966). Claude-Session: https://claude.ai/code/session_01NcbgfFfQ4Z9UE5jK32PmE5 --- .../cmd/mesh-delivery-checker/judge_test.go | 2 +- .../cmd/mesh-delivery-checker/packages.go | 15 +++++---------- .../internal/index/control_records_test.go | 5 +++-- .../internal/index/verdicts.go | 11 ++++------- modules/mesh-delivery-indexer/judge/packages.go | 6 +++--- 5 files changed, 16 insertions(+), 23 deletions(-) diff --git a/modules/mesh-delivery-checker/cmd/mesh-delivery-checker/judge_test.go b/modules/mesh-delivery-checker/cmd/mesh-delivery-checker/judge_test.go index 1380e687..14d3f199 100644 --- a/modules/mesh-delivery-checker/cmd/mesh-delivery-checker/judge_test.go +++ b/modules/mesh-delivery-checker/cmd/mesh-delivery-checker/judge_test.go @@ -158,7 +158,7 @@ func TestThePublishedVersionsAreTheIndexersPackagesState(t *testing.T) { if got := p.LatestPackages(); len(got) != 1 || got[sdk] == "" { t.Errorf("after a delete: %v", got) } - // Issue 1966: a module record names its module and its Go packages too, with no series to say them. + // Issue 1966: a module record names its module, with no series to say it, and none of the packages inside it. if got := p.PackageNames(); !reflect.DeepEqual(got, map[string]string{sdk: ""}) { t.Errorf("the known packages from a module record = %v", got) } diff --git a/modules/mesh-delivery-checker/cmd/mesh-delivery-checker/packages.go b/modules/mesh-delivery-checker/cmd/mesh-delivery-checker/packages.go index ec998c92..62b01d53 100644 --- a/modules/mesh-delivery-checker/cmd/mesh-delivery-checker/packages.go +++ b/modules/mesh-delivery-checker/cmd/mesh-delivery-checker/packages.go @@ -78,8 +78,9 @@ func (p *publishedPackages) LatestPackages() buildstep.PackageVersions { return out } -// PackageNames are the packages the state's series keys name, and the Go module path and each Go package of each per-module record (issue 1966: -// the indexer's own knownPackages counts them the same way, with no `/` to say), by the name in its own ecosystem: the `/` +// PackageNames are the packages the state's series keys name, and the Go module path of each per-module record (issue +// 1966: the indexer's own knownPackages counts them the same way, with no `/` to say; never a package +// inside a module, design 32), by the name in its own ecosystem: the `/` // each is built from (empty when the key does not say). Nil while the state is not read yet (Answered), which judges no // name; once read never nil, an empty state included, so the judge judges every name against it. func (p *publishedPackages) PackageNames() map[string]string { @@ -95,14 +96,8 @@ func (p *publishedPackages) PackageNames() map[string]string { } } for _, v := range p.byKey { - names := []string{v.Module} - for _, d := range v.Packages { - names = append(names, d.Package) - } - for _, n := range names { - if _, ok := out[n]; !ok && n != "" { - out[n] = "" - } + if _, ok := out[v.Module]; !ok && v.Module != "" { + out[v.Module] = "" } } return out diff --git a/modules/mesh-delivery-indexer/internal/index/control_records_test.go b/modules/mesh-delivery-indexer/internal/index/control_records_test.go index f4407087..f625affa 100644 --- a/modules/mesh-delivery-indexer/internal/index/control_records_test.go +++ b/modules/mesh-delivery-indexer/internal/index/control_records_test.go @@ -440,7 +440,8 @@ func TestTheControlRecords(t *testing.T) { if known := ix.knownPackages(ctx); len(known) != 2 || !known[sdkGo] || !known["@novox/mesh-sdk"] { t.Errorf("the judge's known packages = %v", known) } - // Issue 1966: a Go package of a module the trunk holds a per-module record of is known, though no series names it. + // Issue 1966: a Go module the trunk holds a per-module record of is known by its module path, though no series + // names it; a package inside it is not (design 32). resticMod, at := "git.novox.be/novox/mesh-delivery/modules/restic", time.Unix(1, 0) rec, err := EncodePublishedPackages(meshcatalog.PackagesByModuleValue{Module: resticMod, Repository: "novox/mesh-delivery", Dir: "modules/restic", At: &at, Commit: strings.Repeat("a", 40), Requires: "h1:r", Packages: []meshcatalog.PackagesByModuleValuePackagesItem{{Package: resticMod + "/backupgood", Digest: "h1:a"}}}) @@ -448,7 +449,7 @@ func TestTheControlRecords(t *testing.T) { t.Fatal(err) } ix.Packages.(*memStore).vals["restic"] = rec - if known := ix.knownPackages(ctx); len(known) != 4 || !known[resticMod] || !known[resticMod+"/backupgood"] || !known[sdkGo] || known["restic/go"] || known["unknown/pkg"] { + if known := ix.knownPackages(ctx); len(known) != 3 || !known[resticMod] || known[resticMod+"/backupgood"] || !known[sdkGo] || known["restic/go"] || known["unknown/pkg"] { t.Errorf("the judge's known packages with a module record = %v", known) } delete(ix.Packages.(*memStore).vals, "restic") diff --git a/modules/mesh-delivery-indexer/internal/index/verdicts.go b/modules/mesh-delivery-indexer/internal/index/verdicts.go index f799481f..75bdf287 100644 --- a/modules/mesh-delivery-indexer/internal/index/verdicts.go +++ b/modules/mesh-delivery-indexer/internal/index/verdicts.go @@ -362,10 +362,10 @@ func namesAtMerge(module string, raw []byte, atMerge bool, known judge.KnownPack } // knownPackages are the packages a manifest's `packages` may name (DLV-I14, design 32): every name the packages state's -// series keys hold, as KeepPackageNames reads it at each merge, and the Go module path and each Go package of every -// per-module record the state holds from the trunk: while no build module builds Go package artifacts, a package the -// trunk holds a record of has no series and is known by that record (issue 1966). Nil, which judges no name, where the indexer keeps no -// packages state or it cannot be listed (said): a state the judge cannot read refuses no manifest. +// series keys hold, as KeepPackageNames reads it at each merge, and the Go module path of every per-module record the +// state holds from the trunk: while no build module builds Go package artifacts, a Go module the trunk holds a record of +// has no series and is known by its module path, never by a package inside it (design 32; issue 1966). Nil, which judges +// no name, where the indexer keeps no packages state or it cannot be listed (said): a state the judge cannot read refuses no manifest. func (ix *Indexer) knownPackages(ctx context.Context) judge.KnownPackages { if ix.Packages == nil { return nil @@ -385,9 +385,6 @@ func (ix *Indexer) knownPackages(ctx context.Context) judge.KnownPackages { if !IsSeriesKey(key) { if r, err := DecodePublishedPackages(value); found && err == nil && r.Module != "" { known[r.Module] = true - for _, d := range r.Packages { - known[d.Package] = true - } } continue } diff --git a/modules/mesh-delivery-indexer/judge/packages.go b/modules/mesh-delivery-indexer/judge/packages.go index 7866c412..4c8fd42e 100644 --- a/modules/mesh-delivery-indexer/judge/packages.go +++ b/modules/mesh-delivery-indexer/judge/packages.go @@ -12,9 +12,9 @@ import ( // KnownPackages are the names of the packages the mesh knows, each by its name in its own ecosystem (design 32: a Go // package's go.mod module path, a TypeScript package's package.json name): the names the indexer's packages state holds // (its series keys, index.SeriesPackage's Name), read at each trunk merge, and, at the merge check, the names a member -// of the change's delivery group names at its head for a package new in the group, and the Go module path and each Go package of each per-module -// record the state holds: a package the trunk holds a record of is known while no build module builds Go package -// artifacts (issue 1966), as well as a declared series. Both read a name with mesh-delivery's +// of the change's delivery group names at its head for a package new in the group, and the Go module path of each +// per-module record the state holds: a Go module the trunk holds a record of is known while no build module builds Go +// package artifacts (issue 1966), never a package inside it. Both read a name with mesh-delivery's // sdk/packagename. Nil is no list at hand: the names are then not judged, only their series. type KnownPackages map[string]bool -- 2.54.0