fix: mille init accuracy — same-name dir separation, .venv exclusion, Python internal imports#55
Merged
Merged
Conversation
…submodule allow because of user-reported issues
…monorepo src_root because of External violation false positives
…src_root in Python resolver for monorepo
… because of parse error and internal pkg contamination
…m external_allow in generate_toml
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.
Summary
Fix 1 — 異サブプロジェクトの同名ディレクトリを分離 (
src/usecase/init.rs)crawler/src/domainとingest/src/domainが1つのレイヤーにまとめられていた問題を修正。find_distinguishing_prefix()が最初に差異があるパスセグメントを prefix として使用し、crawler_domain/server_domainのように分離する。統合はユーザーが手動で行う。Fix 2 —
.venv等をスキャン除外 (src/infrastructure/repository/fs_source_file_repository.rs)mille check時に.venv/venv/node_modules/target等を含むパスをフィルタリング。apps/**のような glob パターンを生成してもエラーにならない。Fix 3 — Python サブモジュールの
external_allowマッチング (src/domain/service/violation_detector.rs)external_allow = ["matplotlib"]がmatplotlib.pyplotを許可しなかった問題を修正。Python ファイルは.区切り、Rust/Go は::区切りで top-level 名を抽出。Fix 4 —
mille initが[resolve.python] package_namesを生成 (src/usecase/init.rs,src/infrastructure/resolver/python.rs)package_namesが未設定だとimport domain.entityが External と誤分類され、生成直後の config でmille checkがエラーになる問題を修正。generate_toml()がレイヤーパスの base dir からpackage_namesを自動生成src_rootを自動導出 → モノレポでも resolved path がレイヤーパターンにマッチFix 5 —
src_rootを省略可能に +external_allowから内部パッケージ名を除外 (src/domain/entity/config.rs,src/usecase/init.rs)PythonResolveConfig.src_rootに#[serde(default)]を付加 →[resolve.python]にsrc_rootがなくても parse エラーにならない(型で省略可能を明示)generate_toml()がpackage_namesに含まれる名前をexternal_allowから除外 →domain等の内部パッケージがexternal_allowに混入しないTest plan
test_infer_layers_groups_dirs_by_base_name— 異サブプロジェクトの同名ディレクトリが別レイヤーになるtest_infer_layers_separate_same_name_dirs_different_subproject— crawler/ingest/server が 3 つの*_domainレイヤーになるtest_collect_skips_venv_paths—.venv/lib/fake.pyが除外されるtest_detect_external_python_submodule_allowed—matplotlib.pyplotがexternal_allow = ["matplotlib"]で許可されるtest_detect_external_python_submodule_violation— top-level が allow にない場合は violationtest_detect_external_rust_colon_still_works— Rust::区切りのリグレッションなしtest_generate_toml_python_adds_resolve_section— Python 時に[resolve.python] package_namesが出力されるtest_resolver_monorepo_absolute_import_uses_src_root— モノレポで resolved path が正しく生成されるtest_python_resolve_config_without_src_root_parses—src_rootなしの config が parse できるtest_generate_toml_python_filters_package_names_from_external_allow— 内部パッケージ名がexternal_allowに混入しない🤖 Generated with Claude Code