Test the grants of the bridge's file read and the indexer's manifests bucket (issues 1448, 1449, design 47 R4c-2)
mesh/repo-check head e7c6abfd0e3c merged into trunk f2d7bc94800d — pass: its merge-check.sh passed
mesh/merge-gate head e7c6abfd0e3c merged into trunk f2d7bc94800d — pass: group feat/r4c2-new-keys composed: every machine composes with the change as it di…
mesh/delivery delivered
mesh/delivery-group group feat/r4c2-new-keys delivered: every member is delivered

This commit is contained in:
2026-10-20 18:56:37 +00:00
parent b75fb7899e
commit e7c6abfd0e
+17 -12
View File
@@ -13,9 +13,11 @@ import (
// and streams, `reads` watching another module's bucket and never writing it, `consumes` hearing the named events,
// `invokes` calling the named tools, `uses` the seat operator-channel's by-caller subjects under the module's own name.
//
// The four manifests (the watchman's is the fourth, issue 1329) are copied from mesh-delivery's main at 9c15112d935a
// (modules/<module>/module.json, read 2026-10-20; the first three are unchanged since 6a23627426c6), whole, so a change
// to one of them there that changes its grant is a change to read here.
// The four manifests (the watchman's is the fourth, issue 1329): the bridge's and the indexer's are copied whole from
// mesh-delivery's branch feat/r4c2-new-keys at b7870ac9a6386467318454e9d5d4790987eb708d (modules/<module>/module.json,
// read 2026-10-20; issues 1448 and 1449 add the bridge's gitea_get_file and performed bucket and the indexer's manifests
// bucket), the teller's and the watchman's from mesh-delivery's main at 9c15112d935a, whole, so a change to one of them
// there that changes its grant is a change to read here.
const bridgeManifest = `{
"module": "mesh-delivery-forge-bridge",
"version": "1",
@@ -29,7 +31,8 @@ const bridgeManifest = `{
{ "name": "forge", "events": ["forge.**"] }
],
"state": [
{ "name": "heads", "history": 1 }
{ "name": "heads", "history": 1 },
{ "name": "performed", "history": 1 }
],
"reads": [
"mesh-delivery-gate.merges",
@@ -42,7 +45,8 @@ const bridgeManifest = `{
"gitea.gitea_note_append",
"gitea.gitea_add_comment",
"gitea.gitea_open_pulls",
"gitea.gitea_commit_trees"
"gitea.gitea_commit_trees",
"gitea.gitea_get_file"
],
"own-secrets": {
"broker": "${dir:state}/broker"
@@ -104,6 +108,7 @@ const indexerManifest = `{
],
"state": [
{ "name": "candidates", "history": 10 },
{ "name": "manifests", "history": 1 },
{ "name": "modules", "history": 20 }
],
"reads": [
@@ -437,8 +442,8 @@ func TestEachPartsCredentialGrantsExactlyItsDeclaration(t *testing.T) {
all := composed(t, partsRecords(t))
bridge, indexer, teller := all["mesh-delivery-forge-bridge@novox"], all["mesh-delivery-indexer@novox"], all["mesh-delivery-teller@novox"]
// The forge bridge: state heads, the stream FORGE, reads merges and owed, invokes seven tools of the forge.
if got, want := withPrefix(bridge.Publish, "$KV."), []string{"$KV.mesh-delivery-forge-bridge_heads.>"}; !slices.Equal(got, want) {
// The forge bridge: state heads and performed, the stream FORGE, reads merges and owed, invokes eight tools of the forge.
if got, want := withPrefix(bridge.Publish, "$KV."), []string{"$KV.mesh-delivery-forge-bridge_heads.>", "$KV.mesh-delivery-forge-bridge_performed.>"}; !slices.Equal(got, want) {
t.Errorf("the bridge writes %v; want exactly %v", got, want)
}
if got, want := eventsSaid(bridge), []string{"mesh.stream.mesh-delivery-forge-bridge.event.forge.>"}; !slices.Equal(got, want) {
@@ -458,7 +463,7 @@ func TestEachPartsCredentialGrantsExactlyItsDeclaration(t *testing.T) {
t.Error("the bridge hears an event of gitea's it does not consume")
}
called := []string{"gitea_add_comment", "gitea_commit_status", "gitea_commit_trees", "gitea_delivery_view",
"gitea_merge_pull_request", "gitea_note_append", "gitea_open_pulls"}
"gitea_get_file", "gitea_merge_pull_request", "gitea_note_append", "gitea_open_pulls"}
if got := toolsCalled(bridge, "gitea"); !slices.Equal(got, called) {
t.Errorf("the bridge calls %v; want exactly %v", got, called)
}
@@ -466,8 +471,8 @@ func TestEachPartsCredentialGrantsExactlyItsDeclaration(t *testing.T) {
t.Error("the bridge may call a tool of gitea's it does not invoke")
}
// The indexer: state candidates and modules, reads the controller's builds and the gate's source, hears FORGE.
if got, want := withPrefix(indexer.Publish, "$KV."), []string{"$KV.mesh-delivery-indexer_candidates.>", "$KV.mesh-delivery-indexer_modules.>"}; !slices.Equal(got, want) {
// The indexer: state candidates, manifests and modules, reads the controller's builds and the gate's source, hears FORGE.
if got, want := withPrefix(indexer.Publish, "$KV."), []string{"$KV.mesh-delivery-indexer_candidates.>", "$KV.mesh-delivery-indexer_manifests.>", "$KV.mesh-delivery-indexer_modules.>"}; !slices.Equal(got, want) {
t.Errorf("the indexer writes %v; want exactly %v", got, want)
}
if got := eventsSaid(indexer); len(got) != 0 {
@@ -509,7 +514,7 @@ func TestNoPartsCredentialReachesBeyondItsDeclaration(t *testing.T) {
all := composed(t, partsRecords(t))
parts := []string{"mesh-delivery-forge-bridge", "mesh-delivery-indexer", "mesh-delivery-teller"}
buckets := map[string][]string{
"mesh-delivery-forge-bridge": {"heads"}, "mesh-delivery-indexer": {"candidates", "modules"},
"mesh-delivery-forge-bridge": {"heads", "performed"}, "mesh-delivery-indexer": {"candidates", "manifests", "modules"},
"mesh-delivery-teller": {"answers"}, "mesh-delivery-gate": {"merges", "owed", "source", "asks", "deliveries"},
"mesh-controller": {"builds", "plans"},
}
@@ -570,7 +575,7 @@ func TestTheToolRunnerCarriesNoneOfTheDeliverysParts(t *testing.T) {
}}})
runner := all["runner@novox"]
buckets := map[string][]string{
"mesh-delivery-forge-bridge": {"heads"}, "mesh-delivery-indexer": {"candidates", "modules"},
"mesh-delivery-forge-bridge": {"heads", "performed"}, "mesh-delivery-indexer": {"candidates", "manifests", "modules"},
"mesh-delivery-teller": {"answers"}, "mesh-delivery-watchman": {"presence", "pulse", "stuck"},
}
for part, names := range buckets {