From 903ac4ce93ad55dc34f2474101785023f88330e0 Mon Sep 17 00:00:00 2001 From: jochen Date: Sat, 14 Nov 2026 14:36:42 +0100 Subject: [PATCH] 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. --- node-tools/internal/runtime/runtime.go | 21 ++++++++++++++------- node-tools/internal/runtime/runtime_test.go | 2 +- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/node-tools/internal/runtime/runtime.go b/node-tools/internal/runtime/runtime.go index 9cdcea8..46e9b13 100644 --- a/node-tools/internal/runtime/runtime.go +++ b/node-tools/internal/runtime/runtime.go @@ -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) } diff --git a/node-tools/internal/runtime/runtime_test.go b/node-tools/internal/runtime/runtime_test.go index c8f24a1..1c48105 100644 --- a/node-tools/internal/runtime/runtime_test.go +++ b/node-tools/internal/runtime/runtime_test.go @@ -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 {