refactor(855-E L3ⓐ): M01 기초 저장 · 검사 · 막힘 세기 = 수식 문서 기준 · 로직 줄 쓰기 = Store_Logic.mirror 한 자리
앞 세션 auto 커밋 cce57c298(Store_Logic 새 길 · /logic 답 머리만 · 판 = 문서 파일 지문 · 개정 = 문서 머리 대조 · 별칭 · 기계 등록 · [신규] · [삭제])에 이어 - Store_Cache: 막힘 세기(blocks · counted)를 문서 파일마다 · 저장 검사 logic_errors = 키 겹침 · 대장(요소 + 문서 키) · 연결 · 문서 막힘(check_logics 로직 줄 검사 걷음) · _docs_of = 문서 전부 · narrow 로직 갈래 걷음 · check_saved(부름 0) 지움 - Store_Save: 기초(로직 파일) 받지 않음(400) · gone · labor_errors(whole) 갈래 걷음 - Store_Logic: 정본 파일에도 새 기초(그 파일 표 키 — 옛 /save 와 같음) · 지움 검사에 조합 · 지운 기초를 부르던 문서 더함(옛 422 그대로) · 쓰는 곳 409 는 Doc.remove 로(옛 자리) - 시험(옛 /save 로 로직 줄 셈 칸 고침 · /logic 답 셈 칸을 붙든 것 = 죽은 길): 새 test_855_l3_doc_only(로직 파일 없음 + 같이 쓰기 끔 = 켬과 답 같음 · 목록 · 상세 · 저장 · 개정 409 · 판 409 · 별칭 · 신규 · 복사 · 삭제 · 기계 등록) · test_m01_cache 셈 칸 /save 검사 셋 · test_794_1 식 고침 /save 422 걷음(셈 칸 고침 = 문서 저장 몫 · /save 는 머리만 씀) · test_m01_make 「시험 계산에 돈다」 → 빈 문서로 열림 · test_m01_api · test_m01_text 옛 셈 길 시험은 로직 줄 사본에서 읽음 · test_854_2_m01_key_book 대장 끊김 = 인력 줄 + 기초 문서 쓰기 · test_794_1b · test_804_7 판 = 문서 파일 · test_802_3 문서 없는 키 = 404(빈 문서 안 지음) · test_826_2 좁힌 검사 = 판정만 견줌(기초 흠 글이 문서 꼴) · 로직 갈래 셋 뺌 · test_m01_copy 옛 시트 길 걷고 master_copy 왕복만 · test_854_2_m01_copy_doc 식 복사 → 기본정보 고친 복사 · test_713_1 · test_796_1 row_print 줄 뺌(row_print 지움) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
|
||||
전 = 기억(`Store_Cache.loaded`) · 후 = 고친 파일만 얕은 사본(줄 목록만 새로 · 줄은 바꿔 끼움만) —
|
||||
폴더를 다시 읽지 않음. 검사 = 저장이 흔드는 것만: 로직은 `Store_Cache.narrow` · 틀은 고친 줄만 ·
|
||||
연결 · 준용은 요소를 고쳤을 때 · 조합은 조합 파일을 고쳤거나 로직 줄이 빠질 때 · 일위대가 · 사전조합
|
||||
문서(모든 층 파일)는 로직 줄이 빠질 때 그 키만 · 키 겹침 · 대장 대조 · 돌고 도는 참조는 전체(가벼움).
|
||||
연결 · 준용은 요소를 고쳤을 때 · 조합은 조합 파일을 고쳤을 때 · 키 겹침 · 대장 대조 ·
|
||||
돌고 도는 참조는 전체(가벼움) · 기초(로직) 저장은 `Store_Logic`(855 L3 ⓐ).
|
||||
전 검사는 기억 색인(재료 고르기 찾기 기억이 데워져 있음) · 후 색인은 그 기억을 이어받음
|
||||
(자재품목 줄이 바뀌면 그 줄이 걸리는 찾기만 버림). 저장 뒤 = 쓴 파일만 기억에 갈아 끼움.
|
||||
"""
|
||||
@@ -65,17 +65,20 @@ def _index(files: dict, whole, moved: list[dict]):
|
||||
return out
|
||||
|
||||
|
||||
def _errors(files, whole, names, book, narrowed, keys, gone) -> list[str]:
|
||||
def _errors(files, whole, names, book, narrowed, keys) -> list[str]:
|
||||
out = [x for name in names for x in cm.check_form(name, _only(name, files[name], keys[name]))]
|
||||
out += cache.logic_errors(files, whole, book, narrowed[:2]) # 수식 문서 기준(855 2-B3)
|
||||
if narrowed[2]: # 요소·표를 고쳤으면 연결 · 준용도 봄(로직 좁힘과 따로)
|
||||
out += cm.check_links(whole)
|
||||
if cm.mcb.FILE in names or gone:
|
||||
if cm.mcb.FILE in names:
|
||||
out += cache.combo_errors(files)
|
||||
return out
|
||||
|
||||
|
||||
def save(batch: list[dict]) -> list[dict]:
|
||||
"""요소 · 표 파일 저장 — 단가산출 기초(로직 파일 몫)는 받지 않음(`Store_Logic` · 855 L3 ⓐ)."""
|
||||
if bad := [p.get("file") for p in batch if _logic_file(p.get("file", ""))]:
|
||||
raise store.StoreError(400, f"기초는 기초 저장 길로 — {', '.join(bad)}")
|
||||
with store._LOCK:
|
||||
stale = [
|
||||
p.get("file", "") for p in batch if store.version(p.get("file", "")) != p.get("version")
|
||||
@@ -92,7 +95,7 @@ def save(batch: list[dict]) -> list[dict]:
|
||||
for part in batch:
|
||||
store._apply(after[part["file"]], part.get("changes") or [], part["file"], book)
|
||||
mk.finish(book)
|
||||
keys, gone, moved = {}, set(), []
|
||||
keys, moved = {}, []
|
||||
for name in names:
|
||||
was, now = _rows(before[name]), _rows(after[name])
|
||||
keys[name] = set(now) - set(was)
|
||||
@@ -103,17 +106,13 @@ def save(batch: list[dict]) -> list[dict]:
|
||||
for c in p.get("changes") or []
|
||||
if c.get("op") != "add"
|
||||
}
|
||||
if after[name].get("그룹") == "로직":
|
||||
gone |= set(was) - set(now)
|
||||
moved += [s[k] for k in keys[name] for s in (was, now) if k[:2] == "MT" and k in s]
|
||||
# 저장이 흔드는 줄만 검사(고친 줄 · 그 줄을 부르던 줄 · 그 요소를 보던 줄) —
|
||||
# 마스터 전체 검사는 `check_master` 몫
|
||||
narrowed = cache.narrow(store.FOLDER, batch, before, after)
|
||||
old = set(_errors(before, whole, names, old_book, narrowed, keys, gone))
|
||||
old = set(_errors(before, whole, names, old_book, narrowed, keys))
|
||||
fresh = _index(after, whole, moved)
|
||||
new = _errors(after, fresh, names, book, narrowed, keys, gone)
|
||||
# 일위대가 · 사전조합 문서가 담은 로직이 빠짐 — 빠지기 전엔 있던 키라 전 검사는 없음
|
||||
new = [x for x in new + cache.labor_errors(fresh, gone) if x not in old]
|
||||
new = [x for x in _errors(after, fresh, names, book, narrowed, keys) if x not in old]
|
||||
if new:
|
||||
raise store.StoreError(422, {"errors": new})
|
||||
# 대장(원자적) → 파일 · 중간에 끊기면 쓴 것 모두 저장 전으로(대장만 · 파일만 앞서가지 않게)
|
||||
@@ -135,6 +134,10 @@ def save(batch: list[dict]) -> list[dict]:
|
||||
return out
|
||||
|
||||
|
||||
def _logic_file(name: str) -> bool:
|
||||
return name.startswith("로직_") and name.endswith(".json")
|
||||
|
||||
|
||||
def _machine(name: str) -> bool:
|
||||
return name == mmf.NAME and mmf.here(store.FOLDER) # 기계 = 폴더(826-2)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user