Add BAT-014 browser evidence artifacts
This commit is contained in:
@@ -29,10 +29,10 @@ import websockets
|
||||
from jarca_ledger_mcp import service
|
||||
from jarca_ledger_mcp.db import init_db
|
||||
|
||||
DEFAULT_PAGES = ["분류 규칙", "확인필요 큐", "Import"]
|
||||
DEFAULT_PAGES = ["요약", "분류 규칙", "확인필요 큐", "Import"]
|
||||
DEFAULT_CHROME = "/usr/bin/google-chrome-stable"
|
||||
DEFAULT_STREAMLIT = Path(".venv/bin/streamlit")
|
||||
DEFAULT_OUTPUT_ROOT = Path("docs/batches/bat-004_20260629_browser-streamlit-e2e-evidence/evidence")
|
||||
DEFAULT_OUTPUT_ROOT = Path("docs/batches/bat-014_20260703_adapter-surface-narrowing-baseline-refresh/evidence")
|
||||
|
||||
|
||||
def parse_args() -> argparse.Namespace:
|
||||
@@ -181,6 +181,16 @@ def wait_for_devtools(port: int, timeout_seconds: int = 15) -> str:
|
||||
raise SystemExit(f"Chrome DevTools endpoint did not become ready on port {port}: {last_error}")
|
||||
|
||||
|
||||
def remove_tree_with_retries(path: Path, attempts: int = 5, delay_seconds: float = 0.5) -> None:
|
||||
for attempt in range(1, attempts + 1):
|
||||
shutil.rmtree(path, ignore_errors=True)
|
||||
if not path.exists():
|
||||
return
|
||||
time.sleep(delay_seconds * attempt)
|
||||
if path.exists():
|
||||
raise SystemExit(f"temporary Chrome profile cleanup failed: {path}")
|
||||
|
||||
|
||||
class CdpClient:
|
||||
def __init__(self, ws: websockets.ClientConnection) -> None:
|
||||
self.ws = ws
|
||||
@@ -265,7 +275,8 @@ def capture_page(chrome: str, base_url: str, page: str, output_dir: Path, devtoo
|
||||
chrome_proc.wait(timeout=8)
|
||||
except subprocess.TimeoutExpired:
|
||||
chrome_proc.kill()
|
||||
shutil.rmtree(profile_dir, ignore_errors=True)
|
||||
chrome_proc.wait(timeout=5)
|
||||
remove_tree_with_retries(profile_dir)
|
||||
|
||||
if not screenshot.exists() or screenshot.stat().st_size <= 0:
|
||||
raise SystemExit(f"Screenshot was not created for {page}: {screenshot}")
|
||||
|
||||
Reference in New Issue
Block a user