A consumer beside a held provider is told what it serves without the names it does not compose, never their placeholders (issue 1921, milestone 47/G)
The provider held on its machine is composed apart, so no module of the composed set serves the provision; its
manifest's served values reached the consumer's binding raw and the binding refused the consumer for a
${bound:route:name-web} it does not require (the group check of 8a80e8e86858 on novox, mesh-build-node beside a held
gitea). Each such key is now left out and said on the need, as a provider elsewhere leaves it out (ADR 0346).
Claude-Session: https://claude.ai/code/session_01NcbgfFSnn24M3GcqttoU7i
This commit is contained in:
@@ -4,6 +4,8 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"maps"
|
||||
"slices"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
@@ -240,7 +242,14 @@ func resolutionCompose(r mcat.Resolution, with mcat.Rendering, owner map[string]
|
||||
}
|
||||
if answered {
|
||||
r.Needs[i].Serves = serves
|
||||
continue
|
||||
}
|
||||
// No module of the composed set serves it: its provider is held on this machine (composed apart, as what runs of
|
||||
// it), and offers what its manifest serves. None of its own names is composed here, so a key that names one is
|
||||
// left out and said on the need, as a provider elsewhere leaves it out (ServedLeftOut, novox/hq ADR 0346 §3),
|
||||
// never handed to the consumer as a placeholder its binding then refuses (issue 1921, novox: "mesh-build-node has
|
||||
// a file that says ${bound:route:name-web}, and mesh-build-node does not require route").
|
||||
r.Needs[i].Serves, r.Needs[i].LeftOut = withoutOwnNames(r.Needs[i], r.Node)
|
||||
}
|
||||
|
||||
// Once, from every module's listens -- not per module. A module receiving only its own ports
|
||||
@@ -2526,3 +2535,26 @@ func resolutionGeneratedHere(r mcat.Resolution, with mcat.Rendering) (map[string
|
||||
}
|
||||
return generated, nil
|
||||
}
|
||||
|
||||
// withoutOwnNames is what a need's provider serves without each key whose value names one of the provider's own composed
|
||||
// names (${bound:…}), and the need's left-out keys with each such key said: a provider not composed in this set
|
||||
// composes none of its names here.
|
||||
func withoutOwnNames(n mcat.Needed, node string) (map[string]any, []string) {
|
||||
var asking []string
|
||||
for _, key := range sortedAnyKeys(n.Serves) {
|
||||
if text, ok := n.Serves[key].(string); ok && bound.MatchString(text) {
|
||||
asking = append(asking, key)
|
||||
}
|
||||
}
|
||||
if len(asking) == 0 {
|
||||
return n.Serves, n.LeftOut
|
||||
}
|
||||
out := maps.Clone(n.Serves)
|
||||
said := slices.Clone(n.LeftOut)
|
||||
for _, key := range asking {
|
||||
delete(out, key)
|
||||
said = append(said, fmt.Sprintf("%s serves %s without %q: it names %s, and %s composes no names of %s, which it "+
|
||||
"holds (novox/hq ADR 0346)", n.Module, n.Name, key, bound.FindString(n.Serves[key].(string)), orHere(node), n.Module))
|
||||
}
|
||||
return out, said
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user