feat(M01): 로직 지우기 검사 = 모든 층 일위대가 문서 담은로직 + 실무문서 — 쓰는 곳 알림 · 조합 고치기 길(PUT) 은퇴(39-1d)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013rJwJMVL4EE31y77TB11AP
This commit is contained in:
@@ -217,7 +217,37 @@ def check_saved(files: dict, changed: list[str], book: dict, narrowed=None) -> l
|
||||
out += cm.check_logics(files, whole, book, narrowed and narrowed[:2])
|
||||
if narrowed and narrowed[2]: # 요소·표를 고쳤으면 연결 · 준용도 봄(로직 좁힘과 따로)
|
||||
out += cm.check_links(whole)
|
||||
return out + cm.mcb.check_all(files, whole)
|
||||
return out + cm.mcb.check_all(files, whole) + labor_errors(whole)
|
||||
|
||||
|
||||
def _labor_files() -> list[tuple[str, Path]]:
|
||||
"""모든 층(마스터 · 회사 · 개인)의 일위대가 문서 `labor/<열>.json` — (어디, 파일)."""
|
||||
from M02_MasterTemplete import M02_Template_Layers as layers # M02 가 M01 을 부름 — 늦게
|
||||
|
||||
root = layers.storage_root()
|
||||
found = [("마스터", p) for p in sorted((layers.system_dir() / "labor").glob("*.json"))]
|
||||
found += [(f"회사 {p.parts[-4]}", p) for p in sorted(root.glob("*/templates/labor/*.json"))]
|
||||
personal = sorted(root.glob("*/*/templates/labor/*.json"))
|
||||
return found + [(f"개인 {p.parts[-5]}/{p.parts[-4]}", p) for p in personal]
|
||||
|
||||
|
||||
def labor_errors(whole) -> list[str]:
|
||||
"""일위대가 문서가 담은 로직이 마스터에 없음(39-1d) — 로직 지우기를 막음 · 어디서 쓰는지 알림.
|
||||
전부터 깨진 것은 `save` 가 고치기 전 검사와 견주어 뺌."""
|
||||
out = []
|
||||
for where, path in _labor_files():
|
||||
try:
|
||||
doc = json.loads(path.read_bytes())
|
||||
except (OSError, ValueError):
|
||||
continue
|
||||
name = (doc.get("일위대가번") if isinstance(doc, dict) else None) or path.stem
|
||||
for one in (doc.get("담은로직") if isinstance(doc, dict) else None) or []:
|
||||
key = str(one.get("로직") or "") if isinstance(one, dict) else ""
|
||||
try:
|
||||
whole.logic(key)
|
||||
except cm.mf.FormulaError:
|
||||
out.append(f"일위대가 {where} 「{name}」 이 로직 「{key}」 을 씀 — 거기서 먼저 뺌")
|
||||
return out
|
||||
|
||||
|
||||
def warm(folder: Path) -> threading.Thread:
|
||||
|
||||
Reference in New Issue
Block a user