"""451 B06 세션 캐시 판 · 숨은 종단 보기 관 id 장부(433-16 · 440-3). ① 새로고침 · 새 탭 = 세션 상세로 먼저 섬 · 뒤에서 서버 판을 물음 — 다른 탭이 저장해 다르면 서버 값 위에 이 탭에서 고친 사용자 칸만 · [저장] patch 바탕도 서버 값 · 세션 = 서버 정본 그대로 ② 같은 판 · 서버 실패 = 세션 그대로(갈아끼움 · 알림 없음) ③ 노선 초안이 옛 상세를 쥔 채 서버 판이 바뀜 — 초안을 버리면 새 판 ④ 숨은 종단 보기도 관 세션 id 장부를 돌림(평면 마커 누름 = 초안 자리 · 장부 = 시설 줄 한 벌 462) · 그리기는 보일 때 TS 셈은 `helper_451_session_canon.cjs`. ./venv/Scripts/python.exe -m pytest resources/tester/test_451_session_canon.py -q """ import json import subprocess from pathlib import Path import pytest ROOT = Path(__file__).resolve().parents[2] HELPER = Path(__file__).with_name("helper_451_session_canon.cjs") pytestmark = pytest.mark.skipif( not (ROOT / "config" / "node_modules" / "typescript").is_dir(), reason="프론트엔드 의존성 미설치", ) @pytest.fixture(scope="module") def got() -> dict: run = subprocess.run( # noqa: S603 — 고정 실행 파일 ["node", str(HELPER)], capture_output=True, text=True, encoding="utf-8", timeout=120, ) assert run.returncode == 0, run.stderr return json.loads(run.stdout) def test_첫_화면은_세션_뒤에서_판_확인(got) -> None: assert got["firstFromSession"] is True def test_판이_다르면_서버_값_위에_내_칸만(got) -> None: stale = got["stale"] assert stale["swapped"] is True and stale["heard"] == 1 assert stale["adjust"] == 2 and stale["elevation"] == 101 # 다른 탭이 저장한 값 assert stale["note"] == "mine" # 이 탭에서 고친 칸 assert stale["patchAdjust"] == 2 and stale["patchNote"] == "mine" # [저장] 바탕 assert stale["sessionAdjust"] == 2 and stale["sessionNote"] == "A" # 세션 = 서버 정본 def test_같은_판_실패는_그대로(got) -> None: assert got["same"] == {"kept": True, "heard": 0} assert got["broken"] is True def test_초안_hold_는_버리면_새_판(got) -> None: hold = got["hold"] assert hold["swappedDraft"] is True and hold["draftKept"] == [0, 25, 45, 60] assert hold["renewed"] is True and hold["adjust"] == 2 and hold["same"] is True def test_숨은_종단_보기도_관_id_장부() -> None: # 장부 맞춤 = 페이지 시설 줄 한 벌(462) — 관 알림 · 노선 따라감 모두 보기 숨김과 무관 shared = (ROOT / "A00_Common/design/design_shared.ts").read_text(encoding="utf-8") changed = shared[shared.index("onPipesChanged: (pipes) => {") :] assert "shared.lane.set({ pipes });" in changed[: changed.index("},")] assert "shared.lane.follow();" in shared lane = (ROOT / "A00_Common/design/design_facility_lane.ts").read_text(encoding="utf-8") assert "placePipeIds(" in lane and "prunePipeIds(" in lane