fix(564-1): 체인 광역 단계 = E07 화면과 같은 조건(지난 조건 + 지금 E02 물성) · 지문에 E02 물성(564-4)

- 시험 test_564_1 — 광역 물성 E02 값 · 지문 같으면 건너뜀

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-27 21:32:46 +09:00
co-authored by Claude Opus 5.5
parent 75155c50b0
commit 04e041ee5c
2 changed files with 38 additions and 2 deletions
+11 -2
View File
@@ -218,9 +218,18 @@ def build_steps(project_id: UUID, project_root: Path) -> dict[str, Step]:
async def step_area(report: Report, _stopped: Stopped) -> str:
src = e07._source_root(root)
saved = await asyncio.to_thread(e07.load, root)
base = (saved or {}).get("settings") or e07.defaults(root)
# E07 화면과 같음 — 지난 조건(없으면 기본값) + 물성은 지금 E02 값(564-4)
base = {**e07.defaults(root), **((saved or {}).get("settings") or {})}
mat = e07.ground_material(root, base.get("material_id"))
if mat and mat["id"] == base.get("material_id"):
base.update({k: float(mat[k]) for k in e07.MATERIAL_KEYS})
base.update(c_hi=base["c"] + e07.RANGE_C_KPA, phi_hi=base["phi"] + e07.RANGE_PHI_DEG)
settings = e07.AreaRequest(**base).model_dump(exclude={"force"})
finger = e07.fingerprint(source.manifest(src)["source_fingerprint"], settings)
finger = e07.fingerprint(
source.manifest(src)["source_fingerprint"],
settings,
e07.ground_material(root, settings["material_id"]),
)
if saved and saved["fingerprint"] == finger:
return "skip"
page = _plug(e07._JOBS, pid, {})
+27
View File
@@ -253,3 +253,30 @@ def test_단계_상태_적기(monkeypatch):
("report", "skip"),
]
assert marks[0] == ("2d", "run", None) and "area 망가짐" in marks[7][2]
def test_광역_물성은_E02_값_지문_같으면_건너뜀(tmp_path, monkeypatch):
from common_util.common_util_json import atomic_write_json
from E07_StabArea import E07_StabArea_Router as e07
ground = model.build_initial(model.load_defaults(), [])
colluvium = next(m for m in ground["materials"] if m["id"] == "colluvium")
colluvium["c"] = 7.0
atomic_write_json(model.ground_path(tmp_path), ground)
old = {**e07.defaults(tmp_path), "c": 1.0, "c_hi": 2.0, "band_m": 150.0}
atomic_write_json(tmp_path / e07.RESULT, {"fingerprint": "옛", "settings": old})
monkeypatch.setattr(e07, "_source_root", lambda root: root)
monkeypatch.setattr(source, "manifest", lambda src: {"source_fingerprint": "src"})
runs = []
def fake_run(root, src, settings, finger, report):
runs.append(settings)
atomic_write_json(root / e07.RESULT, {"fingerprint": finger, "settings": settings})
monkeypatch.setattr(e07, "run", fake_run)
step = chain.build_steps(PID, tmp_path)["area"]
assert asyncio.run(step(lambda f, m: None, lambda: False)) == "done"
got = runs[0]
assert got["c"] == 7.0 and got["c_hi"] == 7.0 + e07.RANGE_C_KPA # 물성 = 지금 E02
assert got["band_m"] == 150.0 # 그 밖 조건 = 지난 저장본
assert asyncio.run(step(lambda f, m: None, lambda: False)) == "skip" and len(runs) == 1