CT15 (take-in bodies, none-yet): the seat mesh-catalog's bodies give take-in.taken and take-in.pending; revision answers none-yet in a field
The seat's bodies hold TakeInTaken (branch, source, entries with repository and pull) and TakeInPending (branch); revision's answer gains none-yet and its revision is optional; meshcatalogclient reads the field, never the error's words. The holders' and readers' uses of the answer follow (a pointer revision). Builds: design 47 G §476, §493, §530, §454, §648 Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
This commit is contained in:
@@ -1870,7 +1870,7 @@ func serveCatalog(t *testing.T, b *bed, nc *nats.Conn) {
|
||||
b.cat.mu.Lock()
|
||||
defer b.cat.mu.Unlock()
|
||||
if b.cat.rev[branch] == 0 {
|
||||
_ = m.Respond([]byte(`{"error":"` + views.NoneYet + `"}`))
|
||||
_ = m.Respond([]byte(`{"result":{"none-yet":true},"node":"n0"}`))
|
||||
return
|
||||
}
|
||||
rev := meshcatalog.CatalogRevision{Kind: "trunk", Branch: in.Branch, Revision: b.cat.rev[branch]}
|
||||
@@ -1879,7 +1879,7 @@ func serveCatalog(t *testing.T, b *bed, nc *nats.Conn) {
|
||||
entries = append(entries, b.cat.entries[branch][name])
|
||||
rev.Entries = append(rev.Entries, meshcatalog.EntryRef{Module: name, Digest: "sha256:" + strings.Repeat("0", 64)})
|
||||
}
|
||||
raw, _ := json.Marshal(map[string]any{"result": meshcatalog.RevisionAnswer{Revision: rev, Entries: entries}, "node": "n0"})
|
||||
raw, _ := json.Marshal(map[string]any{"result": meshcatalog.RevisionAnswer{Revision: &rev, Entries: entries}, "node": "n0"})
|
||||
_ = m.Respond(raw)
|
||||
}
|
||||
for _, subject := range []string{"mesh.seat.mesh-catalog.tool.revision", "mesh.seat.mesh-catalog.call.revision.*", "mesh.seat.mesh-catalog.tool.revision.*"} {
|
||||
|
||||
@@ -540,7 +540,7 @@ func startBed(t *testing.T) *bed {
|
||||
for repo, commit := range trunkView.Load().(map[string]string) {
|
||||
heads = append(heads, meshcatalog.Head{Repository: repo, Commit: commit})
|
||||
}
|
||||
body, _ := json.Marshal(meshcatalog.RevisionAnswer{Revision: meshcatalog.CatalogRevision{Kind: "trunk", Revision: 1, Trunk: heads}})
|
||||
body, _ := json.Marshal(meshcatalog.RevisionAnswer{Revision: &meshcatalog.CatalogRevision{Kind: "trunk", Revision: 1, Trunk: heads}})
|
||||
reply, _ := json.Marshal(map[string]any{"result": json.RawMessage(body), "node": "ctl"})
|
||||
_ = m.Respond(reply)
|
||||
}); err != nil {
|
||||
|
||||
@@ -18,7 +18,7 @@ func TestTrunkHeadsComeFromTheCatalogHalf(t *testing.T) {
|
||||
if key != "seat:mesh-catalog.revision" {
|
||||
t.Fatalf("asked %s", key)
|
||||
}
|
||||
return json.Marshal(meshcatalog.RevisionAnswer{Revision: meshcatalog.CatalogRevision{Kind: kind, Trunk: heads}})
|
||||
return json.Marshal(meshcatalog.RevisionAnswer{Revision: &meshcatalog.CatalogRevision{Kind: kind, Trunk: heads}})
|
||||
}
|
||||
}
|
||||
trunks := &check.Trunks{}
|
||||
|
||||
@@ -17,6 +17,9 @@ func TrunkHeads(raw json.RawMessage) (map[string]string, error) {
|
||||
if err := json.Unmarshal(raw, &a); err != nil {
|
||||
return nil, fmt.Errorf("the catalog half's revision does not read: %w", err)
|
||||
}
|
||||
if a.Revision == nil {
|
||||
return nil, fmt.Errorf("the catalog half's revision answers no revision (none-yet: %v)", a.NoneYet)
|
||||
}
|
||||
if a.Revision.Kind != "trunk" {
|
||||
return nil, fmt.Errorf("the catalog half's revision %d is a %q revision, not a trunk's", a.Revision.Revision, a.Revision.Kind)
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ func Revision(ctx context.Context, o Objects, holder, caller string, in meshcata
|
||||
}
|
||||
}
|
||||
slices.SortFunc(entries, func(a, b meshcatalog.CatalogEntry) int { return strings.Compare(a.Module, b.Module) })
|
||||
out.Revision, out.Entries = rev, []meshcatalog.CatalogEntry{}
|
||||
out.Revision, out.Entries = &rev, []meshcatalog.CatalogEntry{}
|
||||
size := 0
|
||||
for _, e := range entries {
|
||||
if e.Module <= in.After {
|
||||
|
||||
@@ -187,7 +187,7 @@ func ownersAnswerTheToolsAsBefore(t *testing.T) {
|
||||
// catalogAnswer is the seat mesh-catalog's newest trunk revision: a with a fingerprint and the source revision it moved at,
|
||||
// b with none and the reason.
|
||||
var catalogAnswer = meshcatalog.RevisionAnswer{
|
||||
Revision: meshcatalog.CatalogRevision{Revision: 4, Kind: meshcatalogclient.KindTrunk, Source: 7},
|
||||
Revision: &meshcatalog.CatalogRevision{Revision: 4, Kind: meshcatalogclient.KindTrunk, Source: 7},
|
||||
Entries: []meshcatalog.CatalogEntry{
|
||||
{Module: "a", Repository: "novox/r", Commit: "c1", Path: ".", Manifest: map[string]any{"module": "a"}, Fp: fp2A, Inputs: &meshcatalog.EntryInputs{Src: 7}},
|
||||
{Module: "b", Repository: "novox/r", Commit: "c2", Path: "modules/b", Manifest: map[string]any{"module": "b"}, None: "builder's fingerprint not yet known"},
|
||||
|
||||
@@ -77,7 +77,7 @@ func serveCatalog(t testing.TB, ctx context.Context, js jetstream.JetStream, nc
|
||||
}
|
||||
answer := func(m *nats.Msg) {
|
||||
h.mu.Lock()
|
||||
a := meshcatalog.RevisionAnswer{Revision: meshcatalog.CatalogRevision{Revision: h.rev, Kind: meshcatalogclient.KindTrunk}}
|
||||
a := meshcatalog.RevisionAnswer{Revision: &meshcatalog.CatalogRevision{Revision: h.rev, Kind: meshcatalogclient.KindTrunk}}
|
||||
for _, e := range h.entries {
|
||||
a.Entries = append(a.Entries, e)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user