CAT-K6: a version is reviewed in parts: the head and each section, a part judged again only when its text or what it names changes
One judgement per part with no tools, at most two at once; a section is read with its frame (the clauses and records it names and the digest of its Context), so a usual revision judges only what changed. The latest approval of each part is kept in the head and carried to the next version; a part that could not be judged keeps the others' verdicts and is the only one asked again; reviewed is said once per version and each verdict as part-reviewed on the stream reviews. A part in flight is a key of the state asked. A version is accepted when every part approves; findings name their part. Issue 1966. Claude-Session: https://claude.ai/code/session_01JG73KJNrH5EgFXMKKYSrig
This commit is contained in:
@@ -159,7 +159,7 @@ func ReviewQuestion(r *Record, linked []*Record) string {
|
||||
// graduated or abandoned, which it takes once accepted) are shown apart, each named for what it is (hq issue 492).
|
||||
func reviewed(r *Record) *Record {
|
||||
c := r.Clone()
|
||||
c.Reviews, c.Ask, c.Judging, c.Drafting, c.Writers, c.Author = nil, nil, nil, nil, nil, ""
|
||||
c.Reviews, c.Ask, c.Judging, c.Drafting, c.Writers, c.Author, c.Parts = nil, nil, nil, nil, nil, "", nil
|
||||
c.Extra = addExtra(c.Extra, "state in the knowledge base", c.Status+" (every record under review is; it is not the record's own status)")
|
||||
if c.Kind == KindResearch && c.Effort != "" {
|
||||
c.Extra = addExtra(c.Extra, "research status", c.Effort)
|
||||
@@ -429,33 +429,32 @@ func (k *KB) reviewOne(key Key) (string, error) {
|
||||
return "", err
|
||||
}
|
||||
w := e.Working()
|
||||
question := ReviewQuestion(w, linked)
|
||||
var verdict string
|
||||
var findings []string
|
||||
parts := partsOf(w, linked)
|
||||
var owed []reviewPart
|
||||
for _, p := range parts {
|
||||
if keptPart(w, p) == nil {
|
||||
owed = append(owed, p)
|
||||
}
|
||||
}
|
||||
by := ReviewBy
|
||||
uncited := ""
|
||||
if allErr == nil {
|
||||
uncited = UncitedOnAcceptance(w, all)
|
||||
}
|
||||
var results []partResult
|
||||
switch {
|
||||
case allErr != nil:
|
||||
err = fmt.Errorf("the record set cannot be read to judge whether a record cites it: %v", allErr)
|
||||
case uncited != "":
|
||||
// The whole-set rule cited, judged ahead: changes, asked by the knowledge base itself without a judgement,
|
||||
// so its acceptance never turns the module's health red for it (novox/hq issue 504).
|
||||
verdict, findings = VerdictChanges, []string{"the rule cited, which judges the whole record set: " + uncited}
|
||||
case len(question) > MostReviewQuestion:
|
||||
err = fmt.Errorf("the record is %d bytes as a question, and a judgement takes at most %d: shorten it", len(question), MostReviewQuestion)
|
||||
// so its acceptance never turns the module's health red for it (novox/hq issue 504). It is no part's verdict:
|
||||
// it holds only while nothing cites the record.
|
||||
default:
|
||||
var answer json.RawMessage
|
||||
var judge string
|
||||
answer, judge, err = k.Judge(question, reviewSchema, k.judgeModel())
|
||||
if err != nil {
|
||||
err = fmt.Errorf("the judgement could not be had: %v", err)
|
||||
} else {
|
||||
verdict, findings, err = readVerdict(answer)
|
||||
if judge != "" {
|
||||
by = judge
|
||||
results = k.judgeParts(owed, key)
|
||||
for _, r := range results {
|
||||
if r.err != nil {
|
||||
err = r.err
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -474,10 +473,25 @@ func (k *KB) reviewOne(key Key) (string, error) {
|
||||
if now.Pending != nil {
|
||||
version = now.PendingVersion
|
||||
}
|
||||
for _, r := range results {
|
||||
if r.err == nil && r.by != "" {
|
||||
by = r.by
|
||||
break
|
||||
}
|
||||
}
|
||||
save := func(r *Record, why string) error {
|
||||
return k.Store.Save(ctx, Version{By: by, At: k.now(), Why: why, Record: r, Insight: now.Pending != nil && now.Pending.IsInsight()},
|
||||
now.Pending == nil, false, now.Revision)
|
||||
}
|
||||
if uncited == "" {
|
||||
// The parts judged now keep their verdicts, also when another part could not be judged: a retry asks only those.
|
||||
foldParts(w, parts, results, by, version, k.now())
|
||||
for _, r := range results {
|
||||
if r.err == nil {
|
||||
k.partReviewed(w, r, version)
|
||||
}
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
// No verdict: the record stays proposed and says so. Never an approval.
|
||||
w.Judging = failedJudging(w.Judging.Tries+1, err.Error(), k.now())
|
||||
@@ -491,6 +505,18 @@ func (k *KB) reviewOne(key Key) (string, error) {
|
||||
}
|
||||
tries := w.Judging.Tries
|
||||
w.Judging = nil
|
||||
verdict, findings := VerdictApprove, []string(nil)
|
||||
if uncited != "" {
|
||||
verdict, findings = VerdictChanges, []string{"the rule cited, which judges the whole record set: " + uncited}
|
||||
}
|
||||
for _, p := range w.Parts {
|
||||
if p.Verdict == VerdictChanges {
|
||||
verdict = VerdictChanges
|
||||
for _, f := range strings.Split(p.Findings, "\n") {
|
||||
findings = append(findings, "["+p.Part+"] "+f)
|
||||
}
|
||||
}
|
||||
}
|
||||
w.Reviews = append(w.Reviews, Review{By: by, At: k.now(), Verdict: verdict, Findings: strings.Join(findings, "\n"), Version: version})
|
||||
if verdict == VerdictChanges {
|
||||
why := fmt.Sprintf("reviewed: changes asked (%d finding(s)); it stays proposed for its author to revise", len(findings))
|
||||
|
||||
Reference in New Issue
Block a user