fix(755-3): 받은 노선 원본 꼭짓점을 체인 예정노선 파일 양끝에서 자름 — 지표면 넓어진 뒤 280 m 긴 흠

- /route/plan/source = 지표면 트림 뒤 expected_route.csv 시점 · 종점 투영 자리에서 자름(파일 없음 = 그대로) · 0.1 mm 반올림 겹친 점 하나만
- 검증_sub2 source 1,377.4 → 1,097.4 m(= csv) · follow 1,356.5 → 1,080.2 m · 검증_sub1 은 전후 같음(1,097.4)
- 시험 test_635_2 양끝 자름 · 파일 없음 그대로 한 건 더함

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-02 23:21:40 +09:00
co-authored by Claude Opus 5.5
parent ad9062dec7
commit 8b3560c4ce
2 changed files with 51 additions and 2 deletions
@@ -133,6 +133,31 @@ def test_plan_source_skips_densify_keeps_trim(tmp_path: Path, monkeypatch) -> No
assert asyncio.run(source.read_plan_source(uuid4())).status_code == 404
def test_plan_source_clips_to_expected_csv_ends(tmp_path: Path, monkeypatch) -> None:
"""755-3 — 지표면이 넓어져 트림이 덜 잘라도 체인 예정노선 파일 양끝에서 자름(같은 길이)."""
monkeypatch.setattr(
source,
"load_design_route",
lambda *a: SimpleNamespace(vertices=[SimpleNamespace(x=x, y=y) for x, y in SPARSE]),
)
monkeypatch.setattr(source, "build_surface_sampler", lambda *a: object())
monkeypatch.setattr(source, "trim_route_to_surface", lambda points, sampler: points)
surface = {"source_filter": "classification", "method": "dtm", "smooth": True}
dense = densify_route(SPARSE[3:30], source.SPACING_M)
write_route_csv(expected_route_csv_path(tmp_path), [{"x": x, "y": y} for x, y in dense])
got = source.source_vertices(tmp_path, surface, None)
def length(points):
return sum(math.dist(a, b) for a, b in zip(points, points[1:]))
assert abs(length(got) - length(dense)) < 1e-3 # 파일 좌표 0.1 mm 반올림
assert math.dist(got[0], SPARSE[3]) < 1e-3 and math.dist(got[-1], SPARSE[29]) < 1e-3
assert len(got) == 27 # 끝 = 꼭짓점 바로 앞 · 겹친 점 없음
# 파일 없음 = 그대로
expected_route_csv_path(tmp_path).unlink()
assert len(source.source_vertices(tmp_path, surface, None)) == len(SPARSE)
MAIN = {
"id": "main",
"vertices": [[200000.0, 450000.0], [200100.0, 450000.0], [200200.0, 450000.0]],