A closing keeps the review round, get says the round, a close waits for the operator's round-5 answer (issue 784, ADR 0665)

Claude-Session: https://claude.ai/code/session_01JG73KK8HD1gufnqyFxMFdW
This commit is contained in:
2026-11-09 23:20:22 +01:00
parent 62644aa012
commit 09ea4a40bf
4 changed files with 72 additions and 7 deletions
@@ -85,6 +85,10 @@ func (k *KB) Close(caller string, a CloseAsk) (*Closed, error) {
if cur.Retracting != nil {
return nil, fmt.Errorf("%s has a retraction waiting for the operator; nothing was closed", key)
}
if w := e.Working(); w.Ask != nil && w.Ask.Said == AskWaiting && w.Ask.Round > 0 {
return nil, fmt.Errorf("%s is at round %d of its review, which asked changes: the operator decides it, and no review runs before the "+
"answer. Nothing was closed; close it after the operator's answer", key, w.Ask.Round)
}
want := closeLinkKind[a.To]
var added []Link
var refusals []Refusal
@@ -111,7 +115,11 @@ func (k *KB) Close(caller string, a CloseAsk) (*Closed, error) {
name = fmt.Sprintf("%s (%d)", closeSection[a.To], n)
}
r.Sections = append(r.Sections, Section{Name: name, Text: note})
r.Reviews, r.Ask, r.Retracting = nil, nil, nil
r.Reviews, r.CountFrom, r.Ask, r.Retracting = nil, 0, nil, nil
if e.Pending != nil {
// The closing keeps the round count of the version it replaces (ADR 0665 §1).
r.Reviews, r.CountFrom = e.Pending.Reviews, e.Pending.CountFrom
}
r.NeedsOperator, r.Brief = false, nil
r.Author = caller
r.Writers = append([]string{}, cur.Writers...)
@@ -243,7 +251,8 @@ func ClosingQuestion(r *Record, from string, linked []*Record) string {
b.WriteString("the note says why it is parked as an idea. A closing to an idea takes no links: never ask for one.")
}
b.WriteString(" Answer changes otherwise, with findings, each naming the note or the link and saying what to change. " +
"Do not ask for changes of taste or wording that leave the meaning as it is.\n\n")
"Do not ask for changes of taste or wording that leave the meaning as it is.\n")
b.WriteString(roundText(r) + "\n")
fmt.Fprintf(&b, "The note, section %q:\n\n%s\n\n", c.Section, c.Note)
if c.To == StatusGraduated {
b.WriteString("The became links the effort carries, those it carried before and those the closing adds:\n")