A graduated closing is judged on every became link the effort carries, carried ones too, each with its record's title and status (issue 784, ADR 0630 §2)
mesh/delivery merged: source.main moved to novox/mesh-catalog@8acad77d33f9
mesh/check being carried to 46505d42d8fb on 8acad77d33f9 | from d2f326dff40e
mesh/delivery merged: source.main moved to novox/mesh-catalog@8acad77d33f9
mesh/check being carried to 46505d42d8fb on 8acad77d33f9 | from d2f326dff40e
Claude-Session: https://claude.ai/code/session_01JG73KG7AfSdh6FP8VrBqCn
This commit is contained in:
@@ -2,6 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
@@ -171,14 +172,10 @@ func TestAGraduatingCloseReadsTheBecameLinksTheEffortCarries(t *testing.T) {
|
||||
}
|
||||
|
||||
// ADR 0630 §2: the review of a closing sees the closing alone, so a record over the judgement's limit is reviewable;
|
||||
// an idea's closing takes no links and the question says so (§1).
|
||||
// an idea's closing takes no links and the question says so (§1); a graduated closing is judged on every became link
|
||||
// the effort carries, the carried ones too, each with its record's title and status.
|
||||
func TestAClosingOfARecordOverTheJudgementLimitIsReviewed(t *testing.T) {
|
||||
w := imported(t, newMemStore())
|
||||
n := w.effort(t, StatusActive)
|
||||
key := Key{KindResearch, n}
|
||||
e := mustGet(t, w.k.Store, key)
|
||||
big := e.Current.Clone()
|
||||
big.Sections = append(big.Sections, Section{Name: "01-findings.md", Text: "OLD-FINDING " + strings.Repeat("The effort measured one more thing. ", 2200)})
|
||||
// An old link to a decision with long clauses: the old question carried every clause of every linked record.
|
||||
var long []Clause
|
||||
for i := 1; i <= 20; i++ {
|
||||
@@ -186,27 +183,49 @@ func TestAClosingOfARecordOverTheJudgementLimitIsReviewed(t *testing.T) {
|
||||
}
|
||||
seedRecord(t, w.k.Store, &Record{Kind: KindDecision, Number: 9000, Title: "a long decision", Status: StatusAccepted, Topic: "the mesh",
|
||||
Clauses: long}, time.Now())
|
||||
big.Links = append(big.Links, Link{Kind: LinkTouches, To: Ref{Kind: KindDecision, Number: 9000}, Source: SourceWritten})
|
||||
if len(ReviewQuestion(big, nil)) <= MostReviewQuestion {
|
||||
t.Fatal("the seeded record is not over the judgement's limit")
|
||||
}
|
||||
if err := w.k.Store.Save(context.Background(), Version{By: "import@test", At: time.Now(), Why: "seeded", Record: big}, true, false, e.Revision); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if _, err := w.k.Close("lead@shanks", CloseAsk{Number: n, To: StatusIdea, Note: "Parked: nothing carries it this month."}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
w.judge.reviews = nil
|
||||
said := w.reviewAll(t)
|
||||
if len(w.judge.reviews) != 1 {
|
||||
t.Fatalf("not judged: %v", said)
|
||||
}
|
||||
q := w.judge.reviews[0]
|
||||
if strings.Contains(q, "OLD-FINDING") || strings.Contains(q, "A long clause") || len(q) > MostReviewQuestion || !strings.Contains(q, "takes no links") ||
|
||||
!strings.Contains(q, "served as active") {
|
||||
t.Errorf("the question is not the closing alone (%d bytes):\n%.700s", len(q), q)
|
||||
}
|
||||
if got := mustGet(t, w.k.Store, key).Current.Status; got != StatusIdea {
|
||||
t.Errorf("after the review: %s", got)
|
||||
adr := mustGet(t, w.k.Store, Key{KindDecision, 290}).Current
|
||||
becameADR := Link{Kind: LinkBecame, To: Ref{Kind: KindDecision, Number: 290}, Source: SourceWritten}
|
||||
for _, c := range []struct {
|
||||
name, to string
|
||||
carried []Link
|
||||
want []string
|
||||
}{
|
||||
{"to an idea", StatusIdea, nil, []string{"takes no links", "The links the closing adds:\n- none"}},
|
||||
{"to graduated, its became carried", StatusGraduated, []Link{becameADR, becameADR},
|
||||
[]string{"- became ADR 0290\n", fmt.Sprintf("- ADR 0290. %s (%s)\n", clip(adr.Title, 200), StatusAccepted)}},
|
||||
} {
|
||||
n := w.effort(t, StatusActive)
|
||||
key := Key{KindResearch, n}
|
||||
e := mustGet(t, w.k.Store, key)
|
||||
big := e.Current.Clone()
|
||||
big.Sections = append(big.Sections, Section{Name: "01-findings.md", Text: "OLD-FINDING " + strings.Repeat("The effort measured one more thing. ", 2200)})
|
||||
big.Links = append(big.Links, Link{Kind: LinkTouches, To: Ref{Kind: KindDecision, Number: 9000}, Source: SourceWritten})
|
||||
big.Links = append(big.Links, c.carried...)
|
||||
if len(ReviewQuestion(big, nil)) <= MostReviewQuestion {
|
||||
t.Fatalf("%s: the seeded record is not over the judgement's limit", c.name)
|
||||
}
|
||||
if err := w.k.Store.Save(context.Background(), Version{By: "import@test", At: time.Now(), Why: "seeded", Record: big}, true, false, e.Revision); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if _, err := w.k.Close("lead@shanks", CloseAsk{Number: n, To: c.to, Note: closeNote("0290")}); err != nil {
|
||||
t.Fatalf("%s: %v", c.name, err)
|
||||
}
|
||||
w.judge.reviews = nil
|
||||
said := w.reviewAll(t)
|
||||
if len(w.judge.reviews) != 1 {
|
||||
t.Fatalf("%s: not judged: %v", c.name, said)
|
||||
}
|
||||
q := w.judge.reviews[0]
|
||||
bad := strings.Contains(q, "OLD-FINDING") || strings.Contains(q, "A long clause") || strings.Contains(q, "a long decision") ||
|
||||
len(q) > MostReviewQuestion || !strings.Contains(q, "served as active") || strings.Count(q, "ADR 0290. ") > 1
|
||||
for _, s := range c.want {
|
||||
bad = bad || !strings.Contains(q, s)
|
||||
}
|
||||
if bad {
|
||||
t.Errorf("%s: the question is not the closing alone (%d bytes):\n%.1500s", c.name, len(q), q)
|
||||
}
|
||||
if got := mustGet(t, w.k.Store, key).Current.Status; got != c.to {
|
||||
t.Errorf("%s: after the review: %s", c.name, got)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user