knowledge-base: keep a retraction from being undone by a later acceptance or a redraft
mesh/delivery merged: source.main moved to novox/mesh-catalog@65fad0ae1c31
mesh/check being carried to 5d50b952d4cb on 65fad0ae1c31 | from a68b39f7b512

A record proposed before a retraction and accepted after it marked the
retracted clause changed or the retracted record superseded, serving it again;
and returning a drafted record numbered its clauses anew, bringing retracted
ones back in force or making a waiting Approve mark another clause. accept now
leaves what is retracted alone, Return refuses a record with a retraction, and
retract waits until a record's drafting is done.
This commit is contained in:
2026-10-31 10:16:56 +01:00
parent f19e3ccffd
commit 5d50b952d4
5 changed files with 88 additions and 5 deletions
@@ -500,6 +500,16 @@ func (k *KB) Return(caller string, key Key, reason string) (map[string]any, erro
return nil, fmt.Errorf("the knowledge base holds no %s", key)
}
r := e.Current.Clone()
if r.Retracting != nil || len(r.Retractions) > 0 {
// Drafting again numbers the clauses anew and brings them back in force: a retraction waiting would mark
// another clause than the operator was shown, and one approved would be undone.
which := "approved"
if r.Retracting != nil {
which = "waiting"
}
return nil, fmt.Errorf("%s is not returned: it has a retraction %s, which drafting it again would undo or point at other "+
"clauses. Withdraw a waiting retraction first; a retracted record or clause stays so", key, which)
}
if r.Drafting == nil {
return nil, fmt.Errorf("%s's clauses were written by its author, not drafted: a written clause is changed by a new record", key)
}