fix(826-2): 내 기계 옮김 = 다음 번호 큰 쪽

- 옛 코드 창이 옛 내기계.json 을 다시 써도 폴더 다음 번호가 뒤로 안 감 · 시험 한 줄

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-12 20:24:04 +09:00
co-authored by Claude Opus 5.5
parent 7881ed9343
commit b9feac29df
2 changed files with 4 additions and 2 deletions
+2 -2
View File
@@ -92,8 +92,8 @@ def _move(folder: Path | None = None) -> None:
for row in got.get("줄") or []:
if isinstance(row, dict) and mine(row.get("키")):
atomic_write_json(base / f"{row['키']}.json", row)
if not (base / NEXT).is_file():
atomic_write_json(base / NEXT, {"다음": int(got.get("다음") or 1)})
had = int(_load(base / NEXT).get("다음") or 1) # 옛 코드 창이 다시 쓴 옛 파일도 — 번호는 큰 쪽
atomic_write_json(base / NEXT, {"다음": max(had, int(got.get("다음") or 1))})
old.unlink()
@@ -116,6 +116,8 @@ def test_my_machine_moves_once(tmp_path: Path) -> None:
] # fmt: skip
assert mym._read(tmp_path) == old and mym.rows(tmp_path) == rows
assert mym._read(tmp_path / "없음") == {"줄": [], "다음": 1}
(tmp_path / mym.FILE).write_text(json.dumps({"줄": [], "다음": 5}), encoding="utf-8")
assert mym._read(tmp_path)["다음"] == 11 # 옛 코드가 다시 쓴 옛 파일 — 번호 뒤로 안 감
# ④ 저장 검사 좁히기 = 옛 길과 같은 오류 ─────────────────────────────────