Carry each contribution, composed, and the consumer's address in its plan entry, and let a process read another module's state, so route-proxy serves routes from the seat's plans alone (issue 774, research 072 row 34)

This commit is contained in:
2026-10-31 09:27:26 +01:00
parent a320f8e2cd
commit a4e7629742
6 changed files with 121 additions and 5 deletions
+9 -1
View File
@@ -75,8 +75,9 @@ func TestAModuleNotHandedHasAPlanForWhatAHelperAnswers(t *testing.T) {
consumer := notifierConsumer(t, false, false)
consumer.Requires = append(consumer.Requires, "route")
consumer.Contributes = map[string]map[string]any{"route": {"host": "notify.example.org"}}
consumer.ContributesMany = map[string]map[string]map[string]any{"route": {"api": {"label": "notify-api", "port": 9000}}}
node := workstation()
node.At = "workstation.internal"
node.At, node.PublicDomain = "workstation.internal", "example.org"
proxy := Manifest{Module: "proxy", Version: "1", Provides: []Offer{{Name: "route", Scope: ScopeMesh, AnsweredBy: AnsweredByHelper}}}
store := Manifest{Module: "store", Version: "1", Provides: []Offer{{Name: "postgres-database", Scope: ScopeMesh,
Credential: &OfferCredential{Form: CredentialFormPair}}}, Serves: map[string]map[string]any{"postgres-database": {"port": 5432}}}
@@ -104,6 +105,13 @@ func TestAModuleNotHandedHasAPlanForWhatAHelperAnswers(t *testing.T) {
!strings.Contains(plan.Provisions[0].As, "notify") || plan.Provisions[0].Contributes["host"] != "notify.example.org" {
t.Fatalf("the plan names %+v", plan)
}
// What it contributes, composed as a received file carried it, and where its machine is (issue 774, research 072
// row 34): route-proxy serves the route from the plan alone.
if g := plan.Provisions[0].Given; len(g) != 2 || g[0].Local != "" || g[0].Values["host"] != "notify.example.org" ||
g[1].Local != "api" || g[1].Values["name"] != "notify-api.example.org" || g[1].Values["port"] != 9000 ||
plan.Provisions[0].ConsumerAt != "workstation.internal" {
t.Fatalf("the plan gives %+v at %q", g, plan.Provisions[0].ConsumerAt)
}
// And it hands nothing: Plan.Hands, the one rule every reader of a plan asks, by each part a plan can name.
if plan.Hands() {
t.Fatalf("a plan naming the route alone hands its module: %+v", plan)