feat(M01): 로직 지우기 검사 — 모든 층 구조물 일위대가 문서가 담은 로직까지 (39-1b B9)

- M01 저장 전 검사(check_saved)에 labor_errors — 시스템 층 · storage 회사 · 개인 층 labor/*.json 이 담은 로직이 없어지면 막음(프로젝트 층 빼고 · 실무문서는 조합 검사 그대로)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYJJRCfHfdCGNhmXTjQKV7
This commit is contained in:
2026-10-04 17:57:07 +09:00
co-authored by Claude Opus 5.5
parent 5617f9e891
commit ecc4a651a4
2 changed files with 62 additions and 1 deletions
+27
View File
@@ -211,3 +211,30 @@ def test_길_틀린_문서_400_없는_열_404_남의_개인_층_403(client):
assert client.post(url.format("system", "없는열"), json={}).status_code == 404
other = client.post(url.format("personal", "rv") + "?owner=7/99", json={})
assert other.status_code == 403
def test_로직_지우기_검사는_모든_층_일위대가를_봄(tmp_path, monkeypatch):
from config import config_system
from M01_MasterData import M01_MasterData_Store_Cache as cache
system, storage = tmp_path / "system", tmp_path / "storage"
for folder, code in (
(system / "labor", STONE),
(storage / "7" / "templates" / "labor", TEN), # 회사 층
(storage / "7" / "42" / "templates" / "labor", STONE), # 개인 층
(storage / "7" / "42" / "p1" / "templates" / "labor", STONE), # 프로젝트 — 안 봄
):
folder.mkdir(parents=True)
body = {"담은로직": [{"로직": code}]}
(folder / "a.json").write_text(json.dumps(body), encoding="utf-8")
monkeypatch.setattr(cache, "LABOR_ROOTS", (system,))
monkeypatch.setattr(config_system, "STORAGE_BASE_DIR", str(storage))
class Gone: # STONE 을 지운 마스터
def logic(self, code):
if code == STONE:
raise cache.cm.mf.FormulaError("없음")
got = cache.labor_errors(Gone())
assert len(got) == 2 and all(STONE in x for x in got)
assert any("system/a" in x for x in got) and any("templates/a" in x for x in got)