test: Phase 2.5 coverage expansion (facade/factory fakes + tier-2 targets + A-1-4 regression) - #4
Merged
Merged
Conversation
PatternFactory reads its input only through hasattr/getattr (factory.py:103-141) and PatternFacade only needs prefs.patterns and get_active_pattern() (facade.py:48-49, 121, 150, 179), so duck-typed fakes in tests/unit/fakes.py cover both without real Blender. Coverage: facade 23% -> 94%, factory 31% -> 100%. Characterized along the way: pattern.validate() errors are swallowed (factory.py:49-53) while element-level config errors leak as ValueError past the except (KeyError, TypeError) at factory.py:68, and facade construction dies on KeyError when addon prefs are missing. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
FileSelectEntry cannot be created headlessly, so per the order's fallback plan the sanitize / validation / extension-allowlist functions (targets/file.py:114-178) are pinned in tier 1 instead. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Pins namespace/name APIs against real bpy.data, plus characterization of silent .001 collision handling for the non-ID paths (KeyBlock, Strip) mirroring the bone findings. Material is the minimal second ID representative; collision details stay with the Object tests. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Drives the real prefs.patterns via addon_utils.enable(default_set=True) because the fixed logic lives inside a PropertyGroup method (props.py:360-405). Includes the inversion test for the pre-fix 'Name.001.001' growth (commit 35690ab). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Log-only visualization; no badge, no gate. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Also checks off the two Phase 3 leftovers that are now factually done (__tmp_ swap tests landed with A-2; target coverage finished by this order). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- get_active_pattern None test now uses empty patterns, the only configuration the real prefs can produce (preferences.py:138-149 clamps out-of-range indices) - Import ADDON_ID instead of hardcoding it in the props tier-2 test - Disambiguate base.py citations to core/contracts/base.py and soften an overclaiming strip docstring - Record the unreachable _remove_deleted_patterns dead path (facade.py:136-139 always deletes first) in the phase plan Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Owner
Author
|
司令塔レビュー(同一アカウントのため approve 不可、コメントで記録): 全受け入れ条件を独立検証で確認。
マージします。 |
8 tasks
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.
発注書
dev-note/orders/2026-06-13-test-coverage.md(#1)の納品 PR です。1. 結果サマリー(数値はすべてツール出力から)
core/pattern/facade.pyカバレッジcore/pattern/factory.pyカバレッジuv run pytest)tests/blender/run.sh)新規テスト 86 件の内訳: facade 21 / factory 13 / File 純関数 32(以上 Tier 1)、ShapeKey 4 / Strip 4 / Collection 4 / Material 2 / props.py A-1-4 回帰 6(以上 Tier 2)。既存テストは無変更で全緑、xfail 6 件(02章の原理的限界)は不変。
2. 設計判断と根拠
facade のフェイク戦略 — Tier 1 のダックタイピング代役を採用(Tier 2 案は不採用)
hasattr/getattrでしか読まず(factory.py:103-141)、facade が prefs に求めるのもpatterns/get_active_pattern()の2点だけ(facade.py:48-49, 121, 150, 179)。get_prefsもcontext.preferences.addons[ADDON_ID].preferencesを辿るだけ(addon.py:76-93)なので、tests/unit/fakes.pyに追加した FakeElementProperty / FakePatternProperty / FakePrefs / make_fake_context で全経路に到達できる.values()を持つコレクション → 名前リスト変換」は FakeBpyCollection で固定props.py A-1-4 は発注書の想定どおり Tier 2 で実物駆動(
tests/blender/test_props_uniqueness.py)。addon_utils.enable(default_set=True)→ 実物prefs.patterns上でadd_elementを駆動し、修正前の「Name.001.001増殖」(commit 35690ab)の反転テストを含む 6 件。module 終了時に必ず disable、userpref は保存しません。File は発注書の代替方針に切替。FileSelectEntry はヘッドレスで生成不能のため、純関数群(サニタイズ / Windows 予約名 / 拡張子 allowlist、file.py:114-178)を Tier 1 で固定(32 件)。FileRenameTarget 本体は Tier 3(手動)領域。
検証プロセス: ドメイン読込は並列リーダー3体、Tier 2 ターゲットテストはサブエージェントに分担、納品前にフレッシュなコンテキストの検証エージェントが 00-policy 準拠・無主張テスト・数字と実態の一致を独立検証(指摘は最終コミット c8020e6 で反映済み、重大指摘ゼロ)。
3. 発見事項(修正はしていません — 記録のみ)
pattern.validate()のエラーは error ログのみで握りつぶされ欠陥パターンがそのまま返る(factory.py:49-53 — raise がコメントアウト)。numeric_counter 欠落はここを素通りし、後段parse_nameの StopIteration(model.py:78-83 の FIXME)に到達し得る。一方、要素レベルの設定不備(text の items 空)は registry の ValueError(registry.py:156-157)が factory.py:68 のexcept (KeyError, TypeError)に捕まらず呼び出し元へ素通し_remove_deleted_patternsの削除ループ(facade.py:155-158)は、常に先行する_synchronize_modified_patterns内の整合性ループ(facade.py:136-139)が同じ削除を済ませるため到達不能。未カバー 6 行の正体(94% 止まりの理由).001を付け、戻り値は常に "RENAMED"(ボーンの 03章 §2.4 と同じ機構)strips/strips_allのみ)、new_effectはframe_end→lengthに破壊的変更上記 1〜3 は dev-note/testing/01-phase-plan.md の「Phase 2.5 の新発見」にも記録済み。
4. 受け入れ条件チェックリスト
core/pattern/facade.pyとfactory.pyのカバレッジ 70% 以上 → 94% / 100%uv run pytest(166 passed / 6 xfailed)とtests/blender/run.sh(39 passed)の両方ローカル確認済みaddon_utils.enableによる props_uniqueness 6 件を含め全件 PASSED)制約の遵守
--covのログ表示のみ追加(バッジ・ゲートなし)🤖 Generated with Claude Code