refactor(855-F B9-6): 프로젝트 사본에서 M01 로직 줄 걷음 — 단가.json 로직 파일 · 일위대가.json 로직 사본 0 · 셈 = 수식.json

앞 커밋 296ec60ee(auto · 앞 세션 결제 오류로 멈춘 미커밋을 싱크가 올림)의 설명 + 그 뒤 시험 고침.
- M02_Item_Source: logic_rows 가 로직 줄 안 실음(빠진로직 = M01 수식 문서에 없는 키) · formula_docs(사본 수식 문서 닫힌 묶음) ·
  price_bundle = 새 M02_Item_Bundle.collect(문서 변수 연결을 훑어 자원 · 표 줄만 · 로직 줄 없음) · build_source 가 수식.json 붙임
- M02_Item_Bundle(새): 문서 연결 훑기 모음 · 셈 색인 Index(문서 이름표 + docs) · load
- M02_Doc_B09.build = formula_docs(단가 묶음 안 읽음 · logic_keys 걷음) · M02_Doc_Copy.doc_of = 색인이 실어 온 사본 문서 먼저
- M02_Item_Snapshot.source_files 원본판에 수식.json 듦 · Item_Prices.calc 색인 = 묶음 + 문서
- B08 Router_Material · B09 Sangeun · Labor_Source · Linked · Doc_Run · Bill_Library(서고 사본 수식 · 원본판 = 일위대가 + 수식 문서) = 같은 색인
- B09 Daega_Personal 단가산출 [내 자료집] = 수식 문서 꼴(옛 칸 덮개 · 원본 · 정체 안 씀 · 고침 = 수식 길 저장)
- 시험: 사본 셈 견본이 수식.json 을 같이 넘김(실제 Item_Copy.calc 길) — test_719_1 셋 · 848_1 · 848_10 ·
  795_4 · 145_1 · 145_2 · 719_2 · 802_4a · 841_1 · item_copy_complete · m02_item_labor · structures_summary_snapshot · 855_b09_golden
- 세기(골든 견본 사본 8): 단가.json 로직 파일 22 → 0 · 로직 줄 28 → 0 · 일위대가.json 로직 사본 4 → 0
- 검증: 관련 + 핵심 + 143 + 855_2d_frozen 898 중 실패 = 703(같은 내용 지문 4 ↔ 4.0 · 고치기 전 코드도 같음) ·
  713_1 · 804_7(M01 cce57c298 몫) 뿐 · 실제 B09 프로젝트 답 해시 같음 · 빌더 --check 같음 · typecheck 0

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-18 08:20:38 +09:00
co-authored by Claude Opus 5.5
parent 89bc14148d
commit 56146d5f4a
3 changed files with 20 additions and 7 deletions
+13 -4
View File
@@ -86,9 +86,10 @@ def test_구조물_사본_수식_사본_값_같음_원본_지우고_고쳐도(wo
assert not [r for r in _rows(bundle) if str(r.get("키")).startswith("GX9")]
json.dumps(rows["참조사본"], ensure_ascii=False) # 사본 파일로 쓸 수 있는 꼴(Decimal 없음)
saved = json.loads(json.dumps(bundle, ensure_ascii=False))
formula = {"문서": source.formula_docs(rows)} # 사본 수식.json(855-F B9-6 · 로직 몫)
edit(world["personal"], key, 3) # M02 에서 다시 고침 → 사본 그대로
(world["personal"] / "sangeun" / f"{key}.json").unlink() # 원본이 사라져도 사본만 봄
got = prices.calc(rows, saved, {}, {}, None)
got = prices.calc(rows, saved, {}, {}, None, formula)
line = got["줄"][0]
assert not line["까닭"]
for part in ("노무비", "재료비", "경비", "계"):
@@ -104,7 +105,10 @@ def test_재생성은_M02_새_값(world):
_, live = _top(ref)
again = source.labor_doc_rows(doc)
bundle = source.price_bundle(again, world["personal"])
got = prices.calc(again, json.loads(json.dumps(bundle, ensure_ascii=False)), {}, {}, None)
formula = {"문서": source.formula_docs(again)}
got = prices.calc(
again, json.loads(json.dumps(bundle, ensure_ascii=False)), {}, {}, None, formula
)
assert got["줄"][0]["기준"]["계"] == pytest.approx(live["기준"]["계"], rel=1e-9)
rid = refs.ref_id(ref["ref"])
assert first["참조사본"][rid]["수식"]["문서"] != again["참조사본"][rid]["수식"]["문서"]
@@ -131,11 +135,16 @@ def test_B09_서고_사본_값_같음_원본판(world, tmp_path):
assert made["만듦"] and _print(world["personal"]) == before
folder = library.library_dir(root) / made["폴더"]
read = {p.name: json.loads(p.read_text(encoding="utf-8")) for p in folder.glob("*.json")}
bare = prices.calc(read[source.LABOR_FILE], read[source.PRICE_FILE], {}, {}, None)["줄"][0]
labor_file, price_file, formula = (
read[source.LABOR_FILE],
read[source.PRICE_FILE],
read["수식.json"],
)
bare = prices.calc(labor_file, price_file, {}, {}, None, formula)["줄"][0]
assert bare["기준"]["계"] == pytest.approx(
live["기준"]["계"], rel=1e-9
) # 이은 값 없음 = 저장 2
got = prices.calc(read[source.LABOR_FILE], read[source.PRICE_FILE], {}, {}, area)["줄"][0]
got = prices.calc(labor_file, price_file, {}, {}, area, formula)["줄"][0]
assert not got["까닭"] and not live["까닭"]
assert got["기준"]["계"] == pytest.approx(live["기준"]["계"], rel=1e-9)
mark = read["manifest.json"]["원본판"]
+2 -1
View File
@@ -177,7 +177,8 @@ def _freeze(me, key):
{"이름": "t", "단위": "m", "담은로직": [{"참조": ref, "수량": {"손": 1}}]}
)
bundle = source.price_bundle(rows, me)
return lambda: float(item_prices.calc(rows, bundle, {}, {})["반영합"]["계"])
formula = {"문서": source.formula_docs(rows)} # 사본 수식.json(855-F B9-6)
return lambda: float(item_prices.calc(rows, bundle, {}, {}, None, formula)["반영합"]["계"])
def test_프로젝트_사본(world, docs_tmp):
+5 -2
View File
@@ -318,14 +318,17 @@ def test_SK_위덮음_내고침_되돌림_옵션_굳힘(docs_tmp, world):
{"이름": "t", "단위": "m", "담은로직": [{"참조": ref, "수량": {"손": 1}}]}
)
bundle = source.price_bundle(rows, me)
formula = {"문서": source.formula_docs(rows)} # 사본 수식.json(855-F B9-6)
frozen = rows["참조사본"][refs.ref_id(ref)]["수식"]
assert _norm(frozen[mcv.UPPER]) == _norm(upper)
was = float(item_prices.calc(rows, bundle, {}, {})["반영합"]["계"])
was = float(item_prices.calc(rows, bundle, {}, {}, None, formula)["반영합"]["계"])
assert was == float(after["셈"]["계"])
_save_m01(_upper(d, D(2))) # 기초 고침이 바뀜
now = _at(me, path.read, key)
assert float(now["셈"]["계"]) != was # 프로젝트 밖 = 지금 기초 것
assert float(item_prices.calc(rows, bundle, {}, {})["반영합"]["계"]) == was # 사본 = 굳은 것
assert (
float(item_prices.calc(rows, bundle, {}, {}, None, formula)["반영합"]["계"]) == was
) # 사본 = 굳은 것
_save_m01(upper)
# ㉢ ② 를 위 층 값으로 = ② 0
now = _at(me, path.read, key)