[Fix] filter無しoptional sync_fileのバージョンドリフト検知を修正#179
Merged
BlueEventHorizon merged 1 commit intoJul 7, 2026
Merged
Conversation
- _update_with_path() (filter無し path モード) にドリフト検出を追加 (VersionDriftError と対象外の ValueError を分離) - 親キーチェーン全体を辿るよう一般化し、3階層以上のパスで同名の 中間キーが複数存在する場合の誤更新を修正 - field_pattern/parent_pattern に語境界 (\b) を追加し、 "other_version" 等の無関係なキーへの誤マッチを防止 - --optional 指定時のファイル不在を status: skipped として扱うよう修正 (DES-023 §5.2 との非対称を解消) - get_version_status.py の手製 YAML パーサーが optional: false を 文字列 "false" のまま返し bool() で True になるバグを修正 - 契約テストの FilterNotFoundError 一律 continue を optional 限定に修正 (必須エントリの filter 消失を見逃していた) - DES-023 設計書を上記変更に合わせて更新 Closes #175 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
BlueEventHorizon
marked this pull request as ready for review
July 7, 2026 01:46
BlueEventHorizon
deleted the
fix/175-version-drift-filter-less-optional-sync-file
branch
July 7, 2026 01:46
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.
概要
.version-config.yamlの sync_files が filter 無し(version_path使用)かつoptional: trueの場合に、バージョンドリフトがstatus: skippedとしてサイレントに見逃される構造的欠陥を修正する(Issue [Bug] version drift 検知が --filter 経路のみで、filter 無し optional sync_file はサイレントドリフトが再発しうる #175)背景
Issue #157 / PR #170 で
update_version_files.pyに drift(更新漏れ)と not-applicable(対象パターン無し)を区別する仕組みを--filter経路(_update_with_filter)に導入した。しかし filter 無し経路(
_update_with_path/_replace_first)にはこの区別が実装されておらず、--optional併用時は従来通り一律status: skippedに分類され続けていた。本リポジトリの.version-config.yamlは全 sync_files に filter が設定されているため現状は顕在化しないが、filter 無しの optional sync_file を持つ下流プロジェクトでは Issue #157 と同型のサイレントドリフトが再発しうる。やったこと
_update_with_path()(filter 無し・version_path使用の path モード)に、filter モードと同型のドリフト検出(VersionDriftErrorと対象外のValueErrorの分離)を追加parts[-2](直近1階層のみ)から親キーチェーン全体(parts[:-1])を順にたどる方式に一般化し、3階層以上のパスで同名の中間キーが複数存在する場合の誤更新を修正(単独修正レビューで検出)field_pattern/parent_patternに語境界(\b)を追加し、other_versionのような無関係なキーへの誤マッチを防止(単独修正レビューで検出)--optional指定時のファイル不在をstatus: "skipped"として扱うよう修正し、DES-023 §5.2 で定義されている「sync_file 不在 + optional: true → スキップ」との非対称を解消get_version_status.pyの手製 YAML パーサーがoptional: falseを文字列"false"のまま返し、契約テストのbool(sync.get("optional"))が常にTrueになっていたバグを修正(_is_optional_flag()ヘルパーを追加)tests/common/test_version_sync_drift.py)のFilterNotFoundErrorを optional の有無を問わず一律continueしていた不備を修正し、optional: falseの必須エントリで filter が消失した場合はテスト失敗として検出するようにしたdocs/specs/forge/design/DES-023_version_management_workflow_design.mdを上記の実装変更に合わせて更新やらないこと(このプルリクエストのスコープ外とすること)
_replace_first()(simple モード)のドリフト検出は対象外。フィールド名という手がかりが存在しないため「対象外」と「ドリフト」を安全に区別する判定基準を構造的に持てず、ヒューリスティックな探索は誤検知の温床になる(plugins/forge/docs/review_priorities_spec.md§3.4 の比例性確認に照らして過剰と判断)。現状update_optional_dependent.py(filter なし・optional 可)は常にこの simple モードを経由するため、この経路のサイレント skip 化は本 PR では解消しないsync_filesスキーマへのversion_pathフィールド追加(filter 無し・ネストJSON対応)は行わないレビュー観点
_update_with_path()のドリフト検出・親キーチェーン解決の変更が、既存の呼び出し元(update_main_version.py等)の挙動を壊していないかget_version_status.pyの_strip_quotes()/ パーサー変更が既存の.version-config.yamlの解釈を変えていないか(全1292テスト green で確認済み)レビューレベル
Lv0: まったく見ないでAcceptするLv1: ぱっとみて違和感がないかチェックしてAcceptするLv3: 実際に環境で動作確認したうえでAcceptする備考
Closes #175
/forge:review code --diff --interactive --codexによる Codex エンジンレビューを実施し、検出された3件の🔴致命的指摘(すべて実際にコード実行で再現確認済み)をすべて修正した。単独修正レビューで追加検出された2件の副次的問題(語境界不足・親キーチェーン未対応)も同時に修正済み。