A packages state not on the bus yet is nothing published, not a failed read (issue 1966, check of #191)
Claude-Session: https://claude.ai/code/session_01NcbgfFSnn24M3GcqttoU7i
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
||||
"git.novox.be/novox/mesh-delivery/contracts/go/seats/meshcatalog"
|
||||
"git.novox.be/novox/mesh-delivery/contracts/go/seats/meshdeliverychecker"
|
||||
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds"
|
||||
"git.novox.be/novox/mesh-sdk/go/process"
|
||||
)
|
||||
|
||||
const meshSDK = "git.novox.be/novox/mesh-sdk/go"
|
||||
@@ -322,6 +323,7 @@ func anUnreadPackagesStateWritesNoFingerprintAndFingerprintsAreComputedAgain(t *
|
||||
why string
|
||||
}{
|
||||
{"the listing fails", func(ix *Indexer) { ix.Packages.(*memStore).keysErr = errors.New("jetstream not enabled") }, "cannot be listed"},
|
||||
{"the state is not on the bus yet", func(ix *Indexer) { ix.Packages.(*memStore).keysErr = process.ErrNotYet }, "answers no published package"}, // a mesh with no import form computes as before: TestIndexerWritesModulesAtAMerge
|
||||
{"the state answers no package", func(ix *Indexer) { ix.Packages = newMem() }, "answers no published package"},
|
||||
} {
|
||||
t.Run(c.name, func(t *testing.T) {
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"git.novox.be/novox/mesh-sdk/go/process"
|
||||
"maps"
|
||||
"path"
|
||||
"reflect"
|
||||
@@ -47,6 +48,9 @@ func (ix *Indexer) publishedRead(ctx context.Context) (map[string]meshcatalog.Pa
|
||||
return out, nil
|
||||
}
|
||||
keys, err := ix.Packages.Keys(ctx)
|
||||
if errors.Is(err, process.ErrNotYet) {
|
||||
return out, nil // the state is not on the bus yet: nothing is published, as before
|
||||
}
|
||||
if err != nil {
|
||||
return out, fmt.Errorf("the packages state cannot be listed: %w", err)
|
||||
}
|
||||
@@ -55,6 +59,9 @@ func (ix *Indexer) publishedRead(ctx context.Context) (map[string]meshcatalog.Pa
|
||||
continue // a package's series (series.go), not a Go module's digests
|
||||
}
|
||||
value, _, found, err := ix.Packages.Get(ctx, key)
|
||||
if errors.Is(err, process.ErrNotYet) {
|
||||
continue
|
||||
}
|
||||
if err != nil {
|
||||
return out, fmt.Errorf("packages.%s cannot be read: %w", key, err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user