diff --git a/B04_PreProcess/B04_PreProcess_Router_Basins.py b/B04_PreProcess/B04_PreProcess_Router_Basins.py index 6130b2962..e382f6929 100644 --- a/B04_PreProcess/B04_PreProcess_Router_Basins.py +++ b/B04_PreProcess/B04_PreProcess_Router_Basins.py @@ -494,7 +494,7 @@ async def _resolve( saved = requested is None and stored is not None if analysis_route_signature(context.stored_path) != signature: - if points is None: + if points is None or auto is not None: # 자동 자리 = 지금 노선 분석이 있어야(369) return JSONResponse( status_code=409, content={"status": "stale", "message": STALE_MESSAGE} ) diff --git a/resources/tester/test_369_drainage_auto.py b/resources/tester/test_369_drainage_auto.py index 7c9109869..2022901a8 100644 --- a/resources/tester/test_369_drainage_auto.py +++ b/resources/tester/test_369_drainage_auto.py @@ -115,3 +115,19 @@ def test_틀린_auto_는_400_열쇠에_auto(tmp_path, monkeypatch): points = [PipePoint(chainage_m=20.0)] keys = {basins._detail_key(CONTEXT, points, auto) for auto in basins.AUTO_MODES} assert len(keys) == 3 + + +def test_낡은_분석에_auto_는_409(monkeypatch): + async def load(project_id): + return CONTEXT, "" + + monkeypatch.setattr(basins, "load_drainage_context", load) + monkeypatch.setattr(basins, "analysis_route_signature", lambda stored: "옛 노선") + points = [{"chainage_m": 20.0}] + for auto in ("all", "add"): + result = asyncio.run( + basins._resolve(uuid4(), {"points": points, "auto": auto}, use_stored=False) + ) + assert result.status_code == 409 # 말없이 그대로 돌려주지 않음 — 낡음 까닭 + kept = asyncio.run(basins._resolve(uuid4(), {"points": points}, use_stored=False)) + assert kept[-1] is True # auto 없음 = 관 자리만 낡음으로(그대로)