Runner: a module's marks are checked once against all its bundles (A-398)

Live on novox every gitea tool was refused: each of gitea's eight bundles overwrote the gate's registered set, so the last one, which does not carry gitea_branch_protection_loosen, made the mark unserved.
This commit is contained in:
2026-11-14 14:36:42 +01:00
parent 9fa29ad801
commit 903ac4ce93
2 changed files with 15 additions and 8 deletions
+14 -7
View File
@@ -399,6 +399,7 @@ func (r *runner) claimed() map[string]bool {
func (r *runner) load(s Served) *loadedModule {
l := &loadedModule{served: s, seen: map[string]string{}}
claimed := r.claimed()
var all []launch.Registration // every bundle's registrations, the module's marks checked against them together (A-398)
for _, entry := range s.Entrypoints {
path, _ := filepath.Abs(entry)
module := s.Module
@@ -429,13 +430,7 @@ func (r *runner) load(s Served) *loadedModule {
fail(clashed)
continue
}
// A bundle whose marks name a tool it does not register is not loaded: no tool of its module is served here, rather
// than one served unmarked that the manifest meant to mark (design 46 7-approval-mark §4).
if unserved := r.unservedMarks(module, child.Registrations); len(unserved) > 0 {
child.Stop()
fail(fmt.Sprintf("its marks name %s, which it does not register (design 46 7-approval-mark §4)", strings.Join(unserved, ", ")))
continue
}
all = append(all, child.Registrations...)
l.children = append(l.children, child.Stop)
for _, reg := range child.Registrations {
got := registration{module: reg.Module, owner: module, tools: reg.Tools}
@@ -449,6 +444,18 @@ func (r *runner) load(s Served) *loadedModule {
}
}
}
// A module whose marks name a tool none of its bundles registers is not loaded: no tool of it is served here, rather
// than one served unmarked that the manifest meant to mark (design 46 7-approval-mark §4). Checked once, against every
// bundle of the module together (lead answer A-398: gitea's eight bundles each overwrote the gate's set).
if unserved := r.unservedMarks(s.Module, all); len(unserved) > 0 {
for _, stop := range l.children {
stop()
}
l.children, l.regs, l.own = nil, nil, nil
l.failed = fmt.Sprintf("its marks name %s, which none of its bundles registers (design 46 7-approval-mark §4)", strings.Join(unserved, ", "))
r.logf("[mesh-tools] %s is not loaded: %s; its tools are not served here", s.Module, l.failed)
return l
}
if repairs := r.repairsOf(s.Module); repairs != nil {
l.regs, l.own = append(l.regs, *repairs), append(l.own, *repairs)
}
+1 -1
View File
@@ -226,7 +226,7 @@ func TestAnEntrypointThatIsNotExecutableIsRefused(t *testing.T) {
if err != nil {
t.Fatal(err)
}
if !logs.Has("marked's bundle", "failed to load: its marks name wipe, which it does not register (design 46 7-approval-mark §4)") {
if !logs.Has("marked is not loaded: its marks name wipe, which none of its bundles registers (design 46 7-approval-mark §4)") {
t.Errorf("a bundle not serving its marked tool was not refused at the load:\n%s", logs.All())
}
if _, err := call(t, asker, "served.who@anchor", map[string]any{}); err != nil {