[Fix] next-spec-id のブランチスキャンから is-ancestor フィルタを撤廃 (#196)#199
Merged
Conversation
base に追従していないアクティブブランチ(is-ancestor が false)が スキャン対象から除外され、ID衝突検出が漏れる不具合を修正。 レビュー指摘を反映: - fetch に --prune を追加(stale remote ref による ID 押し上げ防止) - impl-issue の Issue 更新手順を mktemp -d + trap 方式に修正 (固定 /tmp パスの並行実行衝突リスクを解消) - forge ToC の stale 状態を修正(全文書フル再生成、旧マージ経路の 二重エスケープ破損を解消) Closes #196
BlueEventHorizon
marked this pull request as ready for review
July 13, 2026 00:49
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.
概要
forge:next-spec-idのブランチスキャンロジックが、base に追従していないアクティブブランチ(git merge-base --is-ancestorが false)を無条件に除外していたため、そのブランチ上の ID 衝突を検出できず誤った ID を採番していた不具合を修正背景
Issue #196: DocAdvisor リポジトリで
feature/14-pyyaml-migrationブランチに既にADR-007_pyyaml_adoption.mdが存在していたにもかかわらず、next-spec-idが同じ番号を採番して衝突した。原因はget_scan_branches()が「base に追従済みのブランチのみ」をスキャン対象にしており、develop 側に後続コミットがあると feature ブランチがis-ancestorfalse 判定になりスキャン対象から漏れるため。やったこと
scan_spec_ids.pyのget_scan_branches()からis-ancestorフィルタを撤廃し、refs/heads/+refs/remotes/origin/の全ブランチを無条件でスキャン対象にしたgit fetchに--pruneを追加(stale remote ref による ID 押し上げを防止。レビュー指摘対応)get_scan_branches()の単体テストと--prune検証テストを追加plugins/anvil/skills/impl-issueの Issue 更新手順(references/phase-09-issue-update.md)を修正:gh issue edit --body-fileが本文の完全置換であることを明記し、既存本文取得 → 検証 → 結合 → 更新の手順を整備/tmp/issue_body*.mdパスをmktemp -d+trapによるユニークパスに変更(並行実行・前回残骸による誤結合防止。レビュー指摘対応)TEMPLATE.mdのコマンド例の重複を解消し、手順本体への参照に一本化plugins/forge/toc/rules/)の stale 状態を修正。全38文書をフル再生成し、旧マージ経路で発生していた無関係エントリの二重エスケープ破損も解消やらないこと(このプルリクエストのスコープ外とすること)
doc-advisorプラグイン(外部リポジトリ)のmerge_toc.py自体の二重エスケープ不具合の根本修正は対象外(本 PR では全文書フル再生成による回避のみ)レビュー観点
scan_spec_ids.pyのget_scan_branches()/fetch --pruneの変更ロジックphase-09-issue-update.mdのmktemp化した Issue 更新手順rules_toc.yaml等)は差分行数が大きいですが、フル再生成による全件書き換えです。内容面ではplan_principles_spec.md/task_execution_spec.mdのメタデータ更新が主眼で、他は表記の再シリアライズです312bf55,6689f3b)が含まれていますレビューレベル
Lv0: まったく見ないでAcceptするLv1: ぱっとみて違和感がないかチェックしてAcceptするLv3: 実際に環境で動作確認したうえでAcceptする備考
Closes #196