Files
Aislo/resources/tester/test_314_stale_structure.py
T
eomsangdonandClaude Opus 5.5 c45814f910 feat(구조물표): 323-4 형상 얹기 한 벌(TS · 파이썬 짝) — 저장분 · 초안 · 미리 뜬 횡단 같은 길(저장 전 그림 = 저장 뒤 그림) · 빈칸 경고 한 꼴(카드 칩 「종류 칸 빈칸」) · 3D 지문 = 그림 자료 통째 · C군 벽 3D 한 번 · 소단 원천 = 표 형상 berm
- 짝 `common_util_structure_attach.ts` attachShapes ↔ `B06_Section_Engine_Attach.py` attach_shapes — 열쇠 걷고 관 세트 → 벽 → 포장 → 맹암거 → 빈칸 경고(측점 계획 자리 · 「옹벽 높이」 · 「배관 관경」 · 「맹암거 암거 높이」 · 「물넘이포장 월류 높이」)
- 서버 `_read_section_detail` · 재생성 응답 = attach_saved_shapes 하나 · 화면 `withDraftShapes`(현황 = 초안 ?? 저장분 · 초안 없어지면 저장분으로 한 번) — decorate 관 세트 · withDraftPipeKinds · 맹암거 · 포장 · 벽 블록 걷음 · 구조물 초안 없을 때 미리 뜬 횡단에 포장 · 벽 · 맹암거 빠지던 것 · 반폭 넓힘 뒤 날 상세(초안 빠짐) 고침
- 파이썬 얹기 = 목록 함수(culvert_sets_from · attach_culvert_specs · wall_specs_from · attach_wall_specs · underdrains_from · attach_underdrain_specs) + 옛 파일 함수는 감쌈
- 3D 지문 = SHAPE_KEYS(`common_util_structure_shape_keys.ts`) + 조작값 통째(손 해시 걷음 · 벽 기초 · 단 · 포장 · 맹암거 빠짐) · C군 벽 = 기준 측점과 가장 가까운 측점에서만 시작 ~ 끝 스윕(`wallSweepAt`)
- 소단 = 표 형상 berm(BERM_TYPE_ID 걷음 · 화면 isBermType · 서버 catalog_row)
- 시험: test_323_4_attach_mirror(42종 + 빈칸 · 서버 = 화면 · 옛 자리 걷힘 · 벽 한 번 · 지문) · 전수 표 ★ 둘(물넘이포장 걸친 격자 100 = 서버와 같음 · STAGE 4) · 옛 도움 파일 = 측점 → 형상 차례

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ji4nuyLVHcxrXWHTdb5nRD
2026-10-14 17:26:53 +09:00

83 lines
3.1 KiB
Python

"""PLAN 314 — 물넘이포장 · 맹암거 후속(요구 210 · 211).
- 314-1 · 314-2 · 314-4 저장 전에 놓거나 · 옮기거나 · 종류를 바꾼 구조물 자리 = 저장분 횡단 값(포장 · 기울기 ·
세월교 노면 하강)과 얹힌 제원이 다르면 낡음 → 다시 셈(서버 `_enforce_stored_designs` 짝) ·
물넘이포장 옛 자리 걷고 새 자리(걸친 기존 측점까지) 얹음
- 314-3 월류 높이 기다림 = 빈 글자도 빈칸(채우는 쪽과 같은 규칙)
실제 TS 를 `helper_314_stale_structure.cjs` 가 Node 로 돌린다.
"""
from __future__ import annotations
import json
import os
import subprocess
import pytest
HERE = os.path.dirname(__file__)
ROOT = os.path.join(HERE, "..", "..")
pytestmark = pytest.mark.skipif(
not os.path.isdir(os.path.join(ROOT, "config", "node_modules")),
reason="프론트엔드 의존성 미설치",
)
def _read(*parts: str) -> str:
with open(os.path.join(ROOT, *parts), encoding="utf-8") as handle:
return handle.read()
@pytest.fixture(scope="module")
def result() -> dict:
out = subprocess.run(
["node", os.path.join(HERE, "helper_314_stale_structure.cjs")],
capture_output=True,
text=True,
encoding="utf-8",
timeout=120,
check=True,
)
return json.loads(out.stdout)
def test_tilt_mismatch_is_stale(result: dict) -> None:
# 물넘이포장 · 맹암거 자리인데 저장분이 안 기울었음(측구 있음) = 낡음 · 맞으면 그대로
assert result["ford_untilted"] is True
assert result["ford_tilted"] is False
assert result["underdrain_tilted"] is False
# 구조물이 떠났는데 저장분이 아직 기울었음(옮김 · 종류 바꿈) = 낡음
assert result["left_tilted"] is True
def test_paved_and_surface_drop_mismatch_is_stale(result: dict) -> None:
assert result["pavement_unpaved"] is True
assert result["ford_drop_missing"] is True
assert result["ford_drop_kept"] is False
assert result["plain"] is False
def test_ford_height_wait_treats_blank_as_empty(result: dict) -> None:
waits = result["waits"]
assert waits["pave_empty"] is True
assert waits["pave_blank"] is True
assert waits["pave_set"] is False
assert waits["bridge_none"] is True
assert waits["pipe"] is False
def test_structure_change_reconciles_and_ford_reattach() -> None:
view = _read("A00_Common", "design", "design_view_cross.ts")
body = view.split("async function refreshDetailForStructures", 1)[1].split("\n }\n", 1)[0]
assert "void reconcileStaleDesigns();" in body
refresh = _read("B06_Section", "B06_Section_Cross_Refresh.ts")
assert "Number(section.ford?.overflow_depth_m) > 0" in refresh
# 물넘이포장 옛 자리 걷고 새 자리(걸친 측점까지) 얹기 = 형상 얹기 한 벌(323-4 · 모든 열쇠 걷고 다시 ·
# 동작 시험 = test_323_4_attach_mirror)
drafts = _read("B06_Section", "B06_Section_Section_Drafts.ts")
assert "attachShapes(" in drafts
keys = _read("common_util", "common_util_structure_shape_keys.ts")
assert '"ford_pavement",' in keys