internal/workflow:directLastActivity 排除跨 issue 引用事件(#34)
同步 agents #34/#38/#40 三個停滯判定修補到 Go 端:
- Source 介面新增 IssueTimeline(GET /repos/{o}/{r}/issues/{n}/timeline,分頁),
giteaapi.go 與 cmd/xcheck 同步實作
- 新增 directLastActivity:updated_at 晚於全部已知直接活動時拉 timeline 核對,
排除 comment_ref/issue_ref 引用事件後取最晚;全為引用事件回退已知直接活動
最晚時刻(agents #40);timeline 失敗保守沿用 updated_at
- considerIssue/considerPull 對自身 updated_at、childActivity 對子項 updated_at
(含子項 created_at 入已知活動)套用同一排除邏輯(agents #38)
- 回歸測試:子項 updated_at 被引用刷新(TestRunStalledChildXrefRefresh)、
timeline 全引用事件回退與拉取失敗保守路徑(TestRunStalledTimelineAllXrefFallback)
- 修正 workflow_test.go:timelines 須在 ScanStalled 呼叫前設定
驗證:go build/vet/test 全綠;xcheck 對真實 API 掃描,
stalled 輸出與 gitea.py(agents @ 78769ec)位元組一致(5833 bytes)。
This commit is contained in:
@@ -46,6 +46,9 @@ func (s *stubStalledSource) TryGetIssue(owner, repo string, number int64) (workf
|
||||
i, ok := s.issues[owner+"/"+repo][number]
|
||||
return i, ok, nil
|
||||
}
|
||||
func (s *stubStalledSource) IssueTimeline(owner, repo string, number int64) ([]workflow.TimelineEvent, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (s *stubStalledSource) GetIssue(owner, repo string, number int64) (workflow.Issue, error) {
|
||||
if s.getErr != nil {
|
||||
return workflow.Issue{}, s.getErr
|
||||
@@ -157,7 +160,7 @@ func TestWiringXrefs(t *testing.T) {
|
||||
src := newStubStalledData()
|
||||
src.issues["alterminal/agents"][1] = workflow.Issue{
|
||||
Number: 1, Title: "父項", State: "open",
|
||||
Body: "子項:agents#2",
|
||||
Body: "子項:agents#2",
|
||||
Repository: &workflow.Repository{FullName: "alterminal/agents"},
|
||||
}
|
||||
src.issues["alterminal/agents"][2] = workflow.Issue{
|
||||
@@ -185,7 +188,7 @@ func TestWiringXrefsEmpty(t *testing.T) {
|
||||
src := newStubStalledData()
|
||||
src.issues["alterminal/agents"][1] = workflow.Issue{
|
||||
Number: 1, Title: "無引用", State: "open",
|
||||
Body: "沒有任何引用",
|
||||
Body: "沒有任何引用",
|
||||
Repository: &workflow.Repository{FullName: "alterminal/agents"},
|
||||
}
|
||||
newStubStalledEnv(t, src, time.Date(2026, 9, 10, 8, 0, 0, 0, time.UTC))
|
||||
|
||||
Reference in New Issue
Block a user