GIT12: the forge module's package registry checks a publish against the builder's reservation, asked by the package's name
The holder asks the seat mesh-builds' verb reserved with the publish's name and version in place of builder_versions, and stores only a version reserved for an artifact of the publish's digest; the manifest invokes the verb and takes no builder package. Builds: design 47 G §381, §478, §504 Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
This commit is contained in:
@@ -450,12 +450,12 @@ func TestToolsAreTheOnesTheReadmeNamesAndSayWhatTheyDo(t *testing.T) {
|
||||
if err := json.Unmarshal(raw, &m); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
// The builder's question is its published package, taken by its series (ADR 0634 §1).
|
||||
if m.Packages["git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds"] != "0.1" {
|
||||
t.Errorf("packages %v: want builds of series 0.1", m.Packages)
|
||||
// The reservation is asked through the seat mesh-builds, so the manifest takes no package of the builder (design 47 §381).
|
||||
if len(m.Packages) != 0 {
|
||||
t.Errorf("packages %v: want none", m.Packages)
|
||||
}
|
||||
// Both package seats are claimed serving the four verbs this bundle answers as <seat>.<verb>, over its own incoming
|
||||
// and transfers, asking the builder's numbering (design 51 *Publishing*).
|
||||
// and transfers, asking the builder's reservation (design 51 *Publishing*, design 47 §381).
|
||||
claimed := map[string]string{}
|
||||
for _, c := range m.Claims {
|
||||
claimed[c.Name] = strings.Join(c.Serves, ",")
|
||||
@@ -488,7 +488,7 @@ func TestToolsAreTheOnesTheReadmeNamesAndSayWhatTheyDo(t *testing.T) {
|
||||
t.Errorf("transfers has options (a lifetime): %s", req)
|
||||
}
|
||||
// The retention asks the builder's versions; the forge's other bundles ask the catalog half and record a re-read.
|
||||
if strings.Join(m.Invokes, ",") != "seat:mesh-catalog.revision,seat:mesh-catalog.registrations,seat:mesh-hand-acts.hand-act,mesh-delivery-builder.builder_versions" {
|
||||
if strings.Join(m.Invokes, ",") != "seat:mesh-catalog.revision,seat:mesh-catalog.registrations,seat:mesh-hand-acts.hand-act,seat:mesh-builds.reserved" {
|
||||
t.Errorf("the manifest invokes %v", m.Invokes)
|
||||
}
|
||||
if len(m.Tools) != 0 {
|
||||
|
||||
@@ -19,7 +19,6 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
builds "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
@@ -274,11 +273,11 @@ func recordAct(q meshhandactsclient.Request) error {
|
||||
// boundCap is incoming's cap from its binding, read once per bundle.
|
||||
var boundCap = parts.BusCap(packageseats.IncomingObjects)
|
||||
|
||||
// busHolder is the holder over the runtime's bus state, the builder's numbering and the forge.
|
||||
// busHolder is the holder over the runtime's bus state, the builder's reservation and the forge.
|
||||
func busHolder(forge func() (*Forge, error)) (*packageseats.Holder, error) {
|
||||
return &packageseats.Holder{Objects: parts.BusObjects(packageseats.IncomingObjects),
|
||||
Transfers: parts.BusTransfers[packageseats.Opening](packageseats.TransfersState),
|
||||
Builder: builds.BuilderVersions{Ask: stdio.Ask}, Store: seatStore{forge}, Say: say, Finding: finding,
|
||||
Builder: packageseats.Reserved{Ask: stdio.Ask}, Store: seatStore{forge}, Say: say, Finding: finding,
|
||||
Cap: boundCap, Record: recordAct, Idle: parts.BusArm(packageseats.IdleState)}, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ package main
|
||||
// the built package-registry bundle, played over its real stdin and stdout as the node's tool runtime plays it, its
|
||||
// `incoming` an object store and its `transfers` and `findings` key-value buckets of a nats-server of this test alone
|
||||
// (so the publish in parts runs through mesh-sdk's parts.BusObjects and BusTransfers, ruling 4 of the lead's 14:0x), the
|
||||
// builder's builder_versions answered on mesh/ask, and the forge an
|
||||
// builder's reserved answered on mesh/ask, and the forge an
|
||||
// httptest server that takes reads only with the tools' token and writes only with the packages account's.
|
||||
//
|
||||
// A Go package the builder numbered goes up in two chunks, is uploaded whole as the packages account and says
|
||||
@@ -37,7 +37,6 @@ import (
|
||||
"github.com/nats-io/nats.go"
|
||||
"github.com/nats-io/nats.go/jetstream"
|
||||
|
||||
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds"
|
||||
"git.novox.be/novox/mesh-sdk/go/testbus"
|
||||
|
||||
"gitea/internal/packageseats"
|
||||
@@ -117,11 +116,15 @@ func (p *player) handle(m wire) {
|
||||
}
|
||||
_ = json.Unmarshal(m.Params, &a)
|
||||
switch {
|
||||
case m.Method == "mesh/ask" && a.Key == builds.BuilderVersionsAddress:
|
||||
var q struct{ Name, Version, Digest string }
|
||||
case m.Method == "mesh/ask" && a.Key == packageseats.Address:
|
||||
var q struct{ Name, Version string }
|
||||
_ = json.Unmarshal(a.Body, &q)
|
||||
d, ok := p.numbered[q.Name+"@"+q.Version]
|
||||
p.answer(m.ID, map[string]any{"recorded": ok && d == q.Digest, "why": "not numbered with that digest"}, nil)
|
||||
if !ok {
|
||||
p.answer(m.ID, nil, errors.New("no version of "+q.Name+" is reserved"))
|
||||
break
|
||||
}
|
||||
p.answer(m.ID, map[string]any{"module": "m", "version": q.Version, "artifacts": []map[string]any{{"artifact": "m:a", "digest": d}}}, nil)
|
||||
case m.Method == "mesh/seat.publish":
|
||||
p.answer(m.ID, map[string]any{}, p.nc.Publish(a.Subject, a.Body))
|
||||
case m.Method == "mesh/publish":
|
||||
@@ -395,12 +398,12 @@ func TestThePackageSeatsWhole(t *testing.T) {
|
||||
t.Errorf("an ended transfer is still kept: %v", keys)
|
||||
}
|
||||
|
||||
// One the builder did not number: refused before the forge sees it, said, and the seat's finding written.
|
||||
// One the builder did not reserve: refused before the forge sees it, said, and the seat's finding written.
|
||||
other := bigZip(t, "git.example/acme/sdk@v0.1.16")
|
||||
od := "sha256:" + sha(other)
|
||||
transfer, _ = publish("0.1.16", od, len(other))
|
||||
_ = send(transfer, od, other)
|
||||
if o := event("refused"); !strings.Contains(fmt.Sprint(o["reason"]), "did not number") {
|
||||
if o := event("refused"); !strings.Contains(fmt.Sprint(o["reason"]), "no version of git.example/acme/sdk is reserved") {
|
||||
t.Errorf("refused says %v", o)
|
||||
}
|
||||
findings, _ := js.KeyValue(ctx, "gitea_findings")
|
||||
|
||||
Reference in New Issue
Block a user