"""B05·B06 유토곡선 일원화 소스 검사 (2026-09-03 사용자 지시). 같은 데이터를 두 화면에 보여 주는 기능이므로 ① 보는 노선 ② 횡단 재계산 창구 ③ 낡음 판정 규칙이 한 벌이어야 한다. 실측으로 드러난 갈림: · 노선 — B05 route 126(DRAFT) / B06 route 125(CONFIRMED), 20m 성토 4.82㎡ ↔ 85.9㎡ · 재계산 — B06만 표준 단면값·암 경계 오프셋을 실어 보냄, 절토 합 228.52㎡ ↔ 270.12㎡ """ from pathlib import Path ROOT = Path(__file__).resolve().parents[2] def _read(relative: str) -> str: return (ROOT / relative).read_text(encoding="utf-8") REPO = _read("B06_Section/B06_Section_Repository.py") B06_ROUTER = _read("B06_Section/B06_Section_Router.py") REFRESH = _read("B06_Section/B06_Section_Cross_Refresh.ts") B05_PREVIEW = _read("B05_Profile/B05_Profile_UI_Profile_Preview.ts") # 설계 재계산 자리는 700줄 제한으로 `_UI_Page_Design_Sync` 로 떨어져 나갔다(2026-09-13). B06_PAGE = _read("B06_Section/B06_Section_UI_Page.ts") + _read( "B06_Section/B06_Section_UI_Page_Design_Sync.ts" ) def test_workflow_route_context_has_no_confirmed_filter(): """화면이 보는 경로는 최신 경로 — 확정 여부로 거르지 않는다.""" assert "async def get_workflow_route_context" in REPO assert "confirmed_only=False" in REPO # 확정본만 보는 창구(B07 납품도면)는 그대로 남아 있어야 한다. assert "async def get_confirmed_route_context" in REPO assert "confirmed_only=True" in REPO def test_b06_context_uses_workflow_route(): """B06 화면 context는 B05와 같은 최신 경로를 돌려준다.""" # 2026-09-06 부터 이 읽기는 `asyncio.gather` 로 묶여 커넥션 인자가 사라졌다 # (`run_with_connection` 이 자기 커넥션을 넘긴다). 확인할 것은 **어느 창구를 쓰는가**다. assert "get_workflow_route_context" in B06_ROUTER assert "get_confirmed_route_context" not in B06_ROUTER def test_cross_refresh_is_single_entry(): """횡단 재계산은 한 창구뿐 — 두 화면이 같은 인자를 실어 보낸다.""" assert "export async function refreshCrossDesigns" in REFRESH assert "readStandardCrossSession(projectId)" in REFRESH assert "readRockBoundarySession(projectId, routeId)" in REFRESH for source in (B05_PREVIEW, B06_PAGE): assert "refreshCrossDesigns(" in source assert "previewCrossDesigns(" not in source def test_cross_refresh_preserves_user_fields(): """서버 설계로 갈아 끼워도 화면 조작으로만 생기는 값은 살아남는다.""" for field in ( "inlet_structure", "basin_adjust", "revet_adjust", "extra_wall_counts", "extra_spans", "revet_link_detached", "revet_follow_grade", ): assert f'"{field}"' in REFRESH # preserveUserFields 의 보존 필드 목록