From 40ed0633e07c36fa7fe9b0cb0a8a15944385c58e Mon Sep 17 00:00:00 2001 From: jochen Date: Mon, 16 Nov 2026 00:34:50 +0100 Subject: [PATCH] =?UTF-8?q?node-engine:=20a=20held=20tool=20runner=20keeps?= =?UTF-8?q?=20its=20running=20program,=20so=20a=20module=20of=20its=20own?= =?UTF-8?q?=20account=20is=20not=20held=20for=20want=20of=20a=20runtime=20?= =?UTF-8?q?that=20runs=20(ADR=200259=20=C2=A78)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/compose/composed.go | 43 ++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/internal/compose/composed.go b/internal/compose/composed.go index 15017c4d..7ae3253b 100644 --- a/internal/compose/composed.go +++ b/internal/compose/composed.go @@ -489,6 +489,49 @@ func Stub(m catalogue.Manifest) catalogue.Manifest { // run). What it provides, requires, listens on and grants is its manifest's. A module whose resources runs holds none // of is its Stub, as before. func Carried(m catalogue.Manifest, module string, runs *engcomp.Composed) catalogue.Manifest { + stub := carried(m, module, runs) + if catalogue.IsToolRunner(m) && (len(stub.Bundles) != 1 || stub.Bundles[0].Binary == "") { + if b, ok := runningProgram(module, runs); ok { + stub.Bundles = []catalogue.Bundle{b} + } + } + return stub +} + +// runningProgram is the program bundle of the tool runner as it runs on the node: its process's source, digest and binary. +// A held tool runner keeps it, so a module of its own account is run by the same program the node runs (novox/hq ADR 0259 +// ยง8) and is not held for want of a runtime that runs (lead-47 2026-11-16: novox's tool runner was held for a build the +// catalog half held no entry of, and held the new indexer with it). +func runningProgram(module string, runs *engcomp.Composed) (catalogue.Bundle, bool) { + if runs == nil { + return catalogue.Bundle{}, false + } + for _, raw := range runs.Resources { + var r struct { + ID string `json:"id"` + Module string `json:"module"` + Type string `json:"type"` + Source string `json:"source"` + Digest string `json:"digest"` + Run []string `json:"run"` + } + if json.Unmarshal(raw, &r) != nil || r.Type != "process" || r.Source == "" || r.Digest == "" || len(r.Run) == 0 { + continue + } + owner := r.Module + if owner == "" { + owner, _ = declaration.ModuleGuess(r.ID) + } + binary, ok := strings.CutPrefix(r.Run[0], "./") + if owner != module || !ok || binary == "" || strings.Contains(binary, "/") { + continue + } + return catalogue.Bundle{Name: "program", Source: registryforms.Forms.Recorded(r.Source), Digest: r.Digest, Binary: binary}, true + } + return catalogue.Bundle{}, false +} + +func carried(m catalogue.Manifest, module string, runs *engcomp.Composed) catalogue.Manifest { if runs == nil { return Stub(m) }