Skip to content

refactor: apply review findings from the ADR-007/008 PRs - #12

Merged
Mapleeeeeeeeeee merged 1 commit into
mainfrom
refactor/review-followups
Sep 2, 2026
Merged

refactor: apply review findings from the ADR-007/008 PRs#12
Mapleeeeeeeeeee merged 1 commit into
mainfrom
refactor/review-followups

Conversation

@Mapleeeeeeeeeee

Copy link
Copy Markdown
Owner

為什麼

對 PR #9#10#11 跑了五維度產品碼審查與測試品質審查,四項 Should Fix、五項 Nit 全部核對屬實,這個 PR 一次收掉。輸出行為不變:cc-session read b11858cf 改前改後 md5 相同(98e2173533a375206f0983d5b5618f8a)。

改了什麼

Should Fix

  • UserMessage.IsCompactedHarnessInjection() 成為「壓縮而非丟棄的 harness 注入」這組 12 個 flag 的單一定義,ComputeStats 改呼叫它,不再與 renderer 各自列一份
  • ComputeStats 的 turn 計數補測試:teammate、task-notification、壓縮續接算 turn;interrupted、stop hook、skill 注入不算。Mutation 驗證:拿掉 userTurnCount++TestComputeStats_UserTurnCount 轉紅
  • parseLineWithToolNames 改名 parseLineWithToolCalls,對齊它現在攜帶的 toolCallInfo 與 skill 連結用途
  • firstMeaningfulLine 改逐行掃描不預先 SplitStripANSI 只在行內有 \x1b 時執行

Nit

  • 移除無呼叫者的 FirstLine 與其測試
  • hookErrorBoilerplate 從 regexp 改 strings.Contains
  • turn 政策測試補 CommandMarkerIsTeammateMessage 同時設定的優先序案例
  • teammate 壓縮補同一段 body 含兩種標籤變體的案例

驗證

gofmt / go vet / go test ./... 全綠;md5 前後一致;mutation 檢查紅後已還原。

🤖 Generated with Claude Code

https://claude.ai/code/session_01TcvWErnKnuADJsomnZfwFr

Give the compacted-harness-injection group a single owner,
UserMessage.IsCompactedHarnessInjection(), and make stats call it
instead of repeating the flag list the renderer already enumerates.
Cover ComputeStats turn counting with tests that fail when the
increment is removed. Rename parseLineWithToolNames to
parseLineWithToolCalls to match what it threads. Scan excerpt lines
without splitting the whole text and strip ANSI only when an escape
byte is present. Drop the unused FirstLine helper and a regexp that
matched a plain literal; pin CommandMarker precedence in the turn
policy and mixed teammate tag variants in one body.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TcvWErnKnuADJsomnZfwFr
@Mapleeeeeeeeeee
Mapleeeeeeeeeee merged commit 1a00d53 into main Sep 2, 2026
3 checks passed
@Mapleeeeeeeeeee
Mapleeeeeeeeeee deleted the refactor/review-followups branch September 2, 2026 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant