A-386 kept-runner-carries-a-module-known-by-its-bindings: a module placed on a node whose manifest is unreadable is carried by a kept runner by its kept bindings alone
Builds: design 47 G A-386 (G-22-lead-answers-2.md), live read of the gate's membership Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
This commit is contained in:
@@ -726,11 +726,12 @@ func newEventStreams(kept []KeptEvent) []string {
|
||||
|
||||
// KeptRunnerGrants are the grants a tool runner that a pass keeps as it runs (no placed manifest says it is one, ADR 0601 §4) is composed
|
||||
// as a carrying runner for: what the modules placed on its node that a runner carries, with their bindings and events, give it (design 47
|
||||
// G A-386), never as a plain module. runner is the module the kept user is named for.
|
||||
func KeptRunnerGrants(r Records, node, runner string) (Permissions, error) {
|
||||
// G A-386), never as a plain module. runner is the module the kept user is named for; byBindings are the modules placed on the node
|
||||
// whose manifest the pass cannot read, declared by the bindings kept for them alone (they carry nothing else).
|
||||
func KeptRunnerGrants(r Records, node, runner string, byBindings []Declared) (Permissions, error) {
|
||||
logs := DeclaredLogs(r)
|
||||
var carried []Declared
|
||||
for _, d := range r.Assigned[node] {
|
||||
for _, d := range append(slices.Clone(r.Assigned[node]), byBindings...) {
|
||||
if CarriedByRunner(d) {
|
||||
d = withReadLogs(withAnnouncedReads(d, r.Announced), logs)
|
||||
d.Hears = ComposedHears(d)
|
||||
|
||||
@@ -379,7 +379,7 @@ func (p *Part) Compose() Result {
|
||||
// alone (design 47 G A-385); a runner kept for what it runs, whose manifest does not say it is one, is never composed as a plain module
|
||||
// (ADR 0601 §4).
|
||||
kept = unionComposed(kept, users, runnersKept)
|
||||
kept = unionKeptRunners(kept, listRecs, runnersKept)
|
||||
kept = unionKeptRunners(kept, listRecs, runnersKept, declaredByBindings(in, listRecs))
|
||||
for _, user := range sortedKeys(refused) {
|
||||
res.PrincipalsRefused = append(res.PrincipalsRefused, user+": "+refused[user])
|
||||
}
|
||||
|
||||
@@ -215,7 +215,7 @@ func unionComposed(kept map[string]User, composed []User, apart map[string]strin
|
||||
// unionKeptRunners is kept with each tool runner kept as it runs (runnersKept) holding the union of the list in force and the grants of a
|
||||
// carrying runner on its node, composed from the modules the pass places there with their bindings and events (design 47 G A-386); a
|
||||
// runner that cannot be composed so stays as the list in force holds it. It only adds.
|
||||
func unionKeptRunners(kept map[string]User, r buscompose.Records, runnersKept map[string]string) map[string]User {
|
||||
func unionKeptRunners(kept map[string]User, r buscompose.Records, runnersKept map[string]string, byBindings map[string][]buscompose.Declared) map[string]User {
|
||||
if len(kept) == 0 || len(runnersKept) == 0 {
|
||||
return kept
|
||||
}
|
||||
@@ -229,7 +229,7 @@ func unionKeptRunners(kept map[string]User, r buscompose.Records, runnersKept ma
|
||||
if !ok || !cut {
|
||||
continue
|
||||
}
|
||||
perms, err := buscompose.KeptRunnerGrants(r, node, runner)
|
||||
perms, err := buscompose.KeptRunnerGrants(r, node, runner, byBindings[node])
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
@@ -240,3 +240,18 @@ func unionKeptRunners(kept map[string]User, r buscompose.Records, runnersKept ma
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// declaredByBindings are, by node, the modules placed there that the records leave out for want of a manifest and that have bindings kept: each
|
||||
// declared by its bindings alone, with no account of its own, so a tool runner carries it and reads what it is bound to (design 47 G A-386).
|
||||
func declaredByBindings(in Inputs, r buscompose.Records) map[string][]buscompose.Declared {
|
||||
out := map[string][]buscompose.Declared{}
|
||||
for node, modules := range in.Assigned {
|
||||
for _, module := range modules {
|
||||
if len(in.Bindings[module]) == 0 || slices.ContainsFunc(r.Assigned[node], func(d buscompose.Declared) bool { return d.Module == module }) {
|
||||
continue
|
||||
}
|
||||
out[node] = append(out[node], buscompose.Declared{Module: module, NoAccount: true, Bindings: in.Bindings[module]})
|
||||
}
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user