Files
Aislo/resources/tester/test_b06_pipe_form_keys.py
T
eomsangdonandClaude Opus 5.5 40126051dc refactor(859-5 ③④): 구조물 정의 자료 master_template → master_data/구조물정의
- 구조물정의.json → resources/master_data/구조물정의/구조물정의.json(git mv · 내용 그대로)
- 구조물정의_이력/판_1 ~ 22 → resources/master_data/구조물정의/이력/(git mv · 내용 그대로)
- 읽는 자리 = B05 Structures_Schema DEFINITION_PATH · HISTORY_DIRNAME · M01_SO_Definition HISTORY
- M01 요소 로더 · check_master 는 첫 층 *.json 만 읽음 — 새 폴더는 요소로 안 읽힘(수식문서/ 와 같은 대접)
- 시험 · 도우미 · ui_checks 경로 글 고침(파일 이름 그대로)
- resources/master_template 에 구조물 정의 자료 남지 않음

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 22:09:35 +09:00

66 lines
2.8 KiB
Python

"""배수관 폼 칸이 **화면 캐시까지 닿는지** 대조 (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 / "resources" / "master_data" / "구조물정의" / "구조물정의.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} — 실을지 여부를 적을 것"