Skip to content

chore: Debt cleanup — dead code deletion, small repairs, distribution alignment - #5

Merged
Pluglug merged 10 commits into
mainfrom
chore/debt-cleanup
Jun 12, 2026
Merged

chore: Debt cleanup — dead code deletion, small repairs, distribution alignment#5
Pluglug merged 10 commits into
mainfrom
chore/debt-cleanup

Conversation

@Pluglug

@Pluglug Pluglug commented Jun 12, 2026

Copy link
Copy Markdown
Owner

発注書 dev-note/orders/2026-06-13-debt-cleanup.md(#2)の納品 PR です。テストは原則無変更のまま(変更は conftest スタブの連動縮小のみ)、製品コードを削って全テスト緑を維持しています。

1. 結果サマリー(数値はすべてツール出力から)

指標
製品コード(src/) -2,236 行(+9 行、13 ファイル)
conftest の bpy スタブ -31 行(_Operator + _Object/_PoseBone/_EditBone/_Node)
カバレッジ TOTAL 28%(7,363 stmts) 31%(6,415 stmts)
facade.py 94% 98%(到達不能パス削除)
counter_element.py 65% 85%(AlphabeticCounter 削除)
Tier 1 / Tier 2 166 passed / 6 xfailed・39 passed 不変

10 コミット(1コミット=1クラスタ)。全コミット時点で両 Tier 緑を検証エージェントがループ実測済み — bisect 可能です。

削除内訳: utils 3 ファイル(class_diagram_generator 1,191 / screen_utils 424 / collection_utils 251)、addon.py の Timeout/TimeoutOperator/timeout、AlphabeticCounter、コメントアウト残骸(schema/pattern.py の旧 JSON スキーマ 136 行、target/registry.py の _initialize_defaults、conflict.py の BlenderCounter 実験ブロック)、facade の _remove_deleted_patterns

2. 判断と根拠

  • 各削除は「grep で参照ゼロ確認 → 削除 → 連動削除 → 両 Tier + 実機」を1サイクルで実施。実機検証は Tier 2 スイート(addon_utils.enable/disable を含む)+ 隔離レシピのプローブで代替・確認
  • facade の _remove_deleted_patterns は削除前に到達不能性を再検証: 唯一の呼び出し元では直前の _synchronize_modified_patterns 末尾ループが prefs に無いキャッシュ ID を必ず先に削除し、update ループは prefs 由来しか足さないため差集合は恒真で空。検証エージェントも独立に同じ結論。削除系テストは緑のまま、facade 94%→98%
  • 意図的残置: conflict.py の _find_unused_min_counter_valueSTRATEGY_FORCE 関連(milestone §3.5 の設計判断で復活候補)は残しています
  • position_element の遅延 import 化は text_element と同方式。conftest から Object/PoseBone/EditBone/Node スタブを消してスイートが緑 = 要素層→target 層結合の解消の証明(collector 自身の正当な要求は fabrication フォールバックに落ち、bpy.types._fabricated で観測可能)
  • ロガー修復: 強制 WARNING ループのみ除去し、INFO での新規登録と update_logger_settings は維持。実機プローブ(隔離レシピ)で prefs・実ロガーとも INFO 立ち上がりを確認
  • requirements.txt は廃止して pyproject の docs グループへ。旧ピンは Dependabot 24 件の発生源かつ不完全(conf.py が要求する myst-parser / furo / sphinx-automodapi 等を欠き、docs ビルドが成立しない構成だった)。新グループは conf.py の extensions から導出し、sphinx-build exit 0 で完全性を実証。black は dev グループへ移動
  • fake-bpy-module はどのグループにも入れていません(発注書の罠どおり)。uv run python -c "import bpy" が ImportError であることを確認済み — スタブ規律(00-policy 原則2)は無傷。IDE 用の提案: 必要な人は uv pip install fake-bpy-module を venv に手動投入するか、uv sync が既定で入れない opt-in グループ(例: ide)を将来追加する方式を推奨

3. 発見事項(修正していません)

  1. docs の design_notes に削除済みシンボルへの言及が残存: docs/source/development/design_notes/class_diagrams.rst:251,487(AlphabeticCounter、Sphinx ビルド対象)、docs/debug/class_diagram.mmd ほか(削除した class_diagram_generator の生成物)。発注の「文章の改善・構成変更はしない」に従い残置 — 次の docs 整備の候補
  2. conflict.py:5 の NumericCounter import は残置コメント(_find_unused_min_counter_value)専用で、live コードは element_type 文字列で判定している。§3.5 の復活候補に付随するため温存
  3. facade.py に未使用 import が残る(import json、typing の Dict)— 発注リスト外のため未削除
  4. facade.update_pattern の log_message が削除後に計算されるため常に "Registered" と出る(ログのみの latent bug)
  5. addon.py の per-file カバレッジは 13%→11% に低下: 削除した Timeout 群は import 時に実行される class/def 行で「カバー済み dead code」だったため分子が減る計算上の artifact(TOTAL は 28%→31% に上昇)
  6. bl_info と blender_manifest.toml の二重管理自体は残る(本 PR で値は揃えた)

4. 受け入れ条件チェックリスト

  • 両 Tier 緑(uv run pytest 166 passed / 6 xfailed・tests/blender/run.sh 39 passed)+ 実機で enable/disable エラーなし(隔離レシピのプローブ + Tier 2 の addon_utils.enable/disable 経路)
  • CI 緑 → 確認済み(unit 166 passed / 6 xfailed + カバレッジサマリー、blender 39 passed — push/pull_request 両イベントで pass)
  • 既存テストの変更は「削除対象に直接紐づくもの」のみ → conftest.py の連動スタブ削除 31 行のみ。テスト本体の変更ゼロ
  • xfail 6 件は不変(検証エージェントが main と -rxX 出力を突き合わせて同一確認)
  • カバレッジが下がらない → TOTAL 28%→31% / facade 94%→98% / counter_element 65%→85%
  • _FORCE_ORDER / conftest スタブの連動削除が漏れていない(削除シンボル横断 grep でヒットゼロ)
  • 削除は意味のあるクラスタ単位で別コミット、各コミット時点で両 Tier 緑(全 10 コミットで実測)
  • dev-note/plans/2026-06-12-milestone.md §3 を実績更新(スコープ外の2項目は未チェックのまま明示)

🤖 Generated with Claude Code

Pluglug and others added 10 commits June 13, 2026 02:09
class_diagram_generator.py (1,191) / screen_utils.py (424) /
collection_utils.py (251). References verified zero by grep across
src/ and tests/ (only _FORCE_ORDER entries and self-references
existed). _FORCE_ORDER pruned accordingly; conftest had no stub
entries tied to these modules.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…4 §4)

Never registered and zero call sites (grep verified; only the conftest
stub comment referenced it). The companion timeout() helper goes with
it. Linked deletion: the bpy.types.Operator stub entry in
tests/conftest.py existed solely for this class-construction at import
time — removed as its own comment instructed, shrinking the stub.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Registration was commented out and the class crashes on instantiation
if ever registered (element_config.get does not exist on ElementConfig
- the known defect noted in analyze/04 §4). Linked deletions: the
commented register_element call and the commented alphabetic_counter
enum entry in core/constants.py. counter_element.py coverage 65% -> 85%.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- core/schema/pattern.py: 136-line commented NAMING_PATTERN_SCHEMA
- core/target/registry.py: commented _initialize_defaults with TEMPLOG
  prints (zero references)
- core/namespace/conflict.py: commented blender_counter takeover
  experiment inside _resolve_with_counter

Kept on purpose (milestone §3.5 revival candidates): the
STRATEGY_FORCE dispatch comment, _resolve_with_force, and the
commented _find_unused_min_counter_value with its trade-off analysis.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Re-verified unreachability before deleting (Phase 2.5 finding, recorded
in dev-note/testing/01-phase-plan.md): its only caller
synchronize_patterns always runs _synchronize_modified_patterns first,
whose trailing integrity loop already purges every cached id missing
from prefs, and the update loop only adds prefs-derived ids - so the
set difference here is provably empty. Empirically the deletion-path
test (test_pattern_removed_from_prefs_is_purged) stays green and
facade coverage rises 94% -> 98%.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…inding #5)

Aligns with text_element.py's lazy-import style: core.utils pulls in
the whole target layer at module level, so the eager import coupled
the element layer to the target layer for every consumer. With the
deferral, the conftest stub no longer needs the explicit
Object/PoseBone/EditBone/Node entries that documented this coupling -
removed (collector.py's own legitimate demand falls through to the
fabrication fallback, observable via bpy.types._fabricated). The stub
shrinking is the proof the coupling is gone.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
preferences.py register() clobbered every module's configured level
with WARNING on each enable (the self-admitted FIXME defect, milestone
section 3). Newly discovered modules still register at INFO; stored
levels are now respected and applied via update_logger_settings.
Verified in real Blender (isolation recipe): module prefs and actual
logging.Logger levels both come up INFO instead of WARNING.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
blender_manifest.toml's 1.1.0 is the source of truth: docs index and
the reference schema comment follow; bl_info blender minimum goes
(3,6,5) -> (4,2,0) to match blender_version_min. README's supported
list ("Objects, Bones only" with Nodes/Materials still "planned") is
replaced by the 19 implemented target types; getting_started's preset
examples now use file names that actually ship. Preset JSON
"version": [0,9,0] is the pattern-format version and stays untouched.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The frozen requirements.txt was the source of 24 Dependabot alerts and
was simultaneously incomplete: docs/source/conf.py requires
myst-parser, furo, sphinx-automodapi, sphinx-design, sphinx-copybutton,
sphinx-togglebutton and atsphinx-color-text, none of which were pinned
there. The new docs group is derived from the actual extensions list
and verified by a clean sphinx-build (exit 0). black moves to the dev
group ([tool.black] config already lives here); jsonschema and the
transitive pins are dropped (zero imports in src/ and tests/).

fake-bpy-module is intentionally in NO group: if uv sync installed it,
'import bpy' would succeed in unit tests and break the conftest stub
discipline (00-policy principle 2). IDE handling proposed in the PR.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Pluglug

Pluglug commented Jun 12, 2026

Copy link
Copy Markdown
Owner Author

司令塔レビュー(独立検証): 受け入れ条件すべて確認、マージします。

  • 10コミット(1クラスタ1コミット)、src/ -2,236行、テスト本体変更ゼロ(conftest -31行のみ)を diff で確認
  • 両 Tier 緑(166/6, 39)をローカル実測、実機 enable/disable OK(モジュール削除+_FORCE_ORDER 変更後)
  • FORCE 系・_find_unused_min_counter_value の温存指定を遵守
  • _remove_deleted_patterns 削除の安全性: 意図は _synchronize_modified_patterns の整合性ループが担い、PR test: Phase 2.5 coverage expansion (facade/factory fakes + tier-2 targets + A-1-4 regression) #4 の test_pattern_removed_from_prefs_is_purged(無変更)が通過 — 挙動固定→冗長除去の正しい順序

発注者の意向によるフォローアップ(司令塔が main に直接実施予定): class_diagram_generator を tools/ へ復元、NAMING_PATTERN_SCHEMA を dev-note の設計資料として保全。

@Pluglug
Pluglug merged commit 7620de5 into main Jun 12, 2026
4 checks passed
Pluglug added a commit that referenced this pull request Jun 12, 2026
…inding #5)

Aligns with text_element.py's lazy-import style: core.utils pulls in
the whole target layer at module level, so the eager import coupled
the element layer to the target layer for every consumer. With the
deferral, the conftest stub no longer needs the explicit
Object/PoseBone/EditBone/Node entries that documented this coupling -
removed (collector.py's own legitimate demand falls through to the
fabrication fallback, observable via bpy.types._fabricated). The stub
shrinking is the proof the coupling is gone.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Pluglug
Pluglug deleted the chore/debt-cleanup branch June 12, 2026 18:14
Pluglug added a commit that referenced this pull request Jun 12, 2026
…ols/

Owner feedback on PR #5 deletions:

- NAMING_PATTERN_SCHEMA: the intent ("define the data schema properly")
  predates the dead code. Preserved from 939c5a9 into
  dev-note/reference/naming-pattern-schema.md as the design artifact for
  the validation-consolidation task; also earmarked as the contract for
  AI-assisted pattern generation
- class_diagram_generator: restored verbatim to tools/ (stdlib-only,
  no addon coupling). Its previous in-package placement was the problem,
  not the tool itself

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant