From e203cbf6dae686dcc6f7fb0b35e2851087198596 Mon Sep 17 00:00:00 2001 From: umsangdon Date: Wed, 18 Nov 2026 22:03:30 +0900 Subject: [PATCH] =?UTF-8?q?fix(859-1=20=E3=89=B0):=20M02=20=EC=B8=B5=20?= =?UTF-8?q?=EB=AA=A9=EB=A1=9D=20=EA=B8=B0=EC=A4=80=EA=B8=88=EC=95=A1=20?= =?UTF-8?q?=E2=80=94=20=EB=82=B4=20=EA=B8=B0=EA=B3=84=EB=A5=BC=20=EA=B3=A0?= =?UTF-8?q?=EC=B9=98=EA=B1=B0=EB=82=98=20=EC=A7=80=EC=9A=B4=20=EB=92=A4=20?= =?UTF-8?q?=EB=B0=94=EB=A1=9C=20=EC=83=88=20=EA=B0=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 까닭 = 목록 길이 지금 층을 안 정해(store.root() = 마스터) 셈이 그 층 내 기계를 못 찾고 SK 값 사본(저장 때 값)을 읽음 - 고침 = 요약 셈(_fresh)을 store.at(그 층) 안에서 — 내 기계 · 자동 따라옴 판정이 그 층 기준(열었을 때와 같음) - 색인 자국은 이미 그 층 곁 파일(내기계 · 개인자재) · M01 폴더(기초 문서 포함)를 담음 — 따로 안 고침 - test_826_1 — 내 기계 200 → 600 → 지움: SK · 담은 SC 목록 금액 200 → 600 → 600(고침 없이 = 200 으로 실패 확인) Co-Authored-By: Claude Opus 5.5 --- M02_MasterTemplete/M02_Layer_Index.py | 5 ++-- resources/tester/test_826_1_layer_index.py | 30 ++++++++++++++++++++++ 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/M02_MasterTemplete/M02_Layer_Index.py b/M02_MasterTemplete/M02_Layer_Index.py index 00a04b1e9..d15144e56 100644 --- a/M02_MasterTemplete/M02_Layer_Index.py +++ b/M02_MasterTemplete/M02_Layer_Index.py @@ -133,8 +133,9 @@ def _fresh(folder: Path, kind: str, name: str, rec: Any, stamp: str | None, whol deps.setdefault(str(p), file_stamp(p)) token = refs.SEEN.set(note) - try: # 셈마다 새 펼침 — 다른 항목 셈 기억을 나눠 쓰면 기댐이 빠짐 - out = refs.summary(folder, kind, name, Expand(whole), []) + try: # 셈마다 새 펼침 — 다른 항목 셈 기억을 나눠 쓰면 기댐이 빠짐 · 지금 층 = 그 층(내 기계 · 자동 따라옴) + with store.at(folder): + out = refs.summary(folder, kind, name, Expand(whole), []) finally: refs.SEEN.reset(token) out.pop("쓰는곳수", None) diff --git a/resources/tester/test_826_1_layer_index.py b/resources/tester/test_826_1_layer_index.py index 66e1f7267..67f9d6b55 100644 --- a/resources/tester/test_826_1_layer_index.py +++ b/resources/tester/test_826_1_layer_index.py @@ -169,6 +169,36 @@ def test_m01_change_recounts_amount(fresh, tmp_path, monkeypatch): assert two != one +def test_my_machine_change_recounts_amount(fresh): + """내 기계를 고치면 목록 기준금액(SK · 담은 SC)이 바로 새 값 · 지워도 그대로(요구 902) — + 목록 셈의 지금 층 = 그 층(서버 길은 층을 안 정함).""" + from M02_MasterTemplete import M02_MyMachine as mym + + mine = fresh["personal"] + with store.at(mine): + made = mym.create({"이름": "sub3임시", "규격": "1", "방식": "직접", + "시간당": {"노무비": 0, "재료비": 0, "경비": 200}}) # fmt: skip + key = made["줄"]["키"] + body = {"이름": "기", "단위": "시간", "바탕": {"로직": "GC001199"}, + "입력값": {"기계": made["줄"]["원문번호"]}, "더한줄": []} # fmt: skip + sk = refs.create("sangeun", body)["이름"] + layer, owner = refs.where(mine) + ref = {"참조": {"층": layer, "주인": owner, "키": sk}, "수량": {"손": 1}} + sc = refs.create("precombo", {"이름": "조", "단위": "시간", "담은로직": [ref]})["이름"] + + def amounts(): + rows = _new(mine) + return [next(r for r in rows if r["이름"] == k)["기준금액"] for k in (sk, sc)] + + assert amounts() == [200, 200] + with store.at(mine): + mym.update(key, {**made["줄"], "시간당": {"노무비": 0, "재료비": 0, "경비": 600}}) + assert amounts() == [600, 600] + with store.at(mine): + mym.delete(key) + assert amounts() == [600, 600] + + def test_broken_index_rebuilds(fresh): _up, _a, _b, _sc = _shelf(fresh) mine = fresh["personal"]