本卡屬 FR-089(母卡 CM-1688),修 arc review CM-1738「守衛有牙齒/沒牙齒」清單裡歸主專案守衛的三項。建議 model:Sonnet 5,effort:medium——每條都要用突變證明新守衛真的會紅。
本 arc 的成果靠守衛守住,但 review 抓到三處守衛本身有問題:① 兩條用「目錄存不存在」判的守衛,殘留的空 __pycache__ 目錄就會假紅(首腦驗 CM-1737 與 review runner 都實際撞到);② SOP §4.3 三條版面規則(套件頂層不平鋪、port 只在 domain/ports.py、tests/ 在套件根)21 支現在合規但零守衛,第 22 支開始就會漂;③ _PORT_IMPL_ALLOWED_OUTSIDE_PLUGINS 白名單兩列「誰在用它」的理由寫錯——白名單的價值全在那句理由,寫錯會讓下一個人誤判可以搬。
test/test_module_boundaries.py
:1142 _CONVERGED_PLUGIN_DIRS + test_converged_plugin_adapters_do_not_return_to_infra(path.exists())
test_extracted_module_shell_dirs_removed(同樣 path.exists(),grep 找行號)
:1168 _PORT_IMPL_ALLOWED_OUTSIDE_PLUGINS
「infra/survey/adapters.py」列理由寫 di_containers/survey/ → 實查零 import;真 caller 是 api/survey/__init__.py:26-28 與 di_containers/evidence_classification/
「common/integrity/adapters.py」列理由寫「app/ 與 api/ 也用 hotpath_verify」→ api/ 零命中,只有 app/oscal/service/export/ssp_export_app_service.py:19;main.py:103 import 的是 common.integrity 不是 .adapters
版面規則規範:docs/features/FR-069-2608-jedi-module-extraction/extraction-sop.md §4.3 三條;現況 jedi-iam 頂層 1 檔、jedi-integrity 頂層 5 檔是有 docstring 的相容殼(review 判合規),三支頂層 ports/ 殼(file-upload/iam/oscal-v2)歸 I-5 另一張卡收
path.exists() 改成「目錄內有 .py 檔」(any(p.suffix == '.py' for p in target.rglob('*')))或 git ls-files <path> 非空。兩條用同一支 helper。test/test_module_boundaries.py,掃 monorepo 21 支,沿用檔內既有的 _monorepo_package_roots()):(a) 頂層 jedi_<pkg>/*.py 只允許 __init__.py,其餘每檔要在白名單並寫「相容殼、哪張卡收」;(b) 不得存在頂層 jedi_<pkg>/ports/ 目錄,現有三支進白名單標「I-5 卡收」;(c) 不得存在 jedi_<pkg>/tests/(tests 在套件根)。既有違規全進白名單,每列寫理由,寫不出的回寫。mkdir -p infra/asset/__pycache__ → 改後守衛不紅(這是修假紅);再放一個 infra/asset/x.py → 紅。刪掉還原。jedi_issue/stray.py → 紅。②b:mkdir jedi-issue/jedi_issue/ports 放一個 __init__.py → 紅。②c:mkdir jedi-issue/jedi_issue/tests 放 __init__.py → 紅。全部刪掉還原,git status 兩 repo 乾淨。git diff --stat/git status --short 確認真的有那個檔。全量:pytest test/test_module_boundaries.py -q 貼 tail -1;新增三條都綠。
test_converged_plugin_adapters_do_not_return_to_infra 要綠(這正是修的症狀)。test/test_module_boundaries.py,不碰套件(突變用的檔要全部刪乾淨)。註解只留為什麼與陷阱(守衛旁寫一句「為何不能用 path.exists」)。git add test/test_module_boundaries.py、commit -- test/;append 白話(三條新守衛白名單各幾列與理由、五個突變結果、commit hash);狀態改「修正待驗證」。push 等令。feature/FR-075 不切。不派 subagent。