fix(472-6 6-B 저장 뒤 초안 되씀): 노선 저장 성공 뒤 묶음이 노선 초안 비움을 「버림」으로 보고 초안 전 관 · 구조물 초안을 세션에 되쓰던 흠 — 저장이면 초안 전 값 버림(commitRouteFacilities)

- 화면 검증(검증_sub8)에서 찾음 — 저장 뒤 옹벽 초안이 끌기 전 자리(600)로 남아 다음 [저장]이 옛 자리로 되돌릴 뻔함
- design_pipeline_page 네 줄(commit) · routeSaved 가 노선 초안 비우기 전에 부름 · 시험 test_472_6_route_save

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-19 12:34:38 +09:00
co-authored by Claude Opus 5.5
parent 4b6800e387
commit a3d24cf494
5 changed files with 26 additions and 3 deletions
@@ -128,6 +128,7 @@ interface PagePipeline {
reconcile(): Promise<number>;
ownsCross: boolean;
detail(): SectionDetailResponse | null;
commit(): void;
dispose(): void;
}
@@ -177,6 +178,9 @@ export const pipelineDetail = (projectId: string): SectionDetailResponse | null
export const pagePipeline = (projectId: string): DesignPipeline | null =>
pages.get(projectId)?.pipe ?? null;
/** 노선 초안을 저장함(472-6 6-B) — 초안 전 관 · 구조물을 버림(노선 초안이 비어도 「버림」 되돌림 안 함). */
export const commitRouteFacilities = (projectId: string): void => pages.get(projectId)?.commit();
export function disposePagePipeline(projectId: string): void {
pages.get(projectId)?.dispose();
pages.delete(projectId);
@@ -639,6 +643,7 @@ function createPagePipeline(
reconcile,
ownsCross: Boolean(options.savedCross),
detail: () => draftDetailOf(projectId),
commit: () => void (beforeDraft = null),
dispose() {
disposed = true;
setDraftSectionDetail(projectId, null);
@@ -14,6 +14,7 @@
import { clearDrafts, clearResults, clearState, readState } from "../A00_Common/b_page_state";
import type { RouteDraft } from "../A00_Common/design/logic/design_pipeline_types";
import { useDesignStore } from "../A00_Common/design/design_store";
import { commitRouteFacilities } from "../A00_Common/design/design_pipeline_page";
import { currentRoute, remountRoute } from "../A00_Common/router";
import { hideLoadingOverlay, showLoadingOverlay, showToast } from "@ui/ui_template_elements";
import { invalidateSectionDetail } from "../B06_Section/B06_Section_Section_Store";
@@ -126,9 +127,11 @@ export async function saveRouteDraft(
return saved;
}
/** 노선을 저장함(서버가 다 저장한 뒤) — 가게 노선 초안 비움 · 조회 결과 캐시 비움(옛 노선 것 · 추천은 새 노선의
* 출발점이라 다시 적음) · 편집기 「저장됨」. */
/** 노선을 저장함(서버가 다 저장한 뒤) — 묶음의 초안 전 관 · 구조물 버림(초안 비움을 「버림」으로 되돌리지 않게 ·
* 저장한 초안 자리가 정본) · 가게 노선 초안 비움 · 조회 결과 캐시 비움(옛 노선 것 · 추천은 새 노선의 출발점이라
* 다시 적음) · 편집기 「저장됨」. */
export function routeSaved(projectId: string): void {
commitRouteFacilities(projectId);
useDesignStore(projectId, null).set("routeDraft", null);
clearResults(projectId);
sources.get(projectId)?.saved();
@@ -36,6 +36,9 @@ const STUBS = {
currentRoute: () => "b05-profile",
remountRoute: () => calls.push("remount"),
},
"../A00_Common/design/design_pipeline_page": {
commitRouteFacilities: () => calls.push("commit"), // 저장 = 초안 전 관 · 구조물 버림(6-B)
},
"../B06_Section/B06_Section_Section_Store": {
invalidateSectionDetail: (_p, routeId) => calls.push(`invalidate:${routeId ?? "all"}`),
},
@@ -94,7 +94,7 @@ def test_추천_적용은_as_initial_저장_뒤_다시_세움(out):
assert body["as_initial"] is True and body["initial"] == {"mode": "earthwork"}
assert body["draft"]["nodes"] == [[1, 1], [9, 9]]
# 잠금 막 하나(472-6 6-B — 저장 직전 저장 관 떠 두기는 서버 한 본문 몫 · 추천은 초안을 비우니 안 받음)
assert out["recommendCalls"] == ["overlay:on", "replan", "overlay:off"]
assert out["recommendCalls"] == ["overlay:on", "replan", "commit", "overlay:off"] # 초안 전 시설 버림
assert out["recommendDraftsLeft"] == {"route": None, "pipes": None} # 새 초기값에서 다시
assert out["rebuilt"] == 1
+12
View File
@@ -378,3 +378,15 @@ def test_정상_한_본문은_옛_차례와_같음() -> None:
asyncio.run(undo())
files.discard()
assert _state(ROOT_DIR) == start
def test_저장한_노선_초안은_버림으로_되돌리지_않음() -> None:
"""화면 흠(6-B 화면 검증) — 저장 뒤 노선 초안 칸을 비우면 묶음이 「초안 버림」으로 보고 초안 전 관 ·
구조물 초안을 세션에 되써 다음 [저장]이 옛 자리로 되돌렸음 → 저장 성공이면 초안 전 값을 버림(commit)."""
apply = (ROOT / "B05_Profile" / "B05_Profile_UI_RouteEdit_Apply.ts").read_text(encoding="utf-8")
body = apply[apply.index("export function routeSaved") :]
body = body[: body.index("\n}\n")]
assert body.index("commitRouteFacilities(projectId);") < body.index('set("routeDraft", null)')
page = (ROOT / "A00_Common" / "design" / "design_pipeline_page.ts").read_text(encoding="utf-8")
assert "commit: () => void (beforeDraft = null)," in page
assert "if (!beforeDraft) return;" in page # 버린 차례 = 초안 전 값이 있을 때만 되씀