The knowledge base's review knows its round: from round 3 only a wrong record asks changes, at round 5 the operator decides (issue 784, ADR 0665)
Claude-Session: https://claude.ai/code/session_01JG73KK8HD1gufnqyFxMFdW
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
package main
|
||||
|
||||
// The review knows its round (novox/hq ADR 0665, issue 784). A record's round is the number of its reviews since the
|
||||
// last of: it was accepted, it was first proposed, the operator declined it at round MostReviewRounds, plus one.
|
||||
// Reviews belong to the version being worked (a pending version starts with none) and CountFrom marks the Decline,
|
||||
// so the count is what is on the record. The question names the round and lists the earlier findings of the count;
|
||||
// from round OnlyWrongFrom only a finding that makes the record wrong asks changes; at round MostReviewRounds a
|
||||
// review that asks changes becomes an ask of the operator (askOperator with a round), and no review runs before the
|
||||
// answer (Propose refuses a revision meanwhile).
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
const (
|
||||
// MostReviewRounds is the round at which the operator decides.
|
||||
MostReviewRounds = 5
|
||||
// OnlyWrongFrom is the first round in which only a finding that makes the record wrong asks changes.
|
||||
OnlyWrongFrom = 3
|
||||
// MostEarlierFindings bounds the earlier findings a question lists, the latest rounds kept.
|
||||
MostEarlierFindings = 6 << 10
|
||||
)
|
||||
|
||||
// Round is the round of the next review of r.
|
||||
func (r *Record) Round() int {
|
||||
from := r.CountFrom
|
||||
if from > len(r.Reviews) {
|
||||
from = len(r.Reviews)
|
||||
}
|
||||
return len(r.Reviews) - from + 1
|
||||
}
|
||||
|
||||
// roundText is what every part's question says of the round: its number, what the round allows, and the findings
|
||||
// of the earlier rounds of the count.
|
||||
func roundText(r *Record) string {
|
||||
round := r.Round()
|
||||
var b strings.Builder
|
||||
fmt.Fprintf(&b, "\nThis is round %d of its review. At round %d the operator decides, so name every finding at once; "+
|
||||
"a finding an earlier round named and the record answered is not named again.\n", round, MostReviewRounds)
|
||||
if round >= OnlyWrongFrom {
|
||||
b.WriteString("From round 3 only a finding that makes the record wrong asks changes: two of its parts contradict each other, " +
|
||||
"or it contradicts a clause in force of a record it links without changing or superseding that clause, or it breaks one of the " +
|
||||
"rules above, or a link the whole-set rule needs is missing. Anything else, such as wording, a further case, a nicer form or a " +
|
||||
"detail its design can hold, is a remark: answer approve and give it as a finding under approve.\n")
|
||||
}
|
||||
var earlier []string
|
||||
for i := r.CountFrom; i < len(r.Reviews) && i >= 0; i++ {
|
||||
if rv := r.Reviews[i]; rv.Verdict == VerdictChanges && strings.TrimSpace(rv.Findings) != "" {
|
||||
earlier = append(earlier, fmt.Sprintf("Round %d (version %d) asked changes:\n%s\n", i-r.CountFrom+1, rv.Version, rv.Findings))
|
||||
}
|
||||
}
|
||||
size, from := 0, len(earlier)
|
||||
for from > 0 && size+len(earlier[from-1]) <= MostEarlierFindings {
|
||||
from--
|
||||
size += len(earlier[from])
|
||||
}
|
||||
if from < len(earlier) {
|
||||
b.WriteString("\nThe findings of the earlier rounds:\n")
|
||||
if from > 0 {
|
||||
fmt.Fprintf(&b, "(%d earlier round(s) are not shown: the question has no room for them.)\n", from)
|
||||
}
|
||||
b.WriteString(strings.Join(earlier[from:], "\n"))
|
||||
}
|
||||
return b.String()
|
||||
}
|
||||
Reference in New Issue
Block a user