ceo
|
d89caf4af2
|
fix:stalled 分類同步 agents#44——子項全關閉的父追蹤項一律標 parent-tracking(#47)
considerIssue 原先僅在 anyOpen(children) 時標 parent-tracking,子項全關閉時
退回通用原因(如 assignee-idle),與 gitea.py(agents#44 修正)不一致,
導致巡邏「父項收尾」規則永不觸發。改為 children 非空一律 parent-tracking,
並移除已無引用的 anyOpen。
回歸測試 TestScanStalledParentWrapup 補子項全關閉 fixture;
fakeSource.OpenIssues 過濾 closed 以對齊真實 API 語義。
|
2026-09-14 08:04:37 +08:00 |
|
ceo
|
027ed1ade9
|
workflow_test:fakeSource.OpenIssues 依 number 排序,消除 map 迭代隨機性
審核意見(PR #36):issue 1 與 issue 3 在新邏輯下同為 10h,
sort.SliceStable 平手時順序取決於 map 迭代隨機順序,
TestScanStalledIssueReasons 的 got[0].Number != 1 斷言不穩定。
採建議修法 1:fakeSource.OpenIssues 回傳前依 number 遞增排序,
對齊真實 Gitea API(issues 依 id 遞增)行為。實作未動。
go build / go vet / go test ./... 全綠;
TestScanStalledIssueReasons -count=50 重跑全綠。
|
2026-09-12 15:21:21 +08:00 |
|
ceo
|
e4212b9c90
|
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)。
|
2026-09-12 15:10:31 +08:00 |
|
ceo
|
4582dfaa4e
|
internal/workflow:統一型別宣告,修復 #12 合併後 main 編譯失敗(#21)
#12 的 workflow.go 與 #13 的 types.go 各自宣告 User/Comment/Issue/
PullRequest/Repository,文字合併無衝突但語意衝突,main 自 a8c1f3e 起
go build 失敗。
統一採 #13 的字串模型(types.go 為唯一型別來源):
- Issue/Comment 補 State/Body/ClosedAt 欄位,新增 parseMoment
(對應 gitea.py _parse_iso8601;保留原時區偏移,輸出與 Python
isoformat 位元組一致)
- workflow.go 移除重複宣告,stalled/xref 邏輯改用該模型與 judge.go
既有輔助(AssigneeNames/ReviewerNames/LastComment/containsString)
- Source 介面 number 改 int64(與 types.go 對齊),cmd/xcheck 同步
- workflow_test.go 測試資料改新型別模型(字串時刻、指標欄位)
驗證:
- go build/go vet/go test ./... 全綠(#6 與 #7 案例皆未回歸)
- xcheck 對真實 API 並行掃描,stalled 輸出與 gitea.py 位元組一致(含
bear-cli#9 父追蹤項子項摘要、+08:00 時區偏移)
- xref 邊界案例(nope#9/PR#50 略過、bear-cli#9 內嵌解析)與 Python 一致
|
2026-09-10 11:32:40 +08:00 |
|
ceo
|
b2dd2f3aac
|
修正 JSON 位元組相容與 xref Unicode 邊界(審核意見)
依 #12 審核意見修正四項偏差,並補一項同源問題:
1. iterXrefs 前一字元檢查改 Unicode:isWordChar 改用
unicode.IsLetter/IsDigit,且以 utf8 正確解碼前一 rune
(原版只認 ASCII 又取單一位元組)。另補齊 Python finditer
的重試語義:起點被 lookbehind 擋下時從下一 rune 重試,
否則「修復bear-cli#9」會整段丟失(Python 匹配後半 cli#9);
lookbehind 字元集含 #(##5 不匹配)。
2. writeJSON 改 json.Encoder + SetEscapeHTML(false):
Python ensure_ascii=False 不轉義 <、>、&,json.Marshal 預設
會,標題含這些字元即失去位元組相容。
3. stalled_hours 改 strconv.FormatFloat(v,'f',1,64):整數值輸出
48.0(原 %g 輸出 48,極大值還會變 1e+06)。
4. Child.last_activity_at 無可解析時刻時輸出 null(原輸出 ""),
型別改 *string;格式對齊 FormatMoment(UTC 記 +00:00 非 Z)。
5. cmd/xcheck 輸出同樣停用 HTML 轉義(Marshal* 對自訂
MarshalJSON 的輸出仍會轉義)。
驗證:go build/vet/test 全綠(16 測試函式,新增 CJK、##5、
全形數字、HTML 字元、48.0、null 等案例);cmd/xcheck 與
gitea.py stalled 對真實 API 並行掃描輸出位元組相同(1749B,
含 bear-cli#9 父追蹤項與 5 子項摘要);--xrefs 對 CJK
邊界輸入與 Python 一致。
|
2026-09-10 09:47:46 +08:00 |
|
ceo
|
a86803d336
|
internal/workflow:xref 解析與 stalled 掃描核心邏輯(#7)
完整移植 gitea.py 的 _resolve_xref_targets 與 find_stalled_work:
- xref:#N/repo#N/owner/repo#N;單段 repo 僅在存在於組織時解析
(PR#50、issue#49 這類寫法自動略過);owner 需為所屬組織。
Go regexp 無 lookbehind,掃描時檢查前一字元等價實作。
- stalled:reason 分類(issue:no-assignee/assignee-idle/no-commenter/
waiting-outside/parent-tracking;PR:no-reviewer/author-idle/
reviewer-idle/no-commenter)、24h 催促冷卻、父追蹤項把子項活動
(留言、state 變更、PR 合併)計入 last_activity、上行引用不採計。
- 資料以 Source 介面注入:邏輯離線可測,CLI 接線待 #5 基礎建設。
- 輸出 JSON 與 gitea.py 位元組相容(鍵序、assignees/author 欄位、
isoformat 時刻、round(x,1) 半偶數舍入)。
- cmd/xcheck:交叉驗證工具(--xrefs 與停滯掃描模式),已對真實 API
與 gitea.py 並行比對,輸出一致。
go build/vet/test 全綠;單元測試覆蓋 xref 邊界與 stalled 判定。
|
2026-09-10 08:36:31 +08:00 |
|