지움
- flushDesignStore(design_store · 부름 0) — 시험 344-4 의 flush 대조 한 줄도
- b_page_state 옛 세션 열쇠 옮김(legacy · migrate) · b_project_switch 옛 키 머리
— 옛 열쇠는 세션 저장소(탭 닫으면 사라짐) · 지금 코드가 안 씀 · storage · DB 에 없음
· 시험 290-1 · 401 · 384-1 의 옛 키 줄 뺌
- 시험만 부르던 TS — planFootprint(346-2 거울은 footprintRecord + slopePieces 로 그대로)
· shiftSegment · shiftMovingPoints(쉬프트 단추는 09-02 지움 · min_cover_guard 쉬프트 시험 뺌)
· dropStationsNear(test_b05_station_merge.mjs 지움) · createIrregularStationsSection(부름 0)
· generalStations(234-1 은 기본 맞춤 값으로 같은 것 잼) · sameSummaryItem
- test_b05_b06_save_roundtrip + helper_b05_save_payload 둘 — 프로젝트 936be972 storage 없어 늘 skip
· 같은 저장 왕복은 test_472_6_design_save(창구 원자성) · test_449_save_pipes(관 PUT)
· test_238_1_save_keeps_structure_stations(구조물 측점)가 잼
남김
- migrateLegacyStations — 부르는 곳 있음(design_view_profile_sections) · storage 에 비정규 측점 남음
- common_util_excavation 셋 — 지금은 운영이 부름(design_calc_node)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
78 lines
2.9 KiB
Python
78 lines
2.9 KiB
Python
"""387-1(384 단계 1) 세션 열쇠 — 설계 화면은 세션을 등록부(`b_page_state`)로만 · 프로젝트 없는 열쇠 0.
|
|
|
|
· design · B05/B06 UI_* 파일 코드(주석 뺌)에 직접 sessionStorage 0
|
|
· 등록부 초안 · 결과 칸 옛 키는 모두 프로젝트를 품음 · `b05:pipes` 글 0
|
|
· `projectStateKeys` = 그 통 · 그 프로젝트 키만(노선 칸 포함 · 다른 프로젝트 · 다른 통 · 옛 키 밖)
|
|
|
|
./venv/Scripts/python.exe -m pytest resources/tester/test_384_1_session_keys.py -q
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
import re
|
|
import subprocess
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
LOADER = Path(__file__).resolve().parent / "helper_ts_cjs_load.cjs"
|
|
|
|
|
|
def _code(path: Path) -> str:
|
|
text = path.read_text(encoding="utf-8")
|
|
text = re.sub(r"/\*.*?\*/", "", text, flags=re.S)
|
|
return re.sub(r"(?m)^\s*//.*$|\s//\s.*$", "", text)
|
|
|
|
|
|
def _screen_files() -> list[Path]:
|
|
files = list((ROOT / "A00_Common" / "design").rglob("*.ts"))
|
|
files += (ROOT / "B05_Profile").glob("B05_Profile_UI_*.ts")
|
|
files += (ROOT / "B06_Section").glob("B06_Section_UI_*.ts")
|
|
return sorted(files)
|
|
|
|
|
|
def test_화면_파일에_직접_세션_0() -> None:
|
|
files = _screen_files()
|
|
assert len(files) > 100
|
|
hits = [str(p.relative_to(ROOT)) for p in files if "sessionStorage" in _code(p)]
|
|
assert hits == []
|
|
|
|
|
|
def test_프로젝트_없는_열쇠_0() -> None:
|
|
hits = [str(p.relative_to(ROOT)) for p in _screen_files() if '"b05:pipes"' in _code(p)]
|
|
assert hits == []
|
|
|
|
|
|
DRIVER = r"""
|
|
const data = new Map();
|
|
const fake = {
|
|
get length() { return data.size; },
|
|
key: (i) => [...data.keys()][i] ?? null,
|
|
getItem: (k) => (data.has(k) ? data.get(k) : null),
|
|
setItem: (k, v) => data.set(k, String(v)),
|
|
removeItem: (k) => data.delete(k),
|
|
};
|
|
globalThis.window = { sessionStorage: fake, localStorage: fake };
|
|
const { loadTs } = require(process.argv[1]);
|
|
const s = loadTs(process.argv[2]);
|
|
const legacy = Object.entries(s.STATE_REGISTRY)
|
|
.filter(([, e]) => e.bucket !== "pref" && e.legacy)
|
|
.map(([name, e]) => [name, e.legacy("PX", "RX")]);
|
|
for (const k of [
|
|
"aislo:draft:crossw:p1:7", "aislo:draft:pipes:p1", "aislo:draft:pipes:p10",
|
|
"aislo:draft:crossw:p2:7", "aislo:result:latest:p1", "b05:pipes", "b06:crossw:p1:7",
|
|
]) fake.setItem(k, "1");
|
|
process.stdout.write(JSON.stringify({ legacy, keys: s.projectStateKeys("draft", "p1").sort() }));
|
|
"""
|
|
|
|
|
|
def test_등록부_옛_키는_프로젝트_품음_사진_칸은_그_프로젝트만() -> None:
|
|
run = subprocess.run( # noqa: S603 — 고정 실행 파일
|
|
["node", "-e", DRIVER, str(LOADER), str(ROOT / "A00_Common" / "b_page_state.ts")],
|
|
capture_output=True, text=True, encoding="utf-8", cwd=str(ROOT),
|
|
) # fmt: skip
|
|
assert run.returncode == 0, run.stderr
|
|
out = json.loads(run.stdout)
|
|
assert out["legacy"] == [] # 옛 키 옮김 지움(472-8)
|
|
assert out["keys"] == ["aislo:draft:crossw:p1:7", "aislo:draft:pipes:p1"]
|