fix(854-1): 내 기계 저장 잠금 · 판 대조 · 번호 겹침 막음 — 묶음 ①

- 번호 발급 + 쓰기를 한 잠금 안에서(`M02_MyMachine.add`) · 이미 있는 파일 번호는 건너뜀(덮어쓰기 없음)
- 화면 만들기 · 단가산출 [저장] 초안(`M02_MyMachine_Draft._new`) · 불러오기 자동 생성(`create` 꼴 그대로) 모두 이 한 길
- 고치기 = 화면이 연 판을 보냄 · 다르면 409 {stale, 판} → 화면 「그 사이 다른 곳에서 바뀜」 · 서버 길(판 없음) = 대조 없음
- 답에 `판` · 지우기도 잠금 안
- 시험 test_854_1 — 동시 만들기 8 번 번호 겹침 0(옛 코드 = 8 번 중 3 번호) · 옛 판 409 · 뒤처진 `_다음` 이 있는 파일을 안 덮음

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-17 15:59:02 +09:00
co-authored by Claude Opus 5.5
parent 9c67cdac64
commit cce681df12
7 changed files with 157 additions and 33 deletions
+6 -4
View File
@@ -33,6 +33,7 @@ import {
type MyMachineOne,
type SimilarRow,
} from "./M02_MyMachine_Api";
import { StaleError } from "./M02_MasterTemplete_Api_Fetch";
import { confirmMyMachineImpact } from "./M02_MyMachine_Impact";
import { mt } from "./M02_MyMachine_Text";
import "./M02_MyMachine.css";
@@ -97,6 +98,7 @@ export async function mountMyMachineForm(
opt.key ? readMyMachine(opt.owner, opt.key) : Promise.resolve(null),
]);
const row = one?.줄;
let ver = one?.판; // 연 판(854-1) — 고치기 때 보냄 · 저장마다 새 판
let base: string | undefined; // 서버 `본뜬`
const notice = el("div", { className: "m02-mymach__notice" });
const server = el("div", { className: "m02-mymach__server" });
@@ -173,16 +175,16 @@ export async function mountMyMachineForm(
// 정본 고침 = 영향 보고 저장(848-5)
if (opt.key && !(await confirmMyMachineImpact(opt.owner, opt.key, body))) return;
const got = opt.key
? await updateMyMachine(opt.owner, opt.key, body)
? await updateMyMachine(opt.owner, opt.key, body, ver)
: await createMyMachine(opt.owner, body, base);
ver = got.판;
saved = true;
opt.onDirty?.(false);
showToast(mt("Saved"), "success");
opt.onSaved(got);
} catch (error) {
notice.replaceChildren(
createText(error instanceof Error ? error.message : mt("Failed"), "error"),
);
const why = error instanceof StaleError ? mt("Stale") : error instanceof Error ? error.message : mt("Failed"); // prettier-ignore
notice.replaceChildren(createText(why, "error"));
} finally {
saveBtn.disabled = m01Same;
}