Why: A direct run could stop on a missing file, a failed lint, or an unverified claim. The final turn now checks registered artifacts and asks a tool-less verifier, and nudges stale plans and todos. Evidence: go test ./... passed. New runtime tests cover missing and empty artifacts, docx lint errors, verifier reject-then-pass, unparseable and failed verifier calls, nil verifier tools, todo reminders, and the false-deliverable fixture. Impact: Direct runs with runtime.verify (default on for new runs) spend one extra lightweight call on every final turn. Setting it off keeps the previous stop behavior. Squad and SubLLMRunner are unchanged. The agent-native pin stays a34689c. Refs: feature/agent-harness-p2 Co-authored-by: Cursor <cursoragent@cursor.com>
42 lines
1.6 KiB
Go
42 lines
1.6 KiB
Go
package quality
|
|
|
|
import "testing"
|
|
|
|
func TestScoreTextPrefersJudgementOverColumnHeading(t *testing.T) {
|
|
good := `# 上传文档应先判断相关性再入库
|
|
|
|
## 先校验,再生成
|
|
- 说话人1:上传后第一步是判断是否与项目相关。
|
|
一句话:没有记忆库,后面的生成和追溯都没有依据。
|
|
|
|
## 下一步
|
|
- 事项:写出第一版需求。负责人:陈威。期限:周五前;说不清的写未指明。
|
|
`
|
|
bad := "# 讨论过程\n\n今天大家聊了很多,感觉还要再看看。\n"
|
|
gotGood := ScoreText(good)
|
|
gotBad := ScoreText(bad)
|
|
if !gotGood.Passed || gotGood.Score < 70 {
|
|
t.Fatalf("good text should pass: %+v", gotGood)
|
|
}
|
|
if gotBad.Passed || gotBad.Score >= gotGood.Score {
|
|
t.Fatalf("column heading should score lower: bad=%+v good=%d", gotBad, gotGood.Score)
|
|
}
|
|
for _, d := range gotGood.Dimensions {
|
|
if d.Evidence == "" {
|
|
t.Errorf("%s missing evidence", d.ID)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestScoreBytesUsesExtension(t *testing.T) {
|
|
good := "# 上传文档应先判断相关性再入库\n\n## 先校验,再生成\n- 说话人1:上传后第一步是判断是否与项目相关。\n一句话:没有记忆库,后面的生成和追溯都没有依据。\n\n## 下一步\n- 事项:写出第一版需求。负责人:陈威。期限:周五前;说不清的写未指明。\n"
|
|
got := ScoreBytes("note.md", []byte(good))
|
|
if !got.Passed {
|
|
t.Fatalf("markdown bytes should pass: %+v", got)
|
|
}
|
|
bad := ScoreBytes("note.txt", []byte("# 讨论过程\n\n今天大家聊了很多。\n"))
|
|
if bad.Passed {
|
|
t.Fatalf("column heading should fail: %+v", bad)
|
|
}
|
|
}
|