Files
Aislo/resources/tester/helper_364_6_std_panel.mjs
T
eomsangdonandClaude Opus 5.5 be4383f81f fix(B06 표준 횡단): 364-6 칸 열기만으로 암 표준값이 토사 값으로 바뀌던 것 — 편집 없이 B05 = B06 누가토량
- 까닭: 표준 횡단 칸이 열릴 때 공통 칸을 토사 값으로 펼쳐 세션을 고침(암 측구 상폭 0.69 → 0.9 · 암 횡단경사 3 → 3~5) → B06 다시 셈이 암 측점 절토를 키움 · 성토 그대로
- 고침: 열기 · 저장값 복원 · 초기 값 · 다른 프로젝트 불러오기 = 그룹 값 그대로 · 공통 칸은 고칠 때만 펼침
- 검증_sub7 노선 304: 칸 열기 전후 절토 면적 합 402.9 → 444.4 ㎡(56/67 측점) → 고친 뒤 같음 · 서버 셈 = B05 셈
- 시험 test_364_6_std_panel_same_value.py 6(옛 코드 4 실패) · 관련 25 · typecheck

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TteK8mfYZetk5P3bEZkyVZ
2026-10-17 00:23:06 +09:00

70 lines
2.6 KiB
JavaScript

/* 364-6 헬퍼 — vite ssr 로 묶은 진짜 모듈(helper_364_6_entry.ts)로 표준 횡단 칸 열기 전후 다시 셈을 잼.
* node helper_364_6_std_panel.mjs <묶음.mjs> <고정 자료.json>
* 고정 자료 = 검증_sub7 노선 304(모두 리핑암)의 서버 상세 4 측점 + config 표준 횡단.
*/
import { readFileSync } from "node:fs";
import { pathToFileURL } from "node:url";
const store = () => {
const m = new Map();
return {
getItem: (k) => (m.has(k) ? m.get(k) : null),
setItem: (k, v) => m.set(k, String(v)),
removeItem: (k) => m.delete(k),
key: (i) => [...m.keys()][i] ?? null,
get length() {
return m.size;
},
clear: () => m.clear(),
};
};
globalThis.window = globalThis;
globalThis.sessionStorage = store();
globalThis.localStorage = store();
// 패널 DOM — 무엇을 불러도 받아 주는 빈 객체
const any = new Proxy(function () {}, {
get: (_t, k) => (k === Symbol.toPrimitive ? () => 0 : any),
apply: () => any,
construct: () => any,
});
globalThis.document = any;
globalThis.requestAnimationFrame = (run) => setTimeout(run, 0);
const [bundlePath, fixturePath] = process.argv.slice(2);
const m = await import(pathToFileURL(bundlePath).href);
const fixture = JSON.parse(readFileSync(fixturePath, "utf8"));
const raw = JSON.stringify(fixture.detail);
const standard = fixture.standard_cross_section;
const RID = fixture.route_id;
const KEYS = ["cut_area_m2", "fill_area_m2", "ditch_area_m2"];
const areas = (sections) =>
sections.map((s) => Object.fromEntries(KEYS.map((k) => [k, s.design?.[k] ?? null])));
const saved = fixture.detail.longitudinal.profile_alignment?.edits ?? {};
const edits = {
station_offsets: saved.station_offsets ?? {},
curve_radii: saved.curve_radii ?? {},
};
const recompute = async (pid) => {
const detail = JSON.parse(raw);
await m.refreshCrossDesigns({ projectId: pid, routeId: RID, detail, edits });
return areas(detail.cross_sections);
};
/** B05 = 칸 없음(config 기본값) → B06 = 칸 열림. seed = 저장 표준 횡단을 세션에 먼저 채운 경우. */
async function scenario(pid, seed) {
m.rememberStandardDefaults(pid, standard);
if (seed) m.writeState("std-cross", seed, pid);
const b05 = await recompute(pid);
m.createStandardPanel(pid, standard, () => {});
const b06 = await recompute(pid);
return { b05, b06, session: m.readState("std-cross", pid) };
}
const out = {
server: areas(fixture.detail.cross_sections),
standard,
config: await scenario("p364a", null),
stored: await scenario("p364b", standard),
};
process.stdout.write(JSON.stringify(out));