G §421, §683: the node-engine reads the entry its want names by fingerprint and keeps its entries and wants

The node's own composer reads the catalog half through meshcatalogclient's Entries cache over its own calls of
mesh-catalog's verb entry, and no longer watches or reads the indexer's modules, manifests and verdicts or the
builder's builds: a module's manifest is its entry's, each artifact's reference is made from the digest its want's
part names (artifact-store://<module>/<artifact>/blobs/<digest>, A-50). A want whose entry is asked or not found is
held, its have the phase held with a detail opening entry-asked: or entry-missing: naming the fingerprint. The
entries and wants it composes from are kept in composed-<node> (entry.<digits> and want.<module>), written before
the composition that uses them, read at start before anything is asked, a kept want standing until the wants'
live read answers, and dropped when nothing names them. The shadow keeps its reads (G §628).

The node grant gains the verb entry and the running stream's consumer calls; OverNATS hears the running stream
as the link's session does.

Builds: design 47 G §421, §683, §614, §628, A-47, A-50
This commit is contained in:
2026-11-11 23:55:50 +01:00
parent 2b916ac043
commit cf378f9a25
13 changed files with 849 additions and 16 deletions
+55
View File
@@ -126,6 +126,10 @@ type Env struct {
// SeatListChanged says the reader's held set changed: the node composes again, so what waited for the list is
// handed at the read and not on a timer. Nil hears nothing.
SeatListChanged <-chan struct{}
// Entry asks the seat mesh-catalog's verb `entry` of a fingerprint (meshcatalogclient.EntryVerb), in the engine's own name.
// Set, the composer reads the catalog half by the fingerprints its wants and the runnings it heard name and nothing else of
// the indexer's or the builder's states (design 47 G §421, §628); nil reads the indexer's states, as the shadow does.
Entry meshcatalogclient.Call
}
// ManifestOf is the digest of the manifest of the build a module runs at fp, from the composer's picture of the catalog half;
@@ -175,6 +179,14 @@ type Composer struct {
notTaken map[string]string
// unmadeSaid is, by module, the stable part of the reason its last journal line said (without where the picture stands).
unmadeSaid map[string]string
// entries is the cache of entries asked by fingerprint, nil where the composer reads the indexer's states; keptEnt the entries
// held from the composition state or an answer, keptWantVal the wants it keeps there and keptWants the modules whose want
// stands from that state alone until the live read of the wants answers (entries.go). Under mu; keptWrite orders the writes.
entries *meshcatalogclient.Entries
keptEnt map[string]keptEntry
keptWantVal map[string]keptWant
keptWants map[string]bool
keptWrite sync.Mutex
// modulesRev is the revision of the last update of the indexer's modules taken: where the picture of them stands.
modulesRev uint64
// heard is, by node and module, what each node's event running last said it runs, kept from the seat's stream by this
@@ -374,6 +386,12 @@ func New(env Env) *Composer {
if env.Say == nil {
env.Say = func(string) {}
}
c := newComposer(env)
c.newEntries()
return c
}
func newComposer(env Env) *Composer {
return &Composer{env: env, wants: map[string]meshwants.WantsByWantNodeModuleValue{}, assignments: map[string]meshmoduleassigner.Assignments{}, assignmentKeys: meshmoduleassignerclient.NewKeys(),
records: map[string]nodeengine.NodeRecord{}, inOwn: map[string]bool{}, modules: map[string]meshcatalog.ModulesByModuleValue{}, values: map[string]map[string]any{},
manifests: map[string][]byte{}, archives: map[string][]byte{}, builds: map[string]builds.BuilderBuild{}, handed: map[string]string{}, notTaken: map[string]string{}, unmadeSaid: map[string]string{}, rehand: make(chan struct{}, 1), sealedOwn: map[string]ownSealed{},
@@ -437,6 +455,21 @@ type input struct {
}
func (c *Composer) inputs() []input {
ins := c.allInputs()
if !c.byEntries() {
return ins
}
// Reading the catalog half by fingerprint, it watches neither the indexer's modules nor the builder's builds (§421, §628).
out := ins[:0:0]
for _, in := range ins {
if in.bucket != buckets.Modules && in.bucket != builds.BuilderBuildsBucket {
out = append(out, in)
}
}
return out
}
func (c *Composer) allInputs() []input {
node := c.env.Node
return []input{
{buckets.Wants, "want." + node + ".>", (*Composer).takeWant, nil},
@@ -491,6 +524,8 @@ func (c *Composer) takeBuildDone(u agent.Update) bool {
// input's watch ends.
func (c *Composer) Watch(ctx context.Context, _ string) (<-chan agent.Update, error) {
ins := c.inputs()
// What the node kept of the entries and the wants it composes from is read before anything is asked (§683).
c.loadKept(ctx)
type tagged struct {
in int
u agent.Update
@@ -598,6 +633,9 @@ func (c *Composer) Watch(ctx context.Context, _ string) (<-chan agent.Update, er
dirty = true // a secret changed: its new generation is asked of the vault at the compose
case t.u.Caught:
caught[t.in] = true
if ins[t.in].bucket == buckets.Wants {
c.endKeptWants() // the wants the seat says now are the ones composed from (§683)
}
case ins[t.in].changed != nil:
dirty = ins[t.in].changed(c, t.u) || dirty
default:
@@ -759,6 +797,7 @@ func (c *Composer) takeWantLocked(u agent.Update) string {
return ""
}
delete(c.notTaken, module)
delete(c.keptWants, module)
w, err := meshwants.DecodeWantsByWantNodeModuleValue(u.Value)
if u.Deleted || err != nil || w.Removed || w.Fp == "" {
delete(c.wants, module)
@@ -960,6 +999,7 @@ func (c *Composer) compose(ctx context.Context) []agent.Update {
}
}
}()
c.syncEntries(ctx)
c.mu.Lock()
fps := map[string]string{}
kept := map[string]string{}
@@ -1024,6 +1064,15 @@ func (c *Composer) compose(ctx context.Context) []agent.Update {
// (ADR 0636 §1): the module is held as it runs before anything of its build is read, so no take-in or artifact
// reference of it (the artifact store's seat is not bootstrapped) can refuse the pass (issue 1966).
scope.Held = c.heldUntilListed(ctx, r, own)
// A want whose entry the catalog half has not answered, or holds none of, is held with what runs of it (§421).
if holds := c.entryHolds(); len(holds) > 0 {
if scope.Held == nil {
scope.Held = map[string]string{}
}
for module, why := range holds {
scope.Held[module] = why
}
}
missed := c.missed.Load()
compositions, skipped, held, err := frombus.Compose(ctx, r, c.env.Mesh, scope, fps)
err = c.missedIn(missed, err)
@@ -1533,6 +1582,9 @@ func (r reader) Manifest(ctx context.Context, digest string) ([]byte, error) {
if ok {
return raw, nil
}
if r.c.byEntries() {
return nil, fmt.Errorf("the catalog half's entries hold no manifest %s", digest)
}
key, err := meshcatalogclient.ManifestsKey(digest)
if err != nil {
return nil, err
@@ -1554,6 +1606,9 @@ func (r reader) Manifest(ctx context.Context, digest string) ([]byte, error) {
}
func (r reader) Build(ctx context.Context, module, fp string) (*builds.BuilderBuild, error) {
if r.c.byEntries() {
return r.c.buildOf(module, fp), nil
}
key, err := builds.BuilderBuildKey(module, fp)
if err != nil {
return nil, err