From 5ad36127ee8bf3a5c3c99dc4821a78a9a98f9b88 Mon Sep 17 00:00:00 2001 From: jochen Date: Mon, 12 Oct 2026 16:50:59 +0200 Subject: [PATCH] Hold the plans schema's longest bound to the value, and say what a slow store gives (review 75) --- cmd/mesh-controller/plans_follow.go | 2 ++ cmd/mesh-controller/plans_follow_test.go | 15 +++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/cmd/mesh-controller/plans_follow.go b/cmd/mesh-controller/plans_follow.go index c13dedc7..daaaeed7 100644 --- a/cmd/mesh-controller/plans_follow.go +++ b/cmd/mesh-controller/plans_follow.go @@ -26,6 +26,8 @@ import ( var maxPlanWait = link.LongestAnswer - planWaitStart // planWaitStart is what the verb's window allows beyond the bound: starting the command and opening the stores. +// A store slow enough to push the read and the answer past it degrades as any long call does: the caller is +// answered that the call is still running, and `calls` with its id says what came of it. const planWaitStart = 5 * time.Second // planWaitEvery is how often a wait reads the plan again. diff --git a/cmd/mesh-controller/plans_follow_test.go b/cmd/mesh-controller/plans_follow_test.go index 844b99e7..b3932d59 100644 --- a/cmd/mesh-controller/plans_follow_test.go +++ b/cmd/mesh-controller/plans_follow_test.go @@ -179,3 +179,18 @@ func TestAPlanFollowedFromTheStoreAnswersWhenItMoves(t *testing.T) { t.Fatalf("a plan that did not move answered %+v (%v)", got, err) } } + +// The verb's schema says the longest bound in words, and the words are the value (review 75 on #266): the +// catalogue cannot read maxPlanWait, so this holds them together. +func TestThePlansSchemaSaysTheLongestBoundThereIs(t *testing.T) { + v, ok := controllerVerb("plans") + if !ok { + t.Fatal("no plans verb") + } + props, _ := v.Input["properties"].(map[string]any) + bound, _ := props["bound"].(map[string]any) + said, _ := bound["description"].(string) + if !strings.Contains(said, maxPlanWait.String()+", the default, is the longest") { + t.Fatalf("the schema says %q; the longest bound is %s", said, maxPlanWait) + } +}