Files
Aislo/resources/tester/test_b06_pipe_form_keys.py
T
eomsangdonandClaude Opus 5.5 bf1fa50817 feat(M02): 48-1 구조물 정의 한 벌 — 정의 틀 문서 · 판 1 옮김 · 읽기 길
- 정의 틀 = docs/raw/M02_구조물옵션정의/정의_틀.md (담는 것 · 키 규칙 · 꼴 · 배치 · 그룹 형상 · 규칙 · 동작 · 판 이력)
- resources/master_template/구조물정의.json 판 1 = 옛 B05 레지스트리(37종 · 옵션 235) + 옵션표시 + 옵션그룹 키 그대로 옮김
- GET /api/m02/structure-definition(로그인) · PUT(시스템 관리자만 · 판 +1 · 이력 판_N) · 검사(꼴 · 키 겹침 · 규칙 대상)
- GET /structure-types · B05 구조물 검사가 새 정의를 읽음(응답 꼴 그대로) · 옵션 보이기 · 그룹 저장도 정의 칸으로
- 프로젝트 structures.json 에 저장 때 정의 판 · 정의에 없는 키 값은 남김(오류 없음)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYJJRCfHfdCGNhmXTjQKV7
2026-10-05 16:09:33 +09:00

64 lines
2.7 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_template" / "구조물정의.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} — 실을지 여부를 적을 것"