nats: a recreate's ask takes its words from the per-object lines, recreated's before names the held cap

Builds: design 47 H2 H-A-686 (3), H-A-740
This commit is contained in:
2026-11-25 18:52:08 +01:00
parent cda35e6c42
commit b15c220822
4 changed files with 22 additions and 5 deletions
+3 -3
View File
@@ -189,8 +189,8 @@ func askFor(r keeper.Request, explained string) (oc.Ask, error) {
OnExpiry: "nothing is removed and the entry stays as it is",
About: keeper.ConditionKey(map[string]string{keeper.VerbDrop: "orphaned", keeper.VerbRecreate: "drifted"}[r.Verb], r.Module, r.Local),
Headline: fmt.Sprintf("%s's kept data %s: %s it?", r.Module, r.Local, what),
Explanation: fmt.Sprintf("%s asks to %s %s on the bus, %s. A snapshot of it is taken first; its data is lost from the bus.",
r.Caller, what, name, r.Why) + explained,
Explanation: fmt.Sprintf("%s asks to %s %s on the bus, %s. A snapshot of it is taken first.", r.Caller, what, name, r.Why) +
map[bool]string{true: " Its data is lost from the bus."}[r.Verb == keeper.VerbDrop] + explained,
Options: []oc.Option{
{ID: "go", Label: strings.ToUpper(what[:1]) + what[1:], Does: fmt.Sprintf("%s %s after a snapshot", what, name), Level: occ.Approve, Binds: binds},
{ID: "keep", Label: "Keep it", Does: "nothing is removed", Level: occ.Acknowledge},
@@ -349,7 +349,7 @@ func requestTools(rs requestStore) []stdio.Tool {
firstView,
tool(keeper.VerbCreate, "Create one entry of a module's kept data on the bus now, as its accepted manifest asks for it (design 25 § 12.3): handed to the bus module's keeper, which alone may create, and recorded as a hand act."),
tool(keeper.VerbApply, "Apply what a module's manifest asks of one entry where the bus holds less (a larger cap, a longer age): only a difference that grows; handed to the keeper and recorded as a hand act."),
tool(keeper.VerbRecreate, "Rebuild one entry whose settings drifted in a way that does not grow: the operator is asked first, and the keeper acts only on their warrant, after a snapshot of the entry. Its data is lost from the bus (the snapshot keeps it). Dangerous."),
tool(keeper.VerbRecreate, "Rebuild one entry whose settings drifted in a way that does not grow: the operator is asked first, and the keeper acts only on their warrant, after a snapshot of the entry. The ask names, per object, what is kept and what is made empty (the snapshot keeps the data). Dangerous."),
tool(keeper.VerbDrop, "Remove one orphan, an entry no accepted manifest asks for: the operator is asked first, and the keeper acts only on their warrant, after a snapshot of the entry. Dangerous."),
}
}
@@ -236,4 +236,11 @@ func TestTheAskOfARecreateNamesEachObjectAndWhatItRemoves(t *testing.T) {
if err != nil || !strings.Contains(ask.Explanation, "42 messages older than the age") {
t.Fatalf("the ask %+v %v", ask, err)
}
// The recreate's words come from the per-object lines, which keep the data: it never says the data is lost (H-A-686 (3)).
if strings.Contains(ask.Explanation, "lost from the bus") {
t.Errorf("the recreate's ask says its data is lost: %s", ask.Explanation)
}
if drop, _ := askFor(keeper.Request{Verb: keeper.VerbDrop, Module: "m", Local: "records", Why: "w", Caller: "c", AskExpires: now}, ""); !strings.Contains(drop.Explanation, "lost from the bus") {
t.Errorf("the drop's ask does not say its data is lost: %s", drop.Explanation)
}
}