knowledge-base: retract an accepted record or its clauses on the operator's Approve

The operator prefers removing a wrong decision to stacking a correcting
record on it, and withdraw took only reserved or proposed records. retract
asks the operator through the router like a record that needs the operator,
and changes nothing until the Approve; a retracted record or clause no longer
holds in ask, holds, get, links and progress, history keeps every version, and
the whole-set rules still read a retracted record's links so a retraction alone
raises no finding. withdraw with retraction true takes a waiting one back.
This commit is contained in:
2026-10-31 10:07:58 +01:00
parent a68b39f7b5
commit f19e3ccffd
17 changed files with 856 additions and 51 deletions
@@ -338,6 +338,9 @@ func (k *KB) Propose(caller string, a ProposeAsk) (*Proposed, error) {
if why == "" {
why = "revised"
}
case held.Current.Accepted() && held.Current.Retracting != nil:
return nil, fmt.Errorf("%s has a retraction waiting for the operator: it takes no new version until that is answered or "+
"withdrawn. Nothing was proposed", key)
case held.Current.Accepted():
if held.Pending != nil && (!proven(caller) || caller != held.Pending.Author) {
return nil, fmt.Errorf("%s has a progressive insight by %s waiting for its review: only its author, proven by the "+
@@ -448,12 +451,13 @@ func (k *KB) accept(ctx context.Context, held *Entry, w *Record, by, why, warran
r.Insights = append(r.Insights, in)
}
r.Status = held.Current.Status
r.Retractions = held.Current.Retractions
if r.Kind == KindResearch && contains(ResearchStatuses, r.Effort) && held.Current.Status != StatusSuperseded {
r.Status = r.Effort
}
for i, c := range r.Clauses {
r.Clauses[i].Status = ClauseInForce
if old := held.Current.Clause(c.N); old != nil && (old.Status == ClauseChanged || old.Status == ClauseSuperseded) {
if old := held.Current.Clause(c.N); old != nil && (old.Status == ClauseChanged || old.Status == ClauseSuperseded || old.Status == ClauseRetracted) {
r.Clauses[i].Status, r.Clauses[i].ChangedBy = old.Status, old.ChangedBy
}
}