"""Ramp-A P1 app flow without Rhino (2026-10-14): a copy of data/Ramp-A교P1 in 검증/rampa_web_data (recreated). Checks that the drilled-shaft form is not blocked by sections it does not have (lean concrete, footing, footing rebar), that its own sections (pile, shaft_rebar) need confirmation, and that confirming every required bundle clears G1.""" import os import shutil import sys from pathlib import Path APP = Path(__file__).resolve().parents[1] TD = APP / "검증" / "rampa_web_data" if TD.exists(): shutil.rmtree(TD) shutil.copytree(APP / "data" / "Ramp-A교P1", TD / "램프", ignore=shutil.ignore_patterns("runs", "backup", "confirm.json")) os.environ["PIERAPP_DATA"] = str(TD) sys.path.insert(0, str(APP / "web")) import app as webapp # noqa: E402 sys.path.insert(0, str(Path(__file__).resolve().parent)) from testlib import confirm_required # noqa: E402 import store # noqa: E402 ok = True def check(name, cond, detail=""): global ok ok &= bool(cond) print("PASS" if cond else "FAIL", name, str(detail)[:300], flush=True) p = store.Pier("램프") check("scope G1~G5", p.scope() == ["G1", "G2", "G3", "G4", "G5"], p.scope()) missing = [b for g in p.scope() for b in webapp.gate_blockers(p, g) if b.endswith("없음")] check("no gate blocked by an absent section", not missing, missing) need = {k for _, k in webapp.unconfirmed(p)} check("pile and shaft_rebar need confirmation", {"pile", "shaft_rebar"} <= need, sorted(need)) check("absent footing sections not required", not ({"lean_concrete", "footing", "footing_rebar", "piles"} & need)) c = webapp.app.test_client() confirm_required(c, webapp, store, "램프", "시험") p = store.Pier("램프") check("confirming every required bundle clears all required", webapp.unconfirmed(p) == [], webapp.unconfirmed(p)) check("G1 not blocked after confirming every required bundle", webapp.gate_blockers(p, "G1") == [], webapp.gate_blockers(p, "G1")) check("G2 waits only for G1 approval", webapp.gate_blockers(p, "G2") == ["G1 미승인"], webapp.gate_blockers(p, "G2")) r = c.get("/pier/램프") h = r.get_data(as_text=True) check("pier page renders with the pile section", r.status_code == 200 and "params.pile" in h.replace("/", ".") or "pile" in h, r.status_code) shutil.rmtree(TD) print("RESULT", "PASS" if ok else "FAIL") sys.exit(0 if ok else 1)