internal/workflow:統一型別宣告,修復 main 編譯失敗(#21) #23

Merged
chenyunda218 merged 1 commits from fix/issue21-workflow-types into main 2026-09-10 11:45:39 +08:00
Member

#21 修復。

問題

#12 合併(a8c1f3e)後 main 編譯失敗:#12 的 workflow.go 與 #13 的 types.go 各自宣告 User/Comment/Issue/PullRequest/Repository,文字合併無衝突但語意衝突。

修法

統一採 #13 的字串模型(types.go 為唯一型別來源):

  • Issue/Comment 補 State/Body/ClosedAt 欄位;新增 parseMoment(對應 gitea.py _parse_iso8601,保留原時區偏移——輸出與 Python isoformat 位元組一致,不轉 UTC)
  • workflow.go 移除重複宣告,stalled/xref 邏輯改用該模型,並重用 judge.go 既有輔助(AssigneeNames/ReviewerNames/LastComment/containsString),淨刪 71 行
  • Source 介面 number 改 int64(與 types.go 對齊),cmd/xcheck 同步
  • workflow_test.go 測試資料改新型別模型

驗證(#21 驗收)

  • go build/go vet/go test ./... 全綠(#6 與 #7 案例皆未回歸)
  • xcheck 對真實 API 掃描,stalled 輸出與 gitea.py 位元組一致(1749 bytes,含 bear-cli#9 父追蹤項子項摘要、+08:00 時區偏移、parent-tracking reason)
  • xref 邊界案例(nope#9/PR#50 略過、bear-cli#9 內嵌解析)與 Python 版輸出一致

關聯:#21(本 PR 修復後可關閉)、#7(CLI 接線仍待 #5 合併後續接)。

#21 修復。 ## 問題 #12 合併(a8c1f3e)後 main 編譯失敗:#12 的 `workflow.go` 與 #13 的 `types.go` 各自宣告 User/Comment/Issue/PullRequest/Repository,文字合併無衝突但語意衝突。 ## 修法 統一採 #13 的字串模型(`types.go` 為唯一型別來源): - `Issue`/`Comment` 補 `State`/`Body`/`ClosedAt` 欄位;新增 `parseMoment`(對應 gitea.py `_parse_iso8601`,保留原時區偏移——輸出與 Python isoformat 位元組一致,不轉 UTC) - `workflow.go` 移除重複宣告,stalled/xref 邏輯改用該模型,並重用 `judge.go` 既有輔助(`AssigneeNames`/`ReviewerNames`/`LastComment`/`containsString`),淨刪 71 行 - `Source` 介面 number 改 int64(與 types.go 對齊),`cmd/xcheck` 同步 - `workflow_test.go` 測試資料改新型別模型 ## 驗證(#21 驗收) - `go build`/`go vet`/`go test ./...` 全綠(#6 與 #7 案例皆未回歸) - xcheck 對真實 API 掃描,`stalled` 輸出與 gitea.py **位元組一致**(1749 bytes,含 bear-cli#9 父追蹤項子項摘要、+08:00 時區偏移、parent-tracking reason) - xref 邊界案例(nope#9/PR#50 略過、bear-cli#9 內嵌解析)與 Python 版輸出一致 關聯:#21(本 PR 修復後可關閉)、#7(CLI 接線仍待 #5 合併後續接)。
ceo added 1 commit 2026-09-10 11:32:54 +08:00
#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 一致
chenyunda218 merged commit 32c3b30934 into main 2026-09-10 11:45:39 +08:00
chenyunda218 deleted branch fix/issue21-workflow-types 2026-09-10 11:45:39 +08:00
Sign in to join this conversation.