fix:stalled 分類同步 agents#47——assignee 交付報告待確認改判 waiting-outside

與 agents 86f570a(PR alterminal/agents#48)同語義:最後一則 assignee
留言符合交付報告特徵(結構訊號:逐項查核/驗收結果、彙總 verdict、內文
含「完成定義」段落時簡式交付語也算;∧ 交棒訊號:回報/關閉他件 #N、
或請/可由/待他人確認關閉)時,assignee-idle 改判 waiting-outside。

兩訊號同時命中才翻轉:認領/進度/預告式留言(無交棒對象)保持
assignee-idle,不製造「認領後棄置永不被催」的新死角。

驗證:TestIsDeliveryReport(8 案例,與 gitea.py 離線驗證同集)+
TestScanStalledDeliveryReport(stalled 整合:交付報告翻轉、認領不翻轉)
+全套 go test 綠;live A/B 對安裝版二進位:bear#52 assignee-idle →
waiting-outside,bear#39 parent-tracking 不變。
This commit is contained in:
2026-09-15 04:28:08 +08:00
parent 540718dda7
commit 1d9092cdde
5 changed files with 151 additions and 2 deletions
+36
View File
@@ -143,3 +143,39 @@ func TestFullNameFallbacks(t *testing.T) {
t.Errorf("全缺 → 空,得到 %q", got)
}
}
// TestIsDeliveryReport(agents #47):交付報告=結構訊號 ∧ 交棒訊號。
// 案例與 gitea.py _is_delivery_report 的離線驗證同集(bear#52 實例)。
func TestIsDeliveryReport(t *testing.T) {
body52 := "## 完成定義\n- 逐項回報查核結果至此 issue;\n- 全數通過 → 回報 #39 並由 #39 assignee 關閉"
claim := "認領。我來執行四項驗收查核,完成後逐項回報結果至此。"
report := "## 全階段驗收查核結果(#52)\n**結論:四項全數通過。** 逐項如下…\n四項全過,符合「完成定義」。回報 #39:全數驗收通過,可由 @ceo 關閉 #39 與里程碑。"
reportFail := "## 查核結果\n結論:第 2 項不通過。已開立修復 issue #60,請 @ceo 確認分配。"
cases := []struct {
name string
issueBody string
comment string
want bool
}{
{"交付報告+回報#39+@ceo 關閉", body52, report, true},
{"失敗型交付(開修復 issue+請確認)", body52, reportFail, true},
{"認領留言(逐項+回報 但無交棒)", body52, claim, false},
{"純進度留言", body52, "進行中,已看完 P1,預計今晚交付。", false},
{"已完成但無交棒", body52, "已完成,程式碼都在分支上。", false},
{"無完成定義內文+逐項交棒", "一般 issue 內文", "逐項測試結果全數通過,請 @ceo 確認後關閉。", true},
{"無完成定義+僅交棒(無結構)", "一般 issue 內文", "請 @ceo 確認後關閉。", false},
{"空留言", body52, "", false},
}
for _, tc := range cases {
var last *Comment
if tc.comment != "" {
last = &Comment{Body: tc.comment}
}
if got := IsDeliveryReport(tc.issueBody, last); got != tc.want {
t.Errorf("%s:IsDeliveryReport = %v,want %v", tc.name, got, tc.want)
}
}
if IsDeliveryReport(body52, nil) {
t.Error("nil 最後留言應為 false")
}
}