Ask over mesh-sdk's composition: a question makes no pair credential and reads the mesh once (issue 1387)

The callers that only ask (status, the doctor's probes, facts, bindings, data, acts, nodes show, images, release, recorded push, consumers) resolve through resolveNode and compose through composeQuestion, over one Input read per operation (withInputCache). A question composes with Reading or Foreseeing and never calls PairCredential's maker: the credential a send would make is named, and perform makes it on a send.
This commit is contained in:
2026-10-20 09:14:25 +00:00
parent f693d7e171
commit 7855ea126c
11 changed files with 36 additions and 20 deletions
+8 -5
View File
@@ -17,6 +17,7 @@ import (
"git.novox.be/novox/mesh-sdk/go/validate"
"git.novox.be/novox/mesh-sdk/go/catalogue"
"git.novox.be/novox/mesh-sdk/go/compose"
"github.com/novox/mesh-controller/internal/artifacts"
"github.com/novox/mesh-controller/internal/broker"
"github.com/novox/mesh-controller/internal/builder"
@@ -263,7 +264,9 @@ func gatherFacts(ctx context.Context, open *stores, busVersion string) (snapshot
f.Controller.Commit = c.Commit
}
gens, gensErr := generators(ctx, open)
// The Input every machine's declaration below is composed over is read once for the whole snapshot.
ctx = withInputCache(ctx)
_, gensErr := generatorsOf(ctx, open)
hostShelf := shelf[hostModule]
meshWide := map[string]bool{}
engines := map[string]bool{}
@@ -361,7 +364,7 @@ func gatherFacts(ctx context.Context, open *stores, busVersion string) (snapshot
m.Settings = append(m.Settings, snapshot.Settings{Module: module, Values: scrub.Values(layer.Whole())})
}
}
m.Declaration = declarationFacts(ctx, open, n.Name, gens, gensErr, scrub)
m.Declaration = declarationFacts(ctx, open, n.Name, gensErr, scrub)
if ctx.Err() != nil {
return snapshot.Facts{}, ctx.Err()
}
@@ -456,14 +459,14 @@ func gatherFacts(ctx context.Context, open *stores, busVersion string) (snapshot
// declarationFacts is how one machine's declaration composes now, as the next push would compose it and
// without making anything (D1's composition), and whether the node-engine's validator takes it.
func declarationFacts(ctx context.Context, open *stores, node string, gens map[string]catalogue.Generator,
gensErr error, scrub *snapshot.Scrubber) snapshot.Declaration {
func declarationFacts(ctx context.Context, open *stores, node string, gensErr error,
scrub *snapshot.Scrubber) snapshot.Declaration {
var d snapshot.Declaration
if gensErr != nil {
d.Problems = []string{scrub.Text("the private network cannot be computed: " + oneLine(gensErr.Error()))}
return d
}
declared, problems, err := composedAndValidated(ctx, open, node, gens, Foreseeing)
declared, problems, err := composeQuestion(ctx, open, node, compose.Foreseeing, true)
if err != nil {
d.Problems = []string{scrub.Text(oneLine(err.Error()))}
return d