Skip to content

squash-commit-body auto-close trap: PR body clean but squashed commit bodies leak trap pattern (caught #87 in PR #94 dogfood) #97

@kiki830621

Description

@kiki830621

Problem

Original text (觀察自 PR #94 squash-merge 後 2 秒):
「squash commit message 把 6 個 commit 的 body 合進來,其中一個 commit body 含 Closes: #87(單引號內的反例引用)→ GitHub auto-close parser context-blind,引號不認、上下文不認 → #87 在 merge 後 2 秒被 closed by commit d2125fe,bypass /idd-close。同 cluster 的 #74 因為沒人寫 Closes: #74 在 commit body 所以倖免。」
— Source: PR #94 dogfood

PR #94(cluster #87 + #74)修了 idd-verify Step 0.8 PR-body auto-close-trailer scan gate。但 PR 自己 merge 後,#87 被 auto-close —— 反諷地被自己 cluster 修的 trap 咬到

Root cause

不在 PR body(pre-merge gh pr view --json closingIssuesReferences 為空)。問題在 squash 行為

  • gh pr merge --squash 預設把所有 squashed commits 的 message body 合入 squash commit message

  • 其中 commit d918270 的 body 含這句作為 R1 verify finding 的解釋:

    R1 verify (/idd-verify --pr 94) found the Step 0.8 regex missed the colon form 'Closes: #87'

  • 單引號裡的 Closes: #87 是反例引用,但 GitHub auto-close parser context-blind(不認單引號、不認 markdown code、不認上下文)

  • squash commit d2125fe 進 main → GitHub 認 Closes: #87 → 自動 close #87,bypass /idd-close 的 closing summary / checklist gate / phase update / distribution sync

Timeline

2026-05-19T00:48:35Z  PR #94 merged (squash commit d2125fe)
2026-05-19T00:48:37Z  #87 auto-closed by kiki830621 commit=d2125fe (2 秒後)

#74 state 保持 OPEN — commit bodies 沒有 literal Closes: #74

Type

bug

Affected

  • idd-verify Step 0.8 — current 設計只 gh pr view --json closingIssuesReferencesonly PR body)。對於 squash workflow,PR body 乾淨但 squash commit message 髒,gate 無感
  • 任何 IDD commit message / PR description 提到 trap pattern 作反例(教學、debug 報告、verify findings、closing summaries 引用前一輪的 finding)都會觸發
  • 影響面比 PR body trap 更廣:trap pattern 在 IDD 工作流中作為 ABCD 反例被引用的場景非常多

Expected

Trap detection 同時 cover PR body + squash 之後的 commit message。候選方向(不預判,待 diagnose 決定):

  • A. Step 0.8 擴展掃 commit bodiesgh pr view --json commits -q '.commits[].messageBody' 額外丟進 closingIssuesReferences-style 檢查;但 GitHub closingIssuesReferences 本身已 squash-aware? 待驗證
  • B. Predict squash message — 若 PR merge strategy = squash(gh pr view --json mergeStateStatus,...),在 verify 階段組出預期的 squash commit message(PR title + concatenated commit bodies),跑 trap scan
  • C. 反例書寫紀律 — IDD 自己的 commit / PR / closing comment 引用 trap pattern 時用 markdown code fence 或 zero-width-space 隔開(如 Closes​: #87)。但這只防 IDD 自身,外部 contributor 無感
  • D. gh pr merge wrapper — IDD 提供 wrapper script 在 squash 前掃 squashed message,trap 命中 → 強制 user 確認或自動 --body overwrite

Actual

#87 在 PR #94 merge 後 2 秒被 auto-close,bypass IDD 整個 close pipeline(closing summary / checklist gate / phase=closed body sync / Step 6.5 distribution sync)。事後需要手動補 closing summary + phase sync。

Impact

  • Step 0.8 false-negative:clean PR body + dirty commit body 仍 trap。
  • IDD audit trail 損壞:受影響的 issue 沒走過 IDD 紀律的 close 流程。
  • Recursion potential:本 issue body 自己就含多個 Closes: #87 字串(為了說明 root cause)。寫修這 issue 的 PR 也會撞到相同問題 — /idd-verify --pr <N> 的新 gate 必須涵蓋 squash predicted message,否則修這 issue 的 PR 自己又會 trip。

Discovered

Notes


Current Status

Phase: closed
Last updated: 2026-05-19 by idd-close

Complexity

Plan — decision-heavy (3 detection strategies) + risk-sensitive boundary (security/discipline gate) + cross-file refactor (idd-verify Step 0.8 + CLAUDE.md anti-trailer discipline)

Next

Closed via PR #98 (squash e0d61e7).
Closing summary: #97 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions