[Fix] scan_spec_ids の duplicates を共有採番モードに追随させ同一履歴由来の誤報告を解消 (#181)#185
Merged
Merged
Conversation
find_duplicates() が full ID 文字列 × ブランチ数だけで重複判定していたため、 (1) --share-prefixes 指定時に ADR-032 / DES-032 のような共有番号衝突を検出できず、 (2) 同一履歴由来で全ブランチに存在する正常な ID を大量に duplicate 誤報告していた (Issue #181)。 - 重複判定キーを (prefix, 番号) に変更し、共有採番モードでは番号のみをキーにする - 「同じキーを異なるファイルパスが主張する」場合のみ衝突として報告 (同一パスの複数ブランチ出現=同一履歴由来は正常として除外) - duplicates エントリに ids / paths を追加(id / branches は後方互換で維持) - 番号は int 正規化して比較(DES-032 と DES-32 は同番号の衝突) - prefix 直前に境界 (?<![A-Za-z0-9-]) を追加し、COMMON-DES-001 のような 別名前空間 ID の DES としての誤抽出を防止(本修正の実測検証で検出した残存ノイズ) - next-spec-id / start-design SKILL.md の duplicates セマンティクス記述を更新 実リポジトリでの実測: duplicates 22 件(全て誤報告)→ 0 件、next_id は不変。 Closes #181 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
Issue #181 の修正。
find_duplicates()が full ID 文字列 × ブランチ数だけで重複判定していたため、共有番号衝突(ADR-032vsDES-032)を検出できず、逆に同一履歴由来の正常な ID を大量に誤報告していた。変更内容
(prefix, 番号)をキーとし、--share-prefixes指定時は番号のみをキーにする(prefix 違い・同番号を衝突として検出)duplicatesエントリにids/pathsを追加(id/branchesは後方互換で維持)DES-032とDES-32を同番号の衝突として扱う(?<![A-Za-z0-9-])によりCOMMON-DES-001のような別名前空間 ID がDES-001として誤抽出されるのを防止(本修正の実測検証時に検出した残存ノイズ。これを除去しないと duplicates が警告として機能しないため本 PR に含めた)受け入れ基準との対応
ADR-032_foo.mdとDES-032_bar.mdがある場合、--share-prefixes ADR,DESで共有番号衝突が検出される →test_share_prefixes_detects_shared_number_collisiondevelopと current branch に同一ファイル由来で存在する既存 ID は duplicate 警告にならない →test_share_prefixes_same_history_ids_not_reportedstart-design/SKILL.mdの「duplicates が空でない場合は警告」の意味と実装が一致 → SKILL.md に衝突セマンティクスを明記実リポジトリでの実測
修正前:
duplicates22 件(すべて同一履歴由来の誤報告 + COMMON-DES 誤抽出)修正後:
duplicates0 件、next_id: DES-034/max_number: 33は不変テスト
dprint checkpass。Closes #181
🤖 Generated with Claude Code