Files
mesh-catalog/modules/mesh-knowledge/cmd/mesh-knowledge/review_sees_test.go
T
jschoubben c5dc10fa8c 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
2026-11-04 12:07:32 +01:00

66 lines
2.6 KiB
Go

package main
import (
"strings"
"testing"
)
// hq issue 492: the first live review (research 046) sent a valid proposal back because the rules it was shown
// named no link kind propose accepts beyond its words, and the record it was shown carried the record's state
// `proposed` where a research effort's status belongs.
// Every link kind propose accepts is named in the rules the judgement sees: one list, so the two cannot drift.
func TestTheReviewIsShownEveryLinkKindProposeAccepts(t *testing.T) {
q := ReviewQuestion(&Record{Kind: KindDecision, Number: 300, Title: "x", Status: StatusProposed}, nil)
for _, kind := range LinkKinds {
if !strings.Contains(q, "- `"+kind+"`: ") {
t.Errorf("the review is not shown the link kind %s", kind)
}
}
for _, kind := range LinkKinds {
if strings.TrimSpace(LinkMeanings[kind]) == "" {
t.Errorf("the link kind %s says nothing of what it means", kind)
}
}
if len(LinkMeanings) != len(LinkKinds) {
t.Errorf("%d meanings for %d link kinds", len(LinkMeanings), len(LinkKinds))
}
}
// A research effort's own status is shown apart from its state in the knowledge base.
func TestTheReviewIsShownAResearchEffortsStatusApartFromItsState(t *testing.T) {
w := imported(t, newMemStore())
r, err := w.k.ReserveNumber("author@g14", KindResearch, "a vendor-neutral inference layer")
if err != nil {
t.Fatal(err)
}
if _, err := w.k.Propose("author@g14", ProposeAsk{Kind: KindResearch, Number: r.Number, Title: "A vendor-neutral inference layer",
Date: "2026-10-11", Deciders: []string{"jochen"}, Status: StatusActive,
Sections: []Section{{Name: "00-overview.md", Text: "What an inference layer the mesh controls would be."}},
Links: []LinkAsk{{Kind: LinkTouches, To: "0290"}, {Kind: LinkTouches, To: "issue 365"}}}); err != nil {
t.Fatal(err)
}
w.reviewAll(t)
if len(w.judge.reviews) != 2 { // the head and the overview
t.Fatalf("%d reviews", len(w.judge.reviews))
}
var q string
for _, asked := range w.judge.reviews { // the two run at once, in no order
if strings.Contains(asked, "The head:") {
q = asked
}
}
record := q[strings.Index(q, "The head:"):]
if !strings.Contains(record, "research status: active") || !strings.Contains(record, "state in the knowledge base: proposed") {
t.Fatalf("the record as the review sees it:\n%.600s", record)
}
for _, never := range []string{"\nstatus: proposed", "\neffort: "} {
if strings.Contains(record, never) {
t.Errorf("the review is shown %q", strings.TrimSpace(never))
}
}
if !strings.Contains(q, "- `touches`: ") {
t.Error("the review is not told what touches is")
}
}