diff --git a/B06_Section/B06_Section_UI_Page_Pipe_Options.ts b/B06_Section/B06_Section_UI_Page_Pipe_Options.ts index a40eff9c..32312a4e 100644 --- a/B06_Section/B06_Section_UI_Page_Pipe_Options.ts +++ b/B06_Section/B06_Section_UI_Page_Pipe_Options.ts @@ -63,6 +63,10 @@ export function applyPipeOptionsToCache( if (value !== undefined) (target as Record)[field as string] = value; }; put(culvert, "pipe_kind", patch.pipe_kind); + // 기슭막이 기초(기초유/기초버림) — **터파기 파선을 그리는 값**이다(`foundationChoice`). + // 옮겨 적지 않아 폼에서 고쳐도 도면이 다음 조회까지 안 따라왔다(2026-09-09 실측). + // ⚠ 폼 키는 `revet_foundation`, 스펙 자리는 `foundation` 이라 이름이 다르다. + put(culvert, "foundation", patch.revet_foundation); const diameterMm = num("pipe_diameter_mm"); if (diameterMm !== undefined) culvert.diameter_m = pipeDiameterM(diameterMm); // 유입·유출 기슭막이 제원과 집수정 구간값 — 폼 옵션 키를 스펙 자리로 옮긴다. diff --git a/resources/tester/test_b06_pipe_form_keys.py b/resources/tester/test_b06_pipe_form_keys.py new file mode 100644 index 00000000..2314a312 --- /dev/null +++ b/resources/tester/test_b06_pipe_form_keys.py @@ -0,0 +1,63 @@ +"""배수관 폼 칸이 **화면 캐시까지 닿는지** 대조 (2026-09-09). + +⚠ 잡은 자리 — 「기슭막이 기초」(`revet_foundation`)를 폼에서 고쳐도 횡단도 **터파기 파선**이 + 안 따라왔다. 폼 → 캐시 경로(`B06_Section_UI_Page_Pipe_Options.ts`)가 스펙 칸을 **하나씩 + 옮겨 적는 부분 사본**이라, 새 칸을 더할 때 빠지면 값이 조용히 안 닿는다. + +⇒ 세트를 통째로 다시 만드는 배선(계획서 0-5)은 아직 못 한다. 대신 **그리기에 쓰이는 칸**이 + 빠지면 여기서 잡는다. 수량 전용 칸(집수정 형태·재료)은 정본으로 바로 가므로 대상이 아니다. +""" + +from __future__ import annotations + +import json +from pathlib import Path + +ROOT = Path(__file__).resolve().parents[2] + +#: 그리기가 읽는 칸 → 캐시 경로에서 확인할 문자열. +DRAWN_KEYS = { + "revet_foundation": '"foundation", patch.revet_foundation', + "pipe_kind": '"pipe_kind", patch.pipe_kind', + "pipe_diameter_mm": "pipe_diameter_mm", +} + +#: 수량 전용이라 캐시에 안 실어도 되는 칸 — **왜 빠졌는지**를 함께 적는다. +QUANTITY_ONLY = { + "inlet_basin_form": "B08 이 정본(pipe_points)에서 읽는다 — 도면에 안 그린다", + "inlet_basin_material": "위와 같음", + "pipe_count": "련 수는 B05 정본에서 세트를 만들 때 쓴다", +} + + +def _pipe_option_keys() -> list[str]: + payload = json.loads( + (ROOT / "B05_Profile" / "B05_Profile_Structure_Types.json").read_text(encoding="utf-8") + ) + types = payload if isinstance(payload, list) else payload["types"] + pipe = next(item for item in types if item["type_id"] == "pipe") + return [option["key"] for option in pipe["options"]] + + +def test_그리기에_쓰는_칸은_캐시까지_닿는다() -> None: + source = (ROOT / "B06_Section" / "B06_Section_UI_Page_Pipe_Options.ts").read_text( + encoding="utf-8" + ) + for key, needle in DRAWN_KEYS.items(): + assert needle in source, f"{key} 가 폼 → 캐시 경로에서 빠졌다 — 도면이 안 따라간다" + + +def test_폼에_새_칸이_생기면_알린다() -> None: + """칸을 더하고 이 시험을 안 고치면 여기서 걸린다 — 「조용히 안 닿는」 것을 막는 자리.""" + source = (ROOT / "B06_Section" / "B06_Section_UI_Page_Pipe_Options.ts").read_text( + encoding="utf-8" + ) + unknown = [ + key + for key in _pipe_option_keys() + if key not in DRAWN_KEYS + and key not in QUANTITY_ONLY + and key not in source + and not any(key.endswith(tail) for tail in ("_m", "_type", "_form")) + ] + assert not unknown, f"새 폼 칸이 캐시 경로에 안 실렸다: {unknown} — 실을지 여부를 적을 것"