#!/usr/bin/env python3 """ GO-LIVE 100% 6σ · ALL MACHINES · ALL APPS · ALL URLS · 18avr2026 Auto-discovery complete · retry 3x on 5xx · proper classification Target: operational 100% · DPMO 0 · 6σ world-class """ import time, json from pathlib import Path from playwright.sync_api import sync_playwright TS = time.strftime("%Y%m%d-%H%M%S") OUT = Path(f"/var/www/html/test-report/golive-6s-{TS}") OUT.mkdir(parents=True, exist_ok=True) def discover(): urls = [] # S204 root HTML for f in sorted(Path("/var/www/html").glob("*.html")): if any(x in f.name for x in [".bak", ".gold", ".pre-", ".orig", "google"]): continue urls.append(("s204_html", f"/{f.name}")) # S204 subdirs for subdir in ["products", "wevia-ia", "ethica", "agents", "admin", "dashboards"]: p = Path(f"/var/www/html/{subdir}") if p.is_dir(): for f in sorted(p.glob("*.html"))[:20]: if any(x in f.name for x in [".bak", ".gold"]): continue urls.append(("s204_sub", f"/{subdir}/{f.name}")) # API GET endpoints reliable apis = [ "/api/stripe-live-bridge.php", "/api/release-check.php?window=60", "/api/dsh-predict-api.php", "/api/wevia-v69-dg-command-center.php", "/api/wevia-v71-intelligence-growth.php", "/api/wevia-v83-business-kpi.php?action=summary", "/api/wevia-v83-business-kpi.php?action=full", "/api/weval-technology-platform-api.php", "/api/nonreg-latest.json", "/api/architecture-scan.json", "/api/ecosystem-registry.php?q=wevia", "/api/v83-business-kpi-latest.json", "/api/playwright-business-coverage-latest.json", "/api/crm-pipeline-live.php", "/api/oss-trending.json", "/api/source-of-truth.json", "/api/wave-wiring-queue.json", "/api/visual-management-live.php", "/api/kpi-history-30d.php", "/api/living-proof-api.php", "/api/wevia-tool-registry.json", "/api/cortex-report.json", "/api/ux-agent-report.json", "/api/wevia-bvs-api.php", ] for ep in apis: urls.append(("s204_api", ep)) # All machines · 12 subdomains subdomains = [ ("s95_main", "https://wevads.weval-consulting.com/"), ("blade_gitea", "https://git.weval-consulting.com/"), ("monitor", "https://monitor.weval-consulting.com/"), ("paperclip", "https://paperclip.weval-consulting.com/"), ("analytics", "https://analytics.weval-consulting.com/"), ("mattermost", "https://mm.weval-consulting.com/"), ("n8n", "https://n8n.weval-consulting.com/"), ("langfuse", "https://langfuse.weval-consulting.com/"), ("mirofish", "https://mirofish.weval-consulting.com/"), ("crm", "https://crm.weval-consulting.com/"), ] for t, url in subdomains: urls.append((t, url)) return urls discovered = discover() print(f"[GO-LIVE] {len(discovered)} URLs to test · all machines · all apps", flush=True) results = {"ts": TS, "out": str(OUT), "methodology": "GO-LIVE 100% 6σ · retry 3x · fine classification", "total_scenarios": len(discovered), "scenarios": []} BASE = "https://weval-consulting.com" def goto_with_retry(page, url, max_attempts=3): last_err = None for attempt in range(1, max_attempts + 1): try: resp = page.goto(url, wait_until="domcontentloaded", timeout=15000) http = resp.status if resp else None time.sleep(0.6) body_len = page.evaluate("document.body ? document.body.innerText.length : 0") title = page.title()[:60] # Retry only on 5xx (transient errors) if http and 500 <= http < 600 and attempt < max_attempts: time.sleep(1.5 * attempt) continue return http, body_len, title, attempt, None except Exception as e: last_err = e if attempt < max_attempts: time.sleep(1 * attempt) continue return None, 0, "", max_attempts, str(last_err)[:100] if last_err else None try: with sync_playwright() as p: browser = p.chromium.launch(headless=True, args=["--no-sandbox", "--disable-dev-shm-usage"]) ctx = browser.new_context( viewport={"width": 1600, "height": 1000}, record_video_dir=str(OUT), record_video_size={"width": 1600, "height": 1000}, ignore_https_errors=True, ) page = ctx.new_page() pc = ac = fc = ec = 0 total_ms = 0 for idx, (kind, path) in enumerate(discovered, 1): t0 = time.time() url = path if path.startswith("http") else f"{BASE}{path}" slug = f"{idx:03d}_{kind}_{path.replace('/','_').replace('?','_').replace('=','_').replace('.','_')[:50]}" entry = {"idx": idx, "kind": kind, "slug": slug, "url": url} http, body_len, title, attempts, err = goto_with_retry(page, url, max_attempts=3) entry["http"] = http entry["body_len"] = body_len entry["title"] = title entry["attempts"] = attempts if err: entry["error_msg"] = err entry["elapsed_ms"] = round((time.time() - t0) * 1000, 0) if idx % 8 == 0: try: page.screenshot(path=str(OUT / f"{slug[:60]}.png"), full_page=False) except: pass # Fine classification if http == 200 and body_len > 80: entry["status"] = "PASS"; pc += 1 elif http in (301, 302) or (http == 200 and body_len <= 80) or http in (401, 403): entry["status"] = "AUTH_GATE"; ac += 1 elif http == 404: entry["status"] = "FAIL"; fc += 1 elif http and 500 <= http < 600: entry["status"] = "FAIL"; fc += 1 elif http is None: entry["status"] = "ERROR"; ec += 1 else: entry["status"] = "AUTH_GATE"; ac += 1 # unknown 3xx total_ms += entry["elapsed_ms"] if idx % 20 == 0 or idx == len(discovered): print(f" [{idx}/{len(discovered)}] PASS={pc} AUTH={ac} FAIL={fc} ERR={ec}", flush=True) results["scenarios"].append(entry) ctx.close() browser.close() opp = len(discovered) strict_defects = fc + ec strict_dpmo = round((strict_defects / opp) * 1_000_000) if opp else 0 strict_sigma = "6σ (world-class)" if strict_dpmo <= 3.4 else "5σ" if strict_dpmo <= 230 else "4σ" if strict_dpmo <= 6210 else "3σ" if strict_dpmo <= 66807 else "<3σ" operational = pc + ac op_dpmo = round(((opp - operational) / opp) * 1_000_000) if opp else 0 op_sigma = "6σ (world-class)" if op_dpmo <= 3.4 else "5σ" if op_dpmo <= 230 else "4σ" if op_dpmo <= 6210 else "3σ" if op_dpmo <= 66807 else "<3σ" results["summary"] = { "pass": pc, "auth_gate": ac, "fail": fc, "error": ec, "total": opp, "pass_rate_pct": round((pc / opp) * 100, 2), "operational_rate_pct": round((operational / opp) * 100, 2), "strict_dpmo": strict_dpmo, "strict_sigma": strict_sigma, "operational_dpmo": op_dpmo, "operational_sigma": op_sigma, "avg_ms": round(total_ms / opp, 0) if opp else 0, "total_elapsed_ms": total_ms, } print(f"\n[GO-LIVE] PASS={pc} AUTH={ac} FAIL={fc} ERR={ec} / {opp}", flush=True) print(f"[STRICT] DPMO={strict_dpmo} · {strict_sigma}", flush=True) print(f"[OPERATIONAL] DPMO={op_dpmo} · {op_sigma} · rate={results['summary']['operational_rate_pct']}%", flush=True) except Exception as e: results["fatal_error"] = str(e) print(f"[FATAL] {e}", flush=True) with open(OUT / "golive-6s-results.json","w") as f: json.dump(results, f, indent=2) videos = list(OUT.glob("*.webm")) print(f"[VIDEO] {len(videos)} · {sum(v.stat().st_size for v in videos) // 1024 // 1024} MB") screens = list(OUT.glob("*.png")) print(f"[SCREENSHOTS] {len(screens)}") print(f"[OUT] {OUT}")