fix: stalled PR 作者已交棒審核改判 reviewer-idle(agents #51)
considerPull 的 author-idle 分支缺少 #47 的交棒檢查,且既有 IsDeliveryReport 訊號為 issue 交付報告設計,PR 端「已就緒,可審閱+ @審核者」形態無對應訊號——fox#60 作者留言交棒後仍被誤判 author-idle。 新增 IsReviewHandoff(@目前審核者帳號 ∧ 就緒語,mention 邊界感知 避免 @chenyunda218 誤命中 chenyunda),considerPull 在判 author-idle 前檢查,命中改判 reviewer-idle,讓既有 48 小時改派規則自然適用。 gitea.py 側 _consider pull 分支以 _is_review_handoff 同步(另 PR)。
This commit is contained in:
@@ -179,3 +179,37 @@ func TestIsDeliveryReport(t *testing.T) {
|
||||
t.Error("nil 最後留言應為 false")
|
||||
}
|
||||
}
|
||||
|
||||
// TestIsReviewHandoff(agents #51):審核交棒=@審核者帳號 ∧ 就緒語。
|
||||
// 案例與 gitea.py _is_review_handoff 的離線驗證同集(fox#60 實例)。
|
||||
func TestIsReviewHandoff(t *testing.T) {
|
||||
// fox#60 作者(alex)最後留言結尾(2026-09-16 08:05)。
|
||||
fox60 := "狀態回報(作者端自查,分支無需再變更):\n\n- 已重新核對分支與 main 的差異…\n- PR 分支 CI 已通過(run 209)。\n\n@chenyunda218 PR 已就緒,可審閱。@ceo 已知悉管理者巡邏的備註;審核合併後,我會在下一個 main 部署 run 跑通時回 #58 驗收。"
|
||||
cases := []struct {
|
||||
name string
|
||||
comment string
|
||||
reviewers []string
|
||||
want bool
|
||||
}{
|
||||
{"fox#60 實例(@審核者+已就緒,可審閱)", fox60, []string{"chenyunda218"}, true},
|
||||
{"多位審核者命中其一", fox60, []string{"ceo", "chenyunda218"}, true},
|
||||
{"前綴碰撞(@chenyunda218 ≠ chenyunda)", fox60, []string{"chenyunda"}, false},
|
||||
{"就緒語但無 @(無點名對象)", fox60, []string{"dan"}, false},
|
||||
{"進度回報(無就緒語)", "進行中:已改完兩步,CI 跑著,@chenyunda218 稍後再看。", []string{"chenyunda218"}, false},
|
||||
{"預告式(即將就緒不算)", "@chenyunda218 快好了,即將整理完成。", []string{"chenyunda218"}, false},
|
||||
{"無審核者", fox60, nil, false},
|
||||
{"空留言", "", []string{"chenyunda218"}, false},
|
||||
}
|
||||
for _, tc := range cases {
|
||||
var last *Comment
|
||||
if tc.comment != "" {
|
||||
last = &Comment{Body: tc.comment}
|
||||
}
|
||||
if got := IsReviewHandoff(last, tc.reviewers); got != tc.want {
|
||||
t.Errorf("%s:IsReviewHandoff = %v,want %v", tc.name, got, tc.want)
|
||||
}
|
||||
}
|
||||
if IsReviewHandoff(nil, []string{"chenyunda218"}) {
|
||||
t.Error("nil 最後留言應為 false")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user