- 원인: cross 단계가 바뀐 범위(노선 = 앞 초안 대비 처음 바뀐 접선점부터) 밖 측점을 앞 결과 그대로 씀 · 첫 계획선은 저장 노선 대비 바뀐 구간 전체를 지반에 맞추므로 범위 앞 측점 계획고도 움직임 → 낡은 측점이 남고 초안 동안은 낡음 하나만 있어도 「다시 계산 중」 - logic/B06_Section_Cross_Stage: 범위 밖 재사용 = 같은 자리 · 같은 계획고(0.1 mm)일 때만 · 그 밖은 지문 기억이 맡음 - Profile_Preview scheduleIfStale(key, draft): 노선 초안 동안은 묶음 그 차례 cross(건너뛰면 뒤 단계)까지만 기다림 · 끝나면 남은 낡음 = 곡선 + 그 측점(342-1) · cross 가 끝내 안 와도 3 s 뒤 풀고 다시 그림 - design_profile 1줄(초안 여부를 넘김 · 700 그대로) - 시험 test_349_0f_draft_stale 8(가짜 · 검증_sub7 지형 — 2번째 꺾임점 서쪽 20 m + 25+0 부근 꺾임점 북동 10 m 뒤 낡음 0 · 고치기 전 코드는 검증_sub7 에서 140 m~ 낡음) · test_317 본문 검사 새 꼴 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QfHKQs7J3hQELKMWQMUJEy
70 lines
2.6 KiB
Python
70 lines
2.6 KiB
Python
"""PLAN 317-1 — B05 [3D 업데이트]가 낡은 횡단을 먼저 다시 셈(요구 213).
|
|
|
|
- 낡음 지문(`staleKey`) — 낡은 측점이 있으면 지문 · 모두 맞으면 ""
|
|
- 그릴 때 잰 지문이 새것일 때만 다시 셈 예약(같은 낡음 되풀이 · 서버 폴백 반복 막음)
|
|
- 그래프가 그릴 때 지문을 패널에 넘김 · 단추는 예상형상을 짓기 전에 낡은 설계부터 다시 셈
|
|
|
|
실제 TS 를 `helper_317_stale_preview.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_317_stale_preview.cjs")],
|
|
capture_output=True,
|
|
text=True,
|
|
encoding="utf-8",
|
|
timeout=120,
|
|
check=True,
|
|
)
|
|
return json.loads(out.stdout)
|
|
|
|
|
|
def test_stale_key_marks_only_stale_sections(result: dict) -> None:
|
|
assert result["key_stale"].startswith("50:")
|
|
assert result["key_fresh"] == ""
|
|
|
|
|
|
def test_same_stale_key_schedules_once(result: dict) -> None:
|
|
# a → 부름 · a(같음) → 안 부름 · "" → 안 부름(되돌림) · a(다시 낡음) → 부름 · b → 부름
|
|
assert result["calls"] == [1, 1, 1, 2, 3]
|
|
|
|
|
|
def test_draw_and_button_wiring() -> None:
|
|
panel = _read("A00_Common", "design", "design_profile.ts")
|
|
# 노선 초안 동안(346-2 붙임)은 계산 묶음 cross 를 기다림 — 그 밖은 같은 낡음 한 번만 다시 셈
|
|
assert (
|
|
"crossPreview.scheduleIfStale(key, store === preview)" in panel
|
|
and "onStaleDesigns: (key) =>" in panel
|
|
)
|
|
render = _read("B05_Profile", "B05_Profile_UI_Profile_Render.ts")
|
|
# 다시 셈 뒤에도 남은 낡음은 기다림 끝 — 곡선은 그리고 그 측점만 표시(342-1)
|
|
assert 'const pending = ctx.onStaleDesigns?.(stale) ?? stale !== "";' in render
|
|
assert "pendingRecalc: pending," in render
|
|
corridor = _read("B05_Profile", "B05_Profile_UI_Corridor.ts")
|
|
body = corridor.split("export async function refreshCorridor", 1)[1].split("\n}\n", 1)[0]
|
|
assert "await refreshStaleDesigns({ projectId, routeId, detail })" in body
|
|
assert body.index("refreshStaleDesigns") < body.index("ensureCorridor")
|