"""롤백 확인: 통짜 토치 1개 + 기본 피벗=center(중심축)인지."""
import asyncio, json
from playwright.async_api import async_playwright
URL='http://localhost:8090/DOZIKWORKS_OS_v5_locked.dc.html'
async def main():
    async with async_playwright() as p:
        br=await p.chromium.launch(channel='msedge',headless=True)
        pg=await br.new_page(viewport={'width':1000,'height':700})
        errs=[]; pg.on('pageerror',lambda e: errs.append(str(e)))
        await pg.goto(URL)
        # 통짜 토치는 _torchMesh(torch_TCP540) + _torchPivot 사용
        await pg.wait_for_function("window.__dzw && window.__dzw._torchMesh", timeout=15000)
        res=await pg.evaluate("""()=>{ const d=window.__dzw; return {
          meshName: d._torchMesh?.name,
          hasPivot: !!d._torchPivot,
          pivotWhere: d._torchPivotWhere,
          hasParts: !!d._torchParts,   // 분리버전 흔적이면 true (있으면 롤백 실패)
        }; }""")
        print(json.dumps(res,ensure_ascii=False))
        print("pageerrors:", errs if errs else "없음")
        await br.close()
asyncio.run(main())
