Indexer: every trunk part and the tool runner may read the catalog half (A-395)

Live on novox the tool runner's first view of catalog-revisions was refused 54 times: the revision verb answered only the parts declaring it in invokes, and the runner reads it for every module it serves.

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
This commit is contained in:
2026-11-14 12:00:53 +01:00
parent 990f6c6598
commit 34e1938df1
2 changed files with 9 additions and 3 deletions
@@ -20,10 +20,13 @@ const RevisionInvoke = "seat:" + meshcatalog.Seat + "." + meshcatalog.VerbRevisi
// RevisionCallers are the parts the newest trunk revision's entries say declare the verb revision in their invokes,
// sorted, the holder itself never among them (ADR 0663 §2: granted to exactly the parts that declare it). A single `*`
// in invokes declares every seat verb, as the grants part reads it (A-390).
//
// Lead answer A-395: every part the newest trunk revision holds may read it, and so may the tool runner, which reads the
// catalog half for each module it serves on that module's or its own account; the holder stays refused.
func RevisionCallers(entries []meshcatalog.CatalogEntry, holder string) stdio.Callers {
var out stdio.Callers
out := stdio.Callers{ToolRunner}
for _, e := range entries {
if e.Module != holder && (slices.Contains(e.Invokes, RevisionInvoke) || slices.Contains(e.Invokes, "*")) {
if e.Module != holder && !slices.Contains(out, e.Module) {
out = append(out, e.Module)
}
}
@@ -31,6 +34,9 @@ func RevisionCallers(entries []meshcatalog.CatalogEntry, holder string) stdio.Ca
return out
}
// ToolRunner is the module of every node's tool runner, the runtime every module's tools run in (A-395).
const ToolRunner = "node-tools"
// Revision answers the seat mesh-catalog's verb revision from the indexer's own objects (ADR 0663 §1, §3): one catalog
// graph revision, the trunk's newest when the input names none, a kept trunk revision by its number, or a candidate's by
// its group and heads, with one page of its entries whole, by module name. The caller is the runtime's proof: it is
@@ -639,7 +639,7 @@ func TestBasesAreComputedFirstAndNoFingerprintTakesTheBuilder(t *testing.T) { //
}
keep(meshcatalog.CatalogRevision{Revision: 3, Kind: "trunk"}, map[string]bool{"node-tools": true, testSelf: true})
keep(meshcatalog.CatalogRevision{Revision: 4, Kind: "candidate", Group: "feat/x", Heads: "0123456789ab"}, map[string]bool{"node-tools": true, "mesh-grants": true})
for caller, answered := range map[string]bool{"n1.node-tools": true, "n1.avahi": true, "n1.mesh-grants": false, "n1." + testSelf: false, "person.someone": false, "unproven": false} {
for caller, answered := range map[string]bool{"n1.node-tools": true, "n1.avahi": true, "n1.mesh-grants": true, "n1." + testSelf: false, "person.someone": false, "unproven": false} {
got, err := Revision(context.Background(), verbObjects, testSelf, caller, meshcatalog.RevisionInput{})
if (err == nil) != answered || (answered && (got.Revision.Revision != 3 || len(got.Entries) != 4 || got.Next != "")) {
t.Errorf("revision to %s answered %+v (%v), want answered %v with trunk revision 3 whole", caller, got, err, answered)