Skip to content

bug: idd-update 的 git log --grep="#$NUMBER" 無詞界,#10 命中 #107 (sibling concern from #347) #348

Open

Description

@kiki830621

Problem

Original text(idd-update SKILL.md Step 3「Related Commits」):
「```bash
git log --oneline --grep="#$NUMBER" | head -10

— Source: `skills/idd-update/SKILL.md`

--grep="#10" 是子字串比對,會命中 #100–#109、#1000… 任何以 #10 開頭的引用。2026-09-15 對一張 #10 跑 idd-update 時,Related Commits 抓到一個 commit message 寫的是 bestASR #107,與該 issue 無關。當下是人眼看出來手動改成 (none);若是 unattended chain,這條假 commit 會被寫進 Current Status。

Type

bug

Expected

用詞界限制引用:

git log --oneline --grep="#${NUMBER}\b" | head -10        # 或 -E '(^|[^0-9])#'"$NUMBER"'([^0-9]|$)'

idd-issue Step 4.8 的 umbrella pre-flight、idd-close 的 commit 掃描若用同一 pattern,一併修。

Actual

子字串比對;issue 編號越小、repo 越活躍,假陽性越多(#1 會命中所有 #1x、#1xx)。

Impact

Current Status 的 Commits 小節是 close gate 與人讀進度的依據;假 commit 會讓一張沒動過的 issue看起來已有實作。


Filed as a sibling concern surfaced during /idd-issue for #347(IC_R011 linked-context sweep,同 session 實際踩到)。Parent context: #347。


Current Status

Phase: diagnosed
Last updated: 2026-10-29 by idd-diagnose (via /idd-all)
Dashboard: #348 (comment)

Key Decisions

  • Root cause:--grep="#N" 是子字串比對,兩側都沒有邊界(#10 命中 #107、owner/repo#10)
  • 修法方向:13 處改成與 pr-issue-matching.md 相同的邊界 (^|[^A-Za-z0-9_/-])#N([^0-9]|$)(git log -E)
  • Complexity:Plan(同一概念散在 7 個 SKILL.md;共用 helper vs inline 待 plan 決定)

Scope Changes

  • issue 點名 3 個 skill;同一 family 另有 idd-verify、idd-all-chain、idd-report、idd-reorganize,一併列入

Blocking

  • (none)

Commits

  • (none)

Generated by Claude Code

Activity

  1. kiki830621 commented on Oct 29, 2026

    @kiki830621
    MemberAuthor

    Diagnosis

    Type

    bug

    Root Cause / Analysis

    我認為 root cause 是各 skill 用 git log --grep="#$NUMBER" 找「引用此 issue 的 commit」,而 --grep 預設是 basic regex 的子字串比對,#N 兩側都沒有邊界,因為:

    重現(暫存 repo,git 2.43,9 個 commit):

    • 現行 --grep="#10":命中 8 個,包含 bestASR #107 unrelated、x#100 glued、cross-repo PsychQuant/other#10 mention
    • -E --grep='(^|[^[:alnum:]_./-])#10([^0-9]|$)':命中 5 個,正好是真的引用 #10 的那些((#10)、Refs #10、行首 #10、#10.、多行訊息中間那行的 Refs #10)
    • N=1:現行命中 9 個,改後只剩 1 個
    • $ 在多行 commit 訊息裡是行尾錨點(多行那一個仍被找到),-E 在 git 2.43 可用

    同一個 pattern 出現在 7 個 SKILL.md 共 13 處(issue 點名的是前三個):

    檔案 位置 用途 誤配後果
    skills/idd-update/SKILL.md:176 Step 3 Related Commits Current Status 的 Commits 小節 沒動過的 issue 看起來有實作(issue 回報的情況)
    skills/idd-issue/SKILL.md:1272、:1281 Step 4.8 umbrella pre-flight 判斷 umbrella 是否已有後續 commit 誤判 umbrella 已有進度
    skills/idd-close/SKILL.md:361、:508、:510、:520、:521 commit 掃描與 Step 1.6 semantic gate 驗證打勾的 bullet 有對應 commit/檔案 semantic gate 被別的 issue 的 commit 滿足(假陽性,放行)
    skills/idd-verify/SKILL.md:607 Step 0.5 auto-detect 用命中數 N 決定 HEAD~N..HEAD verify 的 diff 範圍包含別的 issue 的 commit
    skills/idd-verify/SKILL.md:673 Step 0.7 PR↔issue 對應 grep -q "#$ISSUE" 比對 PR 的 #N 清單 user 給 #10、PR 只 refs #107 時對應檢查照樣通過
    skills/idd-all-chain/SKILL.md:587 取該 issue 的 HEAD commit chain 報告 指向別的 issue 的 commit
    skills/idd-report/SKILL.md:136 報告的 commit 清單 統計 數字偏誤
    skills/idd-reorganize/SKILL.md:60 找相關 commit 整理 誤列

    scripts/ 底下沒有用 --grep 的地方;4 個 open PR(#402、#418、#426、#442)都沒有改到上面任何一行。

    Existing work

    (none) — check-existing-work.sh verdict=clear

    Impact

    • 影響的檔案:上表 7 個 SKILL.md、references/pr-issue-matching.md(commit 訊息比對沒有記在契約裡)、新的測試、CHANGELOG.md
    • 影響的使用者流程:issue 編號越小、repo 越活躍,假陽性越多;最嚴重的是 idd-verify 的 diff 範圍與 idd-close 的 semantic gate

    Strategy

    • 決定共用形式(見 Complexity / Decision Points):一個回傳 ERE 的共用 helper,或每處 inline 同一條 ERE 加 drift guard
    • 上表 13 處全部改成有邊界的比對:git log -E --grep=<ERE>,ERE 與 pr-issue-matching.md 的 PR body 精篩相同((^|[^A-Za-z0-9_/-])#N([^0-9]|$));idd-verify:673 的 grep -q 改成整行比對
    • references/pr-issue-matching.md 加「commit 訊息」一節與呼叫點
    • 測試:暫存 repo 的 commit 組(#107、#100、owner/repo#10、(#10)、Refs #10、多行)驗證 ERE;drift guard:任何 SKILL.md 再出現沒有邊界的 --grep #$N 就失敗
    • CHANGELOG [Unreleased] Fixed

    Conflict Class

    C_shared_module_coord — 共享資源是 7 個 SKILL.md(idd-update、idd-issue、idd-close、idd-verify、idd-all-chain、idd-report、idd-reorganize),open PR #402/#418/#426/#442 都在改其中幾個檔(不同行),merge 順序要協調

    Complexity

    Plan — Hard-gate: triggered — 同一個概念(「找引用 issue N 的 commit」)散在 7 個檔(≥ 5):skills/idd-update、idd-issue、idd-close、idd-verify、idd-all-chain、idd-report、idd-reorganize 的 SKILL.md。Layer P 另外命中 decision-heavy:共用 helper(一份 regex,呼叫端各自 source)vs 每處 inline 同一條 ERE 加 drift guard,會影響 13 處的寫法。Layer 1 未命中(是行為修正,不是 prose);Layer 2 未命中(沒有新的對外 API;helper 若採用也只是內部)。

    Family-wide scope:issue 點名 idd-update/idd-issue/idd-close,並寫「若用同一 pattern,一併修」;上表其餘 4 個檔是同一 family,Plan 會全部列入。

    Risks

    • 13 處分散在 7 個 skill,漏改一處就留下一個假陽性來源 → drift guard 測試
    • -E 之後 --grep 的其他字元也變成 ERE 語意;這些呼叫點只放 #N,沒有其他 meta 字元
    • idd-issue:1281 的 --grep "#$UMBRELLA scope" 帶了額外的字,改寫時要保留語意
    • 與 open PR 是不同行,但同檔;merge 時可能要 rebase

    Residue

    (none)

    Vagueness Pre-check

    • V1: 2 — Problem 引了確切的指令與檔案、Expected 給了改法(\b 或 ERE)與要一起修的位置;只有「同一 pattern 的其他位置」需要自己找
    • V4: 3 — 沒有明列驗收條件;可推得「#10 不再命中 #107」,但「哪些呼叫點算在內」要靠 Expected 的「若用同一 pattern,一併修」推斷
    • Triggered: no — both axes ≤ 3

    Hard-gate: triggered — 同一概念散在 7 個 SKILL.md(見上表);sdd_bias 未設定 → Plan

    Sister Concerns Filed (mid-diagnose, v2.47.0+ #528)

    (none surfaced) — the four further call sites of the same pattern (idd-verify, idd-all-chain, idd-report, idd-reorganize) are in this issue's family-wide scope, not separate issues


    Generated by Claude Code

  2. kiki830621 commented on Oct 29, 2026

    @kiki830621
    MemberAuthor

    📊 For Reviewer / Collaborator

    現在:已診斷 —— git log --grep="#N" 是子字串比對(#10 命中 #107、owner/repo#10),同一寫法在 7 個 skill 共 13 處;判為 Plan tier(同一概念散在 ≥ 5 個檔)
    Blocking:無
    你該做什麼:審 Implementation Plan(/idd-plan 會在 plan mode 請你核准)

    last-updated by idd-diagnose at → diagnosed, 2026-10-29


    Generated by Claude Code

  3. kiki830621 commented on Oct 29, 2026

    @kiki830621
    MemberAuthor

    Implementation Plan (Plan tier)

    Files & Changes

    • plugins/issue-driven-dev/scripts/lib/issue-ref.sh(新)— idd_issue_ref_ere <N>:N 不是純數字時 exit 2;印出 (^|[^A-Za-z0-9_/-])#N([^0-9]|$),與 references/pr-issue-matching.md 的 PR body 精篩同一條規則。一份 regex,13 個呼叫點共用
    • skills/idd-update/SKILL.md:176 — Step 3 Related Commits 改 git log --oneline -E --grep="$(idd_issue_ref_ere "$NUMBER")"(前面 source helper)
    • skills/idd-issue/SKILL.md:1272、:1281 — Step 4.8 umbrella pre-flight;:1281 的 "#$UMBRELLA scope" 改成 ERE 後接 scope,保留原語意
    • skills/idd-close/SKILL.md:361、:508、:510、:520、:521 — commit 掃描與 Step 1.6 semantic gate(表格裡的兩個範例指令也改,避免被照抄)
    • skills/idd-verify/SKILL.md:607 — Step 0.5 auto-detect 的命中數;:673 的 grep -q "#$ISSUE" 改成 grep -qx "#$ISSUE"($DISCOVERED 是 grep -oE '#[0-9]+' 的逐行結果,整行比對即可)
    • skills/idd-all-chain/SKILL.md:587、skills/idd-report/SKILL.md:136、skills/idd-reorganize/SKILL.md:60 — 同上
    • references/pr-issue-matching.md — 加「commit 訊息」一節:同一條邊界、用 idd_issue_ref_ere,列出上述呼叫點
    • scripts/tests/issue-ref/test.sh(新)— (a) 暫存 repo 的 commit 組:bestASR #107、x#100、PsychQuant/other#10、repo#10 不命中;(#10)、Refs #10、行首 #10、#10.、多行訊息中的 Refs #10 命中;N=1 只命中 #1;非數字 N exit 2。(b) drift guard:skills/ 與 references/ 裡任何 git log … --grep 帶 #$ 或 #${ 卻沒有用 idd_issue_ref_ere 的行都失敗
    • CHANGELOG.md — [Unreleased] Fixed

    Family-wide scope (shared-abstraction hard-gate trigger only)

    硬閘是「同一概念散在 ≥ 5 檔」觸發(不是 shared abstraction);仍把 family 全列:issue 點名的 idd-update/idd-issue/idd-close,加上同 pattern 的 idd-verify(2 處)、idd-all-chain、idd-report、idd-reorganize。共 7 檔 13 處,全部在 Files & Changes。

    Sequencing & Dependencies

    1. 先寫 scripts/tests/issue-ref/test.sh(RED:helper 不存在;drift guard 列出 13 處)
    2. 新增 scripts/lib/issue-ref.sh(測試 (a) GREEN)
    3. 逐檔改 13 個呼叫點(drift guard 逐步轉 GREEN)
    4. reference 與 CHANGELOG
    5. 全套 run-all-tests.sh

    Decision Points

    • 共用 helper vs inline ERE:選 helper。13 份同一條 regex 是「一個事實寫 13 次」,這個 repo 已經在 actionability gate(scripts/lib/actionability.sh)與 existing-work lookup(scripts/check-existing-work.sh)兩次證明 inline 複本會分歧;drift guard 只能抓「沒有邊界」,抓不到「13 份邊界彼此不同」。代價:每個呼叫點多一行 . "$CLAUDE_PLUGIN_ROOT/scripts/lib/issue-ref.sh"
    • 左邊界要不要擋跨 repo 形式:要。與 PR body 的契約一致,否則同一個 issue 在 PR 端與 commit 端的「引用」定義不同
    • idd-verify:673:不用 helper —— 那是對已抽出的 #N 清單比對,整行比對(grep -qx)就正確,也更簡單

    Risks & Mitigations

    Test Plan

    • issue-ref/test.sh (a):上面的 commit 組,命中集合逐項斷言;RED 是 helper 不存在 → source 失敗
    • (b) drift guard:RED 時列出全部 13 處;每改一處少一行;GREEN 時 0 行
    • idd-verify:673:(a) 另加 printf '#107\n' | grep -qx '#10' 失敗、printf '#10\n' 成功
    • 全套 run-all-tests.sh 沒有新的失敗(基準:idd-repo-map、idd-tree-lock 以 root 執行時本來就失敗)

    Out-of-scope (will NOT be touched)

    Tangential Observations (filed mid-plan, v2.42.0+ #524)

    (none surfaced)


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to 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