From b3f3aed0a5dc7af2fbd8e9a082f315638570091c Mon Sep 17 00:00:00 2001 From: umsangdon Date: Sat, 31 Oct 2026 17:39:41 +0900 Subject: [PATCH] =?UTF-8?q?fix(M02=20=ED=86=B5=ED=95=A9=20=EC=A0=90?= =?UTF-8?q?=EA=B2=80=20=C2=B7=20704-4=20=C3=97=20706-1):=20=ED=9A=8C?= =?UTF-8?q?=EC=82=AC=EC=97=90=20=EC=98=AC=EB=A6=AC=EA=B8=B0=20=EC=8A=B9?= =?UTF-8?q?=EC=9D=B8=20=C2=B7=20=ED=9A=8C=EC=82=AC=EB=A1=9C=20=EB=B3=B5?= =?UTF-8?q?=EC=82=AC=20=EB=95=8C=20=EA=B7=9C=EA=B2=A9=20=EC=97=B4=20?= =?UTF-8?q?=EC=88=98=EB=9F=89=EC=9D=B4=20=EB=B2=84=EB=A0=A4=EC=A7=80?= =?UTF-8?q?=EB=8D=98=20=ED=9D=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 흠: 개인 층 하위 호표(사전조합)를 담은 구조물 조합을 회사로 올리면 참조가 회사 새 키로 바뀌는데 규격 열 수량 열쇠(`참조|personal|…`)는 그대로 → 그 줄 열 값이 버려져 기본 수량으로 셈 (실측: 거창 제5 · 6호표 묶음 2.5x2.0 열 1,270,715.6 → 회사 사본 1,259,136.2 · 차 11,579.4) - 고침: 참조 따라 복사(carry)할 때 규격 수량 열쇠도 새 참조로 바꿈 · 따라 복사되는 하위 문서도 같게 - 고친 파일: M02_MasterTemplete/M02_Labor_Ref.py · resources/tester/test_m02_labor_ref.py - 확인: 시험 test_m02_labor_ref · test_706_1 27 · test_704_4_spec 10 통과 · 브레인검증회사 다시 요청 · 승인 → 회사 사본 2.5 열 1,270,715.6 = 원본 Co-Authored-By: Claude Opus 5.5 --- M02_MasterTemplete/M02_Labor_Ref.py | 16 +++++++++++++--- resources/tester/test_m02_labor_ref.py | 21 +++++++++++++++++++++ 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/M02_MasterTemplete/M02_Labor_Ref.py b/M02_MasterTemplete/M02_Labor_Ref.py index 69cb5600e..34a8f3005 100644 --- a/M02_MasterTemplete/M02_Labor_Ref.py +++ b/M02_MasterTemplete/M02_Labor_Ref.py @@ -350,12 +350,22 @@ def carry(doc: dict[str, Any], source: Here) -> dict[str, Any]: got = read_ref(ref) if got is None: raise _bad(f"없는 참조 「{ref['키']}」") - body = origin_mark({**got, "담은로직": _moved(got.get("담은로직"), move, depth + 1)}, ref) - made = create(kind_of(ref["키"]), body) + body = {**got, "담은로직": _moved(got.get("담은로직"), move, depth + 1)} + made = create(kind_of(ref["키"]), origin_mark(_spec_moved(body, done), ref)) done[ref_id(ref)] = {"층": target[0], "주인": target[1], "키": made["이름"]} return done[ref_id(ref)] - return {**doc, "담은로직": _moved(doc.get("담은로직"), move, 1)} + return _spec_moved({**doc, "담은로직": _moved(doc.get("담은로직"), move, 1)}, done) + + +def _spec_moved(doc: dict[str, Any], done: dict[str, Ref]) -> dict[str, Any]: + """규격 열 수량(704-4 · 줄 id = `ref_id`) 열쇠도 새 참조로 — 안 바꾸면 그 줄 열 값이 버려짐.""" + spec = doc.get("규격") + qty = spec.get("수량") if isinstance(spec, dict) else None + if not isinstance(qty, dict) or not done: + return doc + moved = {old: ref_id(new) for old, new in done.items()} + return {**doc, "규격": {**spec, "수량": {moved.get(k, k): v for k, v in qty.items()}}} def _moved(lines: Any, move: Callable[[Ref, int], Ref], depth: int) -> list[Any]: diff --git a/resources/tester/test_m02_labor_ref.py b/resources/tester/test_m02_labor_ref.py index 412ea1a10..aa12c2a0e 100644 --- a/resources/tester/test_m02_labor_ref.py +++ b/resources/tester/test_m02_labor_ref.py @@ -326,6 +326,27 @@ def test_복사는_못_읽는_참조를_같이_복사_본뜬(world): assert e.value.status == 400 +def test_복사_새_키_규격_열_수량도_따라감(world): + """통합 점검 — 회사에 올리기 승인 · 회사로 복사: 개인 참조가 회사 새 키로 바뀌면 규격 열 수량 열쇠도.""" + inner = _combo(world["personal"], [{"로직": TEN}], "안") + old = f"참조|personal|7/42|{inner}" + spec = { + "이름": "H", + "열": ["1.5", "2.0"], + "기본": "1.5", + "수량": {old: {"1.5": 1, "2.0": 1.3}, "고정|돌|가|㎡": {"1.5": 2, "2.0": 2.6}}, + } + doc = {"담은로직": [{"참조": {**MINE, "키": inner}}], "규격": spec} + with store.at(world["company"]): + got = refs.carry(doc, ("personal", "7/42")) + new = f"참조|company|7|{got['담은로직'][0]['참조']['키']}" + assert got["규격"]["수량"] == { + new: {"1.5": 1, "2.0": 1.3}, + "고정|돌|가|㎡": {"1.5": 2, "2.0": 2.6}, + } + assert doc["규격"]["수량"][old] == {"1.5": 1, "2.0": 1.3} # 원본 그대로 + + def test_길_새로_복사_권한(world): from fastapi import FastAPI from fastapi.testclient import TestClient