# -*- coding: utf-8 -*- """저장 전 관 옵션 초안 되얹기 회귀검증 — PLAN 24-7a (2026-09-29). 새로고침하면 횡단 캐시 상세는 저장분이라, 저장 전에 고친 월류 폭 · 관경이 폼 · 카드에서 저장값(월류 폭 10 · 관경 1000)으로 돌아가 있었다. 초안(관 목록 세션 초안)이 정본이므로 횡단 보기가 서며 초안 관 옵션을 캐시에 다시 얹는다. • 되얹기 — 세월교 월류 폭 3.5 · 배수관 관경 1200 이 캐시 스펙에 실림 · 조정창 정본(기슭막이 높이 · 형태)은 안 건드림 (323-6 — 옛 `replayDraftPipeOptions` 걷음 · 형상 얹기 한 벌이 초안 현황으로 다시 셈) • 횡단 보기가 먼저 선 뒤 종단 보기가 서도 종단 보기가 배수유역도의 관 목록을 먼저 쥠(빈 목록으로 시작해 관을 지우지 않음) 화면 그릇 없이 Node 헬퍼가 TS 를 트랜스파일해 돌린다(`helper_b06_draft_pipe_replay.cjs`). """ import json import os import subprocess HERE = os.path.dirname(os.path.abspath(__file__)) ROOT = os.path.abspath(os.path.join(HERE, "..", "..")) def _read(*parts: str) -> str: with open(os.path.join(ROOT, *parts), encoding="utf-8") as handle: return handle.read() def test_draft_pipe_options_are_replayed_onto_the_cache(): proc = subprocess.run( ["node", os.path.join(HERE, "helper_b06_draft_pipe_replay.cjs")], capture_output=True, text=True, timeout=60, ) assert proc.returncode == 0, proc.stderr out = json.loads(proc.stdout) assert out["fordSpan"] == 3.5 # 월류 폭 초안이 캐시 스펙에 실림(저장분 10 아님) assert out["culvertDiameter"] == 1.2 # 배수관 관경 초안 1200 assert out["fordAt"] == [173.09] # 세월교는 제 측점에만 assert out["revetTouched"] is False # 기슭막이 높이 · 형태는 조정창이 정본 # 배선 — 옛 되얹기는 걷음(323-6) · 초안 현황으로 상세를 읽을 때마다 형상 얹기(`withDraftShapes`) · # 종단 보기는 마지막 관 목록을 먼저 싣는다. cross = _read("A00_Common", "design", "design_view_cross.ts") assert "replayDraftPipeOptions" not in cross store = _read("B06_Section", "B06_Section_Section_Store.ts") assert "await withDraftShapes(detail, projectId);" in store shared = _read("A00_Common", "design", "design_shared.ts") assert "shared.lastPipes = pipes" in shared profile = _read("A00_Common", "design", "design_view_profile.ts") assert profile.index("if (lastPipes) applyPipes(lastPipes)") < profile.index( "await bridge.load();\n advanceLoading" )