refactor(472-5 5-B 값 주인 하나): 횡단 상세 객체 = 상세 가게 하나 — 계산 묶음 페이지는 지문(노선 · 표본)만

- 상세 가게 칸 셋(B06_Section_Section_Canon.ts · 가벼운 자리): 저장 정본 상세(받을 때 · 세션 · 판 바뀜 · 되돌릴 때 · 갈아끼움 제외) · 초안 전 hold 상세(판 바뀌면 새 판) · 노선 초안 상세(= pipelineDetail)
- 페이지: canon.detail · held.detail · shown 사본 걷음 — 저장 기준 셈(savedEdits · storedPvi · crossNow)은 가게 칸을 읽음 · 초안 버림 = 가게 hold 상세로 정본 잡음
- 떠남(forgetSectionMemory) · invalidate 때 칸 셋 비움 · savedStations 는 sub2 관 · 구조물 줄로 셈 → 남김
- 시험: test_472_5b_detail_owner(옛 코드 빨강 3) · 묶음 헬퍼 넷(365 · 346_2 · 349_0j · 451_drop)이 종단도 흉내 정본을 가게 칸에도 채움
- 위키 design_page 값 · 규칙 · 층 줄

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-19 10:07:30 +09:00
co-authored by Claude Opus 5.5
parent 3b5022a9c0
commit 77be773c07
14 changed files with 227 additions and 38 deletions
+14 -11
View File
@@ -69,6 +69,11 @@ import { fetchStructureTypes } from "../../B05_Profile/B05_Profile_Api_Structure
import { forgetPageData, pagePipes, pageStructures, trackPageBusy } from "./design_page_data";
import type { PagePipelineOptions, ProfileLink } from "./design_pipeline_page_types";
import { createPageSaved } from "./design_pipeline_page_saved";
import {
draftDetailOf,
heldSectionDetail,
setDraftSectionDetail,
} from "../../B06_Section/B06_Section_Section_Canon";
import { feedFacilities } from "./design_pipeline_facilities";
export type { PagePipelineOptions, ProfileLink } from "./design_pipeline_page_types";
import {
@@ -195,7 +200,6 @@ function createPagePipeline(
/** 저장 기준(정본 지문 · 종단도 저장 기준 · 계획고 · PVI · 횡단 입력) — `design_pipeline_page_saved`. */
const pageSaved = createPageSaved(projectId, link, options, () => savedStations);
const { savedSource, canonChanged, savedEdits, storedPvi, crossNow, drafted } = pageSaved;
let shown: SectionDetailResponse | null = null;
let ready = false;
let started = false;
/** 앞 종단이 노선 초안으로 셈한 것인가 — 초안을 버리면 저장 기준으로 다시 그림. */
@@ -205,12 +209,9 @@ function createPagePipeline(
let openGeneration = -1;
/** 측점 · 종단을 가게에 안 내는 차례 — 열 때 · 노선 초안을 버린 차례(상세 = 초안 전 상세로 되돌림). */
let quietGeneration = -1;
/** 노선 초안 전 상세(종단도가 그리던 객체 그대로 — 횡단 초안 측점 장부가 이 객체에 묶임 · 갈아끼움은 설계를
* 사본으로 써 안 고침) · 되돌리는 함수 — 초안을 버리면 이것으로(다시 셈 없음 · 349-0k · 349-0o · 349-0q). */
let held: {
detail: SectionDetailResponse | null;
restore: ((stations: PipelineStation[]) => Promise<string>) | null;
} | null = null;
/** 노선 초안을 버릴 때 되돌리는 함수 — 초안 전 상세는 상세 가게 칸(`heldSectionDetail` · 종단도가 그리던 객체
* 그대로 · 판이 바뀌면 새 판 · 472-5)(다시 셈 없음 · 349-0k · 349-0o · 349-0q). */
let held: { restore: ((stations: PipelineStation[]) => Promise<string>) | null } | null = null;
/** 초안을 버린 차례가 끝나 되돌림까지 마치는 약속(종단도는 그 뒤 저장 기준으로 — 349-0l). */
let dropping: Promise<string> | null = null;
/** 초안을 버린 차례가 되돌림까지 못 감(뒤 차례에 밀림) — 뒤 차례도 조용히 · 그 끝에서 되돌림(B06 cross · 451). */
@@ -358,7 +359,7 @@ function createPagePipeline(
: null;
if (restore) {
held = null;
const detail = hold?.detail;
const detail = hold ? heldSectionDetail(projectId, routeId as number) : null;
if (detail) {
pageSaved.adoptCanon(routeId, detail);
const diff = stationDiff(detail, stations);
@@ -378,7 +379,7 @@ function createPagePipeline(
const { detail = null, routeId } = savedSource();
if (typeof routeId !== "number") return null;
const restore = options.holdDraft?.(routeId, detail, (f) => (beforeDraft ??= f)); // 440-4
return { detail, restore: restore ?? null };
return { restore: restore ?? null };
};
// 사용자 노선 조작 뒤 follow 가 다시 매긴 관 · 구조물 = 가게(목록 · 알약 · 횡단 보기가 바로 새 측점) ·
// 초안을 버리면 초안 전 값 · 열 때(start 차례)는 안 씀 — 알림 밖(틱 뒤)에서 씀(쓰기 고리 막음과 안 부딪힘)
@@ -418,7 +419,7 @@ function createPagePipeline(
const saved = savedSource().detail ?? null;
const ground = pipe.output("ground");
const profile = pipe.output("profile") as ProfileAlignment | null;
shown =
const shown =
draft && saved && ground && profile
? draftSectionDetail(
saved,
@@ -432,6 +433,7 @@ function createPagePipeline(
: null;
if (shown) drafted.add(shown);
if (shown) options.structureAreas?.(shown); // 관 · 구조물이 선 측점 = 폐회로 면적(349-0j)
setDraftSectionDetail(projectId, shown); // 노선 초안 상세 = 상세 가게 칸(472-5)
if (event.stage === "cross") return void (draft && link.redraw?.());
const base = pipe.output("planline");
const edits = (pipe.input("alignment") as AlignmentEdits | null) ?? emptyEdits();
@@ -636,9 +638,10 @@ function createPagePipeline(
},
reconcile,
ownsCross: Boolean(options.savedCross),
detail: () => shown,
detail: () => draftDetailOf(projectId),
dispose() {
disposed = true;
setDraftSectionDetail(projectId, null);
facilities.stop();
pipe.dispose();
},
@@ -5,6 +5,7 @@
* ========================================================================== */
import type { SectionDetailResponse } from "../../B06_Section/B06_Section_Api_Fetch";
import { savedSectionDetail } from "../../B06_Section/B06_Section_Section_Canon";
import {
emptyEdits,
toAlignmentBase,
@@ -23,10 +24,12 @@ export function createPageSaved(
/** 저장 노선 측점(열쇠) — 페이지가 저장분을 받을 때 셈. */
savedStations: () => PipelineStation[],
) {
/** 저장 정본(서버가 준 상세 · 노선 번호) — 측점 갈아끼움(swap)이 만든 새 상세는 지반 표본 배열을
* 그대로 둠 → 정본 아님(묶음 출력 → 상세 → 다시 묶음 고리를 끊음). */
let canon: { routeId: unknown; samples: unknown; detail: SectionDetailResponse | null } | null =
null;
/** 저장 정본 지문(노선 번호 · 지반 표본 배열) — 측점 갈아끼움(swap)이 만든 새 상세는 지반 표본 배열을
* 그대로 둠 → 정본 아님(묶음 출력 → 상세 → 다시 묶음 고리를 끊음). 상세 객체는 상세 가게 칸(472-5). */
let canon: { routeId: unknown; samples: unknown } | null = null;
/** 저장 정본 상세 = 상세 가게 칸(가게가 받거나 되돌린 객체 · 갈아끼움 제외). */
const canonDetail = (): SectionDetailResponse | null =>
typeof canon?.routeId === "number" ? savedSectionDetail(projectId, canon.routeId) : null;
/** 마지막으로 모은 횡단 입력(시설 제원 — 새 노선 상세가 씀). */
let crossSource: PipelineCrossSource | null = null;
/** 이 묶음이 지은 새 노선 상세들 — 횡단 보기 카드가 그것을 종단도에 그려도 저장 정본이 아님. */
@@ -44,13 +47,13 @@ export function createPageSaved(
const { detail = null, routeId } = savedSource();
const samples = detail?.longitudinal.samples;
if (canon && canon.routeId === routeId && canon.samples === samples) return false;
canon = { routeId, samples, detail };
canon = { routeId, samples };
return true;
};
/** 저장 노선 계획고 편집(세션 초안 → 저장분) — 노선 초안을 버리면 이것으로 돌아옴. */
const savedEdits = (): AlignmentEdits => {
const routeId = canon?.routeId;
const longitudinal = canon?.detail?.longitudinal;
const longitudinal = canonDetail()?.longitudinal;
return (
(typeof routeId === "number" ? readAlignmentDraft(routeId) : null) ??
(longitudinal && readAlignment(longitudinal)?.edits) ??
@@ -58,7 +61,8 @@ export function createPageSaved(
);
};
const storedPvi = () => {
const stored = canon?.detail && readAlignment(canon.detail.longitudinal);
const detail = canonDetail();
const stored = detail && readAlignment(detail.longitudinal);
return stored ? toAlignmentBase(stored).basePvi : null;
};
/** 횡단 입력 — 부를 때마다 저장 상세 + 세션 고침 · 표준을 모음(상세 객체마다 기억하면 고침이 안 감 · 365-2). */
@@ -66,7 +70,7 @@ export function createPageSaved(
const routeId = canon?.routeId;
const source = pipelineCrossSource(
projectId,
canon?.detail ?? null,
canonDetail(),
savedStations(),
typeof routeId === "number" ? routeId : null,
options.stationKeys, // 초안 자리 측점 짝(457)
@@ -85,7 +89,7 @@ export function createPageSaved(
canonRouteId: (): unknown => canon?.routeId,
/** 초안을 버려 되돌린 상세 = 저장 정본(다시 하기도 같은 기준). */
adoptCanon(routeId: unknown, detail: SectionDetailResponse): void {
canon = { routeId, samples: detail.longitudinal.samples, detail };
canon = { routeId, samples: detail.longitudinal.samples };
},
/** 마지막 횡단 입력의 시설 제원(새 노선 상세가 씀). */
crossSpecs: () => crossSource?.specs ?? new Map(),
+52
View File
@@ -89,3 +89,55 @@ export function forgetCanon(projectId: string, routeId?: number): void {
)
map.delete(key);
}
/* ── 상세 가게 칸 셋(472-5 5-B) — 상세 객체의 주인은 상세 가게 하나 · 계산 묶음 페이지는 지문(노선 · 표본)만 쥠 ──
* 저장 정본 상세 = 가게가 받거나(새로 받음 · 세션) 되돌린 객체(측점 갈아끼움 제외 — 그것은 정본 아님)
* 초안 전 상세 = 노선 초안을 시작할 때 떠 둔 객체(버리면 이것으로 · 판이 바뀌면 새 판)
* 노선 초안 상세 = 계산 묶음이 새 노선으로 지은 객체(초안 동안 두 보기가 그림) */
const savedDetails = new Map<string, SectionDetailResponse>();
const heldDetails = new Map<string, SectionDetailResponse>();
const draftDetails = new Map<string, SectionDetailResponse>();
const put = (
map: Map<string, SectionDetailResponse>,
key: string,
detail: SectionDetailResponse | null,
) => void (detail ? map.set(key, detail) : map.delete(key));
export const keepSavedDetail = (
projectId: string,
routeId: number,
detail: SectionDetailResponse | null,
): void => put(savedDetails, keyOf(projectId, routeId), detail);
export const savedSectionDetail = (
projectId: string,
routeId: number,
): SectionDetailResponse | null => savedDetails.get(keyOf(projectId, routeId)) ?? null;
export const keepHeldDetail = (
projectId: string,
routeId: number,
detail: SectionDetailResponse | null,
): void => put(heldDetails, keyOf(projectId, routeId), detail);
export const heldSectionDetail = (
projectId: string,
routeId: number,
): SectionDetailResponse | null => heldDetails.get(keyOf(projectId, routeId)) ?? null;
export const setDraftSectionDetail = (
projectId: string,
detail: SectionDetailResponse | null,
): void => put(draftDetails, projectId, detail);
export const draftDetailOf = (projectId: string): SectionDetailResponse | null =>
draftDetails.get(projectId) ?? null;
/** 메모리 상세를 버림(페이지 떠남 · 정본 바뀜) — 칸 셋. 노선을 안 주면 그 프로젝트 전부. */
export function forgetDetailSlots(projectId: string, routeId?: number): void {
for (const map of [savedDetails, heldDetails])
for (const key of [...map.keys()])
if (
routeId === undefined ? key.startsWith(`${projectId}:`) : key === keyOf(projectId, routeId)
)
map.delete(key);
if (routeId === undefined) draftDetails.delete(projectId);
}
+21 -1
View File
@@ -35,7 +35,16 @@ import type {
SectionDetailResponse,
StandardCrossSection,
} from "./B06_Section_Api_Fetch";
import { forgetCanon, keepCanon, savedDesigns, sessionDetail } from "./B06_Section_Section_Canon";
import {
forgetCanon,
forgetDetailSlots,
heldSectionDetail,
keepCanon,
keepHeldDetail,
keepSavedDetail,
savedDesigns,
sessionDetail,
} from "./B06_Section_Section_Canon";
import { fetchSectionDetail, saveSections } from "./B06_Section_Api_Fetch";
import { staleKeyAgainstScreen, USER_TOUCHED_KEYS } from "./B06_Section_Cross_Refresh";
import { kindChangedChainages, STRUCTURE_ADJUST_KEYS } from "./B06_Section_Api_Culvert_Options";
@@ -129,6 +138,7 @@ export async function loadSectionDetail(
const stored = sessionDetail(projectId, routeId); // 세션 글 = 한 번만 풂(387-7)
if (stored) {
cache.set(key, stored);
keepSavedDetail(projectId, routeId, stored); // 저장 정본 상세 칸(472-5)
void checkSessionCanon(projectId, routeId, stored).catch(() => undefined);
return withDraftWalls(stored, projectId, routeId);
}
@@ -136,6 +146,7 @@ export async function loadSectionDetail(
const request = fetchSectionDetail(projectId, routeId)
.then(async (detail) => {
cache.set(key, detail);
keepSavedDetail(projectId, routeId, detail);
writeState("section-detail", detail, projectId, routeId);
keepCanon(projectId, routeId, detail);
const ready = await withDraftWalls(detail, projectId, routeId);
@@ -176,8 +187,10 @@ async function checkSessionCanon(
if (edit && section.design) section.design = { ...section.design, ...edit.cells };
}
renewed.set(stored, fresh);
if (heldSectionDetail(projectId, routeId) === stored) keepHeldDetail(projectId, routeId, fresh);
if (current !== stored) return; // 노선 초안 갈아끼움 중 · 그 사이 새로 받음 — 초안을 버리면 새 판
cache.set(key, fresh);
keepSavedDetail(projectId, routeId, fresh);
await withDraftWalls(fresh, projectId, routeId);
if (cache.get(key) !== fresh) return;
emitSwap(fresh, new Map());
@@ -332,6 +345,7 @@ export function holdSectionDetail(
const kept = readState<HeldDraft>("route-draft-hold", projectId);
if (kept?.routeId === routeId && readState("route-draft", projectId)) {
const { keys, cells, facilities } = kept;
keepHeldDetail(projectId, routeId, detail); // 초안 둔 채 새로고침 — 지금 상세가 초안 전 상세
return { detail, keys, cells, facilities };
}
const sections = detail.cross_sections;
@@ -346,6 +360,7 @@ export function holdSectionDetail(
},
};
writeState("route-draft-hold", held, projectId);
keepHeldDetail(projectId, routeId, detail); // 초안 전 상세 칸(472-5)
return { detail, keys: held.keys, cells: held.cells, facilities: held.facilities };
}
@@ -381,6 +396,8 @@ export async function restoreSectionDetail(
for (const [name, value] of hold.cells) writeState(name, value ?? null, projectId, routeId);
clearState("route-draft-hold", projectId);
cache.set(key, saved); // 세션 상세는 정본 그대로(387-7)
keepHeldDetail(projectId, routeId, null);
keepSavedDetail(projectId, routeId, saved); // 되돌린 상세 = 저장 정본(472-5)
// 초안 둔 채 새로고침 = 초안 전 상세에 초안 자리 관이 얹혀 있었음 — 되쓴 관 · 구조물로 다시 얹음(440-4)
await withDraftStations(saved, projectId, routeId);
useStationKeyList(projectId, routeId, hold.keys);
@@ -405,6 +422,7 @@ export function invalidateSectionDetail(projectId: string, routeId?: number): vo
if (routeId !== undefined) {
cache.delete(keyOf(projectId, routeId));
forgetCanon(projectId, routeId);
forgetDetailSlots(projectId, routeId);
clearState("section-detail", projectId, routeId);
return;
}
@@ -413,6 +431,7 @@ export function invalidateSectionDetail(projectId: string, routeId?: number): vo
if (!key.startsWith(prefix)) continue;
cache.delete(key);
forgetCanon(projectId, Number(key.slice(prefix.length)));
forgetDetailSlots(projectId, Number(key.slice(prefix.length)));
clearState("section-detail", projectId, Number(key.slice(prefix.length)));
}
}
@@ -425,6 +444,7 @@ export function forgetSectionMemory(projectId: string): void {
const prefix = `${projectId}:`;
for (const map of [cache, pending])
for (const key of [...map.keys()]) if (key.startsWith(prefix)) map.delete(key);
forgetDetailSlots(projectId); // 상세 가게 칸 셋도(다시 열면 세션 정본으로 다시 섬)
}
/** 받아 둔 그 노선 상세(받지 않고 · 없으면 null) — 노선 = 페이지 노선 id(B05 평면 횡단 판 · 관 길이 · 416). */
+3 -3
View File
@@ -49,10 +49,10 @@ source: ["docs/raw/조사/2026-10-19_470_B05B06_데이터흐름.md", "docs/raw/
|---|---|---|
| ① 화면 메모리 | `B05_Profile_UI_RouteEdit.ts:124-145` · `B05_Profile_UI_Drainage_Panel.ts:123 · 142` · `B05_Profile_UI_Page_Structures.ts:78` · `B06_Section_UI_Page_Structures_Panel.ts:175-176` · `B06_Section_UI_Page_Link_Session.ts:47` · `design_facility_lane.ts:95-105` | 조작 즉시 · 페이지 dispose 로 버림 |
| ② 상세 가게 | `B06_Section_Section_Store.ts:68` cache · `:69` pending · `:117` loadSectionDetail · `:431` peekSectionDetail | 상세 횡단(살아 있는 객체) · 떠남 `forgetSectionMemory`(`:424`) · 정본 바뀜 `invalidateSectionDetail`(`:403`) |
| ② 정본 사본 | `B06_Section_Section_Canon.ts:36` keepCanon · `:59` sessionDetail · `:72` savedDesigns · `:84` forgetCanon | 서버 정본 설계 · 자리 · 표본 · invalidate 때 비움 |
| ② 정본 사본 · 상세 칸 | `B06_Section_Section_Canon.ts:36` keepCanon · `:59` sessionDetail · `:72` savedDesigns · `:84` forgetCanon · `:107-143` 칸 셋(저장 정본 · 초안 전 hold · 노선 초안 · 472-5) | 서버 정본 설계 · 자리 · 표본 · invalidate 때 비움 · 칸 셋 = 떠남 · invalidate 때 비움 |
| ③ 설계 가게 | `design_store.ts:226` useDesignStore · `:151` 메모리 칸 · `:160` 1 s | 읽고 쓰는 창구 · 쓰면 듣는 쪽 부름 |
| ④ 세션 | `A00_Common/b_page_state.ts` 등록부 | draft = 사용자 값 · result = 계산 · 서버 사본 · [[design_page/session_keys]] |
| ⑤ 계산 묶음 | `logic/design_pipeline.ts:33` 단계 · `:44` 뒤 단계 · `:49` STAGE_DEPS · `design_pipeline_page.ts:177` dispose | 차례 번호 · 옛 차례 버림 · 입력 대 묶음 맞춤 최대 3 바퀴(`:116`) |
| ⑤ 계산 묶음 | `logic/design_pipeline.ts:33` 단계 · `:44` 뒤 단계 · `:49` STAGE_DEPS · `design_pipeline_page.ts:177-182` dispose | 차례 번호 · 옛 차례 버림 · 입력 대 묶음 맞춤 최대 3 바퀴(`:116`) |
| ⑤ 묶음 → 가게 | `design_pipeline_page_publish.ts` publishPagePipeline · shown · opened · recheck | 측점 · 종단 · 발자국 냄 · 조용한 차례 = 상세 측점 |
| ⑥ 서버 파생 | `_derived/haul/*` · `B05_Profile/route_recommend/*` · `04_detail_cache.pkl` | 입력 지문 다를 때만 다시 셈 · 지워도 다시 셈 |
| ⑦ 서버 작업본 | DB `routes` · `route_points` · `route_statistics` · `longitudinal_sections` · `cross_sections` · 파일 `pipe_points.json` · `structures.json` · `plus_stations.json` · 노선 파일 · 곡선표 · 종단 파일(`mass_haul`) · 3D corridor | [저장] · [확정] · [초기화]만 씀(예외 = [[design_page/rules]]) |
@@ -71,4 +71,4 @@ source: ["docs/raw/조사/2026-10-19_470_B05B06_데이터흐름.md", "docs/raw/
| cross | profile · ground · cross · pipes · structures | `logic/B06_Section_Cross_Stage.ts` · 저장 노선 = `B06_Section_Cross_Refresh.ts` | 횡단 설계선 · 면적 |
| footprint | cross · ground | `logic/B05_Profile_Footprint_Stage.ts` | 평면 발자국 |
| drainage(뒤) | route · pipes | 배수판 `pipelineStage` → 서버 | 배수유역 |
| corridor(뒤) | profile · cross | `design_pipeline_page.ts:382-385` | 3D 낡음 표시 |
| corridor(뒤) | profile · cross | `design_pipeline_page.ts:334-337` | 3D 낡음 표시 |
@@ -38,4 +38,4 @@ source: ["docs/raw/조사/2026-10-19_470_B05B06_데이터흐름.md", "docs/raw/
| cross | `ctx.cross(confirm)` = 횡단 패치 한 요청 | `/sections/{노선}/save` · `confirm` · 재계산 맨 앞 종단 경고 다시 씀(`B06_Section_Server_Calc_Prebuild.py` refresh_alignment) | `carryAfterRouteSave`(새 측점으로 옮김) | `design_save.ts:275-283` |
- 차례마다 따로 커밋 — 실패 = 그 차례에서 멈춤 · 이름째 알림 · 앞 차례는 저장된 채(`design_save.ts:297-299`).
- 저장 중 = `saving` 표시 · 묶음 맞춤은 저장 뒤로 미룸(`design_pipeline_page.ts:567`).
- 저장 중 = `saving` 표시 · 묶음 맞춤은 저장 뒤로 미룸(`design_pipeline_page.ts:520`).
+2 -2
View File
@@ -12,10 +12,10 @@ source: ["CLAUDE.md §5", "docs/raw/조사/2026-10-19_465_요구272_값안변함
| 규칙 | 지키는 자리(파일:줄) | 시험 |
|---|---|---|
| 파생값 = 입력(저장 정본 + 세션 초안)만의 함수 — 보기 차례 · 접힘 · 메모리 · 새로고침 · 들어온 길로 안 갈림 | `logic/design_pipeline.ts:49` STAGE_DEPS · `design_pipeline_page.ts:559-582` reconcile | `test_272_*` |
| 파생값 = 입력(저장 정본 + 세션 초안)만의 함수 — 보기 차례 · 접힘 · 메모리 · 새로고침 · 들어온 길로 안 갈림 | `logic/design_pipeline.ts:49` STAGE_DEPS · `design_pipeline_page.ts:512-535` reconcile | `test_272_*` |
| 상세 가게 메모리 = 페이지 수명 — 떠남 = `forgetSectionMemory` · [저장] · [확정] · [초기화] · 노선 저장 = `invalidateSectionDetail` | `design_page.ts:294` · `design_shared.ts:428 · 435` · `design_reset.ts:41` · `design_view_profile.ts:469` · `B05_Profile_UI_RouteEdit_Apply.ts:171 · 211` | `test_272_detail_memory` |
| [폐기] = 세션 고침 칸만 지움 · 메모리는 떠남(dispose)이 비움 | `design_leave.ts:85-87` · `design_page.ts:286-295` | `test_346_4_design_leave` |
| 조용한 차례(열 때 · 노선 초안 버림) 끝 = 가게 측점 · 종단 = 지금 상세 측점 · 저장 기준 · 같은 목록은 다시 안 냄 | `design_pipeline_page_publish.ts` shown · opened · `design_pipeline_page.ts:417-419 · 544` | `test_272_drop_store_stations` |
| 조용한 차례(열 때 · 노선 초안 버림) 끝 = 가게 측점 · 종단 = 지금 상세 측점 · 저장 기준 · 같은 목록은 다시 안 냄 | `design_pipeline_page_publish.ts` shown · opened · `design_pipeline_page.ts:370-371 · 497` | `test_272_drop_store_stations` |
| 노선 초안 없는 차례 = 서버 정본 측점 기하 · 표본을 브라우저 값으로 안 덮음(같은 자리 0.01 m · 축 1e-3 → 앞 횡단 → 그 자리 옛 횡단 → 저장 정본) | `logic/B06_Section_Station_Swap.ts:171-182 · 238-247` · `B06_Section_Section_Store.ts:241-248` | `test_272_swap_keeps_canon` |
| 노선 초안 차례 = 새 · 옮긴 측점만 브라우저 지반 표본 | `logic/B06_Section_Station_Swap.ts:249-251` | `test_346_2_station_swap` |
| 다시 셈 입력 물러섬 = 세션 고름 → 저장 정본 설계 → config 기본값 · 고름 단추는 메모리 상세 설계를 안 덮음 | `B06_Section_Cross_Refresh.ts:402-408` · `B06_Section_UI_Page_Design_Sync.ts:59-104` | `test_272_choice_undo` |
+2 -2
View File
@@ -14,14 +14,14 @@ source: ["docs/raw/조사/2026-10-19_470_B05B06_데이터흐름.md", "docs/raw/
| 값 | 주인(정본) | 사본 | 셈 자리 · 짝 · 거울 시험 | 맞추는 때 |
|---|---|---|---|---|
| 평면 선형(교점 · R · L · 스냅) | 노선 파일 · 곡선표 · DB `routes` · `route_points` | 편집기 메모리(`B05_Profile_UI_RouteEdit.ts:124-137`) · 사진첩 · pref `routeedit-locks` · `routeedit-snap-step` · 세션 `route-draft` · `route-draft-hold` · 가게 `routeDraft` · 묶음 입력 · `latest` | TS `logic/B05_Profile_UI_RouteEdit_Curve.ts:243` ↔ 파이썬 `common_util_route_polyline.py:579` · `test_route_polyline_browser_mirror` | 놓을 때 세션 · [저장]은 편집기 메모리를 먼저 읽음 · 저장 뒤 페이지 다시 세움 |
| 측점 목록 · 열쇠 | DB `cross_sections` 행 · 종단 파일 stations · 서버 `generate_sections` | 묶음 stations · 가게 `stations`(메모리) → 세션 `design-stations` · 상세 cache · 세션 `section-detail` · canon · `design_pipeline_page.ts` savedStations · `B06_Section_Station_Keys.ts:92` 목록 | TS `logic/design_pipeline_stations.ts` · `logic/B05_Profile_Sections_Stations.ts:276` ↔ 파이썬 `B05_Profile_Engine_Sections_Core.py:449` · 열쇠 `common_util_station_key.ts:32` ↔ `.py:32` · `test_344_3_pipeline_stations_mirror` · `test_344_3_station_key_mirror` | 가게 `stations` 알림 → 갈아끼움(구독 둘 · 같은 목록이면 안 함) · 조용한 차례 끝 = 상세 측점(`design_pipeline_page_publish.ts` shown) · [저장] 뒤 비움 |
| 측점 목록 · 열쇠 | DB `cross_sections` 행 · 종단 파일 stations · 서버 `generate_sections` | 묶음 stations · 가게 `stations`(메모리) → 세션 `design-stations` · 상세 cache · 세션 `section-detail` · canon · `design_pipeline_page.ts` savedStations(sub2 관 · 구조물 줄로 셈 · 남김) · `B06_Section_Station_Keys.ts:92` 목록 | TS `logic/design_pipeline_stations.ts` · `logic/B05_Profile_Sections_Stations.ts:276` ↔ 파이썬 `B05_Profile_Engine_Sections_Core.py:449` · 열쇠 `common_util_station_key.ts:32` ↔ `.py:32` · `test_344_3_pipeline_stations_mirror` · `test_344_3_station_key_mirror` | 가게 `stations` 알림 → 갈아끼움(구독 둘 · 같은 목록이면 안 함) · 조용한 차례 끝 = 상세 측점(`design_pipeline_page_publish.ts` shown) · [저장] 뒤 비움 |
| 측점 자리 · 축 | 서버 측점 틀(저장 경로 폴리라인) | 브라우저 측점 틀(`/route/plan` planned 선) · 상세 cache frame | TS `logic/B05_Profile_UI_RouteEdit_Frame.ts:61` ↔ 파이썬 `B05_Profile_Engine_Sections_Core.py:449-519`(같은 식 · 입력 선 다름 · mm 차) · `test_b05_routeedit_frame_mirror` | 노선 초안 없는 차례 = 정본 자리 · 축 유지(`logic/B06_Section_Station_Swap.ts:238-247`) |
| 지반 표본 | 서버 `sample_xy`(npz · 저장 노선 선) → `cross_*.json` samples | 지형 격자(`B05_Profile_Api_TerrainGrid.ts:29-31` · IndexedDB) · 묶음 ground · 상세 cache samples | TS `common_util_surface_sampler.ts:65` ↔ 파이썬 `common_util_surface_sampler.py:210` · `test_344_1_surface_sampler_mirror` | 갈아끼움 — 노선 초안 없음 = 같은 자리(0.01 m · 축 1e-3) 앞 횡단 → 그 자리 옛 횡단 → 저장 정본 표본 · 노선 초안 = 새 · 옮긴 측점만 브라우저 표본 |
| 계획고 편집(▲▼ · 직선화 · 자유 · 쉬프트 · 시종점) | 종단 파일 `profile_alignment.edits` | ★ 가게 `alignmentDraft`(세션 `alignment-draft`) · 가게 `alignmentSaved`(서버 저장분 · 메모리 · `B05_Profile_UI_Profile_Edit.ts:127 · 235`)(노선 · 초안 노선 0) · 묶음 입력 · 가게 `profile` → `design-profile` · 상세 `longitudinal` | TS `logic/B05_Profile_UI_Profile_Alignment.ts:401` ↔ 파이썬 `B05_Profile_Engine_Grade_Alignment.py:494` · `test_426_profile_straight` · `test_432_1_curve_law` | 커밋마다 세션 · [저장] = 서버 다시 셈 |
| 종단 R | 같은 `edits.curve_radii` | 위와 같음 · 칸은 L · 저장은 R | TS `logic/B05_Profile_Profile_CurveLaw.ts` ↔ `B05_Profile_Engine_Grade_CurveLaw.py` · `test_432_1_curve_law` | 위와 같음 · R = L/Δ 로 적어 Δ 바뀌면 L 흐름 |
| 계획선 꼭짓점(시설 측점) | 종단 파일 base PVI | 묶음 planline · 종단도 | TS `common_util_structure_station.ts:356` followMovedNodes ↔ 파이썬 `B05_Profile_Router_Confirm.py:306` `_follow_moved_stations` · `:220` `_seat_born_nodes` · `test_427_1_follow_seat` · `test_459_route_seat_mirror` | 짝 있는 옮긴 측점 = 꼭짓점 따라감 · 짝 없는 새 측점 = 안 세움 |
| 횡단 입력(카드 · 조정) | DB `cross_sections.design` 패치 칸 | 세션 칸(`crossdesign` · 조정 맵 등) · B06 조정 메모리 맵(`B06_Section_UI_Page_Link_Session.ts:47`) | 입력 도구(셈 없음) | 조작마다 세션 · [저장] 횡단 패치 |
| 횡단 설계 결과(설계선) | DB `cross_sections.design` | 상세 cache(살아 있는 객체 · 제자리 고침) · 세션 `section-detail`(서버 사본만) · canon · 묶음 cross · `pipelineDetail` | TS `common_util_cross_design.ts:267` ↔ 파이썬 `B06_Section_Engine_Design.py:195` · `test_b06_cross_design_mirror` | 다시 셈마다 cache 제자리 · 입력 물러섬 = 저장 정본(`B06_Section_Cross_Refresh.ts:402-408`) · 페이지 수명 · [저장]·[확정]·[초기화] 뒤 비움 |
| 횡단 설계 결과(설계선) | DB `cross_sections.design` | ★ 상세 가게 — cache(살아 있는 객체 · 제자리 고침) · 칸 셋(`B06_Section_Section_Canon.ts:93-143` 저장 정본 상세 · 초안 전 hold 상세 · 노선 초안 상세 = `pipelineDetail` · 472-5) · 세션 `section-detail`(서버 사본만) · canon 설계 사본 · 묶음 cross — 계산 묶음 페이지는 지문(노선 · 표본)만 | TS `common_util_cross_design.ts:267` ↔ 파이썬 `B06_Section_Engine_Design.py:195` · `test_b06_cross_design_mirror` | 다시 셈마다 cache 제자리 · 입력 물러섬 = 저장 정본(`B06_Section_Cross_Refresh.ts:402-408`) · 페이지 수명 · [저장]·[확정]·[초기화] 뒤 비움 |
| 측점 면적 | DB 면적 — 표준 측점 = 파이썬 · 구조물 측점 = Node | cache 면적 · 묶음 cross | TS `common_util_cross_design_areas.ts` ↔ 파이썬 `B06_Section_Engine_Areas.py` · 구조물 = `B06_Section_Structure_Layouts.ts`(Node 한 벌) | [저장] 때 서버가 브라우저 면적 버리고 다시 셈 |
| 누가토량 | 종단 파일 `mass_haul` | 그릴 때 셈 · 배지 · `_derived/haul` · `B05_Profile_Api_HaulPlan.ts:28` kept | TS `common_util_mass_haul.ts:426` 한 벌(브라우저 · Node) | 그릴 때(접혀도 셈) · [저장] |
| 구조물 | `structures.json` | `B05_Profile_UI_Page_Structures.ts:78` · `B06_Section_UI_Page_Structures_Panel.ts:175` · 시설 줄 `design_facility_lane.ts:97` · savedStructures · `design_page_data.ts:25` · 세션 `structures` · `structure-type-cache` · cache | 따라감 TS `common_util_route_follow.ts:291` ↔ 파이썬 `common_util_route_follow.py:120` · `test_410_follow_xy` | 시설 줄 알림 · 숨은 보기는 보일 때 |
@@ -69,6 +69,8 @@ function loadTs(full) {
return box.exports;
}
const load = (...parts) => loadTs(path.join(ROOT, ...parts));
// 상세 가게 칸(472-5) — 실제는 상세 가게가 받을 때 채움 · 여기선 종단도가 내주는 저장 상세 그대로
const slots = () => load("B06_Section", "B06_Section_Section_Canon.ts");
const sampler = load("common_util", "common_util_surface_sampler.ts");
const bytes = fs.readFileSync(process.argv[3]);
@@ -190,7 +192,7 @@ async function run() {
pipelineSource: () => ({
base: savedBase,
edits: alignment.emptyEdits(),
detail: job.detail,
detail: (slots().keepSavedDetail(P, 7, job.detail), job.detail),
routeId: 7,
}),
adoptPipeline: (base, edits, draft) => adopted.push({ draft, saved: base === savedBase }),
@@ -69,6 +69,8 @@ function loadTs(full) {
return box.exports;
}
const load = (...parts) => loadTs(path.join(ROOT, ...parts));
// 상세 가게 칸(472-5) — 실제는 상세 가게가 받을 때 채움 · 여기선 종단도가 내주는 저장 상세 그대로
const slots = () => load("B06_Section", "B06_Section_Section_Canon.ts");
const sampler = load("common_util", "common_util_surface_sampler.ts");
const bytes = fs.readFileSync(process.argv[3]);
@@ -200,7 +202,7 @@ async function draftRun(P, grid) {
pipelineSource: () => ({
base: savedBase,
edits: alignment.emptyEdits(),
detail: job.detail,
detail: (slots().keepSavedDetail(P, 7, job.detail), job.detail),
routeId: 7,
}),
adoptPipeline: () => undefined,
@@ -68,6 +68,10 @@ function loadTs(full) {
return box.exports;
}
const load = (...parts) => loadTs(path.join(ROOT, ...parts));
// 상세 가게 칸(472-5) — 실제는 상세 가게가 받을 때 채움 · 여기선 종단도가 내주는 저장 상세 그대로
const slots = () => load("B06_Section", "B06_Section_Section_Canon.ts");
/** 이 시험은 묶음 여럿(P · Q · B)이 같은 종단도 흉내를 씀 — 칸 = 지금 연 프로젝트. */
const here = () => window.localStorage.getItem("frd_current_project_id");
const sampler = load("common_util", "common_util_surface_sampler.ts");
const bytes = fs.readFileSync(process.argv[3]);
@@ -214,7 +218,7 @@ async function run() {
pipelineSource: () => ({
base: savedBase,
edits: alignment.emptyEdits(),
detail: job.detail,
detail: (slots().keepSavedDetail(here(), 7, job.detail), job.detail),
routeId: 7,
}),
adoptPipeline: () => undefined,
@@ -222,7 +226,8 @@ async function run() {
});
const options = {
stationIntervalM: job.interval,
holdDraft: (_routeId, saved) => {
holdDraft: (routeId, saved) => {
slots().keepHeldDetail(here(), routeId, saved); // 초안 전 상세 칸(472-5 · 가게 hold 와 같음)
holds.push(saved === job.detail ? "saved" : saved ? "other" : "null");
return async () => "saved";
},
+10 -5
View File
@@ -67,6 +67,8 @@ function loadTs(full) {
return box.exports;
}
const load = (...parts) => loadTs(path.join(ROOT, ...parts));
// 상세 가게 칸(472-5) — 실제는 상세 가게가 받을 때 채움 · 여기선 종단도가 내주는 저장 상세 그대로
const slots = () => load("B06_Section", "B06_Section_Section_Canon.ts");
const sampler = load("common_util", "common_util_surface_sampler.ts");
const bytes = fs.readFileSync(process.argv[3]);
@@ -215,7 +217,7 @@ async function run() {
pipelineSource: () => ({
base: savedBase,
edits: alignment.emptyEdits(),
detail: job.detail,
detail: (slots().keepSavedDetail(P, 7, job.detail), job.detail),
routeId: 7,
}),
adoptPipeline: (_base, _edits, draft) => adopts.push(draft ? "draft" : "saved"),
@@ -223,10 +225,13 @@ async function run() {
},
{
stationIntervalM: job.interval,
holdDraft: () => async (stations) => {
restores.push({ at: adopts.length, stations: stations.length });
return "saved";
},
holdDraft: (routeId, saved) => (
slots().keepHeldDetail(P, routeId, saved), // 초안 전 상세 칸(472-5 · 가게 hold 와 같음)
async (stations) => {
restores.push({ at: adopts.length, stations: stations.length });
return "saved";
}
),
},
);
pageMod.pipelineEarthwork(P, { conversion: job.conversion });
+36
View File
@@ -0,0 +1,36 @@
/* 472-5 5-B 헬퍼 — 상세 가게 칸 셋(`B06_Section_Section_Canon.ts`) 넣고 비움. 짝 = `test_472_5b_detail_owner.py`. */
const fs = require("fs");
const path = require("path");
const ROOT = path.join(__dirname, "..", "..");
const ts = require(path.join(ROOT, "config", "node_modules", "typescript"));
const file = path.join(ROOT, "B06_Section", "B06_Section_Section_Canon.ts");
const js = ts.transpileModule(fs.readFileSync(file, "utf8"), {
compilerOptions: { module: ts.ModuleKind.CommonJS, target: ts.ScriptTarget.ES2020 },
}).outputText;
const box = { exports: {} };
new Function("exports", "module", "require", js)(box.exports, box, () => ({
readState: () => null,
}));
const c = box.exports;
const [a, b, d] = [{ tag: "a" }, { tag: "b" }, { tag: "d" }];
c.keepSavedDetail("P", 1, a);
c.keepSavedDetail("P", 2, b);
c.keepHeldDetail("P", 1, b);
c.setDraftSectionDetail("P", d);
const tag = (x) => x?.tag ?? null;
const out = {
saved1: tag(c.savedSectionDetail("P", 1)),
held1: tag(c.heldSectionDetail("P", 1)),
draft: tag(c.draftDetailOf("P")),
};
c.forgetDetailSlots("P", 1);
out.after1 = [
tag(c.savedSectionDetail("P", 1)),
tag(c.heldSectionDetail("P", 1)),
tag(c.savedSectionDetail("P", 2)),
tag(c.draftDetailOf("P")),
];
c.forgetDetailSlots("P");
out.afterAll = [tag(c.savedSectionDetail("P", 2)), tag(c.draftDetailOf("P"))];
console.log(JSON.stringify(out));
@@ -0,0 +1,60 @@
# -*- coding: utf-8 -*-
"""472-5 5-B — 횡단 상세 객체의 주인 = 상세 가게 하나(칸 셋: 저장 정본 · 초안 전 hold · 노선 초안).
옛 꼴: 계산 묶음 페이지가 상세 객체를 따로 쥠(정본 `canon.detail` · 초안 전 `held.detail` ·
노선 초안 `shown`) — 가게가 판 바뀜(433-16)으로 hold 를 새 판으로 바꿔도 페이지는 옛 객체로
정본을 잡았음.
"""
from __future__ import annotations
import json
import subprocess
from pathlib import Path
import pytest
ROOT = Path(__file__).resolve().parents[2]
TS = ROOT / "config" / "node_modules" / "typescript"
def _src(*parts: str) -> str:
return (ROOT.joinpath(*parts)).read_text(encoding="utf-8")
def test_페이지는_상세를_안_쥠() -> None:
page = _src("A00_Common", "design", "design_pipeline_page.ts")
saved = _src("A00_Common", "design", "design_pipeline_page_saved.ts")
assert "let shown" not in page # 노선 초안 상세 = 가게 칸
assert "setDraftSectionDetail(projectId, shown)" in page
assert "detail: () => draftDetailOf(projectId)" in page
assert "detail: SectionDetailResponse | null;" not in page # hold 에 상세 사본 없음
assert "heldSectionDetail(projectId, routeId as number)" in page
assert "let canon: { routeId: unknown; samples: unknown } | null" in saved # 지문만
assert "savedSectionDetail(projectId, canon.routeId)" in saved
def test_가게가_칸을_채움() -> None:
store = _src("B06_Section", "B06_Section_Section_Store.ts")
# 받을 때(세션 · 새로 받음 · 판 바뀜) · 되돌릴 때 = 저장 정본 칸 · 갈아끼움은 안 씀
assert store.count("keepSavedDetail(projectId, routeId,") == 4
swap = store[store.index("export async function swapSectionStations(") :]
assert "keepSavedDetail" not in swap[: swap.index("\n}\n")]
# 판이 바뀌면 hold 도 새 판(433-16)
renew = "if (heldSectionDetail(projectId, routeId) === stored) keepHeldDetail("
assert renew + "projectId, routeId, fresh);" in store
forget = store[store.index("export function forgetSectionMemory(") :]
assert "forgetDetailSlots(projectId);" in forget[: forget.index("\n}\n")]
@pytest.mark.skipif(not TS.is_dir(), reason="프론트엔드 의존성 미설치")
def test_칸_셋_넣고_비움() -> None:
helper = ROOT / "resources" / "tester" / "helper_472_5b_slots.cjs"
run = subprocess.run(
["node", str(helper)], capture_output=True, text=True, encoding="utf-8", timeout=60
)
assert run.returncode == 0, run.stderr
got = json.loads(run.stdout)
assert got["saved1"] == "a" and got["held1"] == "b" and got["draft"] == "d"
assert got["after1"] == [None, None, "b", "d"] # 노선 하나만 · 초안 칸은 그대로
assert got["afterAll"] == [None, None]