Files
weval-l99/v140b_proof.py
2026-04-24 04:38:58 +02:00

61 lines
2.6 KiB
Python

#!/usr/bin/env python3
"""V140b E2E - NR live from /api/l99-honest.php (200/201 green, not stale snapshot)"""
import asyncio, json, os
from playwright.async_api import async_playwright
OUT = "/var/www/html/api/blade-tasks/v140b-nr-live-proof"
os.makedirs(OUT, exist_ok=True)
async def main():
async with async_playwright() as p:
browser = await p.chromium.launch(headless=True, args=['--no-sandbox'])
ctx = await browser.new_context(viewport={'width':1920,'height':1080})
page = await ctx.new_page()
errs = []
page.on('pageerror', lambda e: errs.append(str(e)))
await page.goto("https://weval-consulting.com/all-ia-hub.html?v=v140b", wait_until='load', timeout=30000)
await page.wait_for_timeout(3500) # wait for both fetches
state = await page.evaluate("""() => {
const nr = document.getElementById('v140-nonreg');
const aut = document.getElementById('v140-autonomy');
return {
nonreg_html: nr?.innerHTML,
nonreg_text: nr?.textContent,
nonreg_title: nr?.title,
autonomy_text: aut?.textContent
};
}""")
print("V140b state:", json.dumps(state, indent=2))
await page.screenshot(path=f"{OUT}/01-live-nr.png", clip={'x':0,'y':0,'width':1920,'height':120})
await ctx.close()
await browser.close()
# NR live should be 200/201 (from l99-honest.php), color green
is_live = '200/201' in (state['nonreg_text'] or '') or '199/201' in (state['nonreg_text'] or '') or '201/201' in (state['nonreg_text'] or '')
not_stale = 'snapshot' not in (state['nonreg_html'] or '').lower()
green_color = '#10b981' in (state['nonreg_html'] or '')
title_live = 'live' in (state['nonreg_title'] or '').lower()
verdict = 'OK' if (is_live and not_stale and title_live and not errs) else 'PARTIAL'
report = {
'v140b': 'nr-live-fetch',
'nonreg_live_data': is_live,
'no_snapshot_label': not_stale,
'title_mentions_live': title_live,
'green_color_for_good_score': green_color,
'nonreg_preview': state['nonreg_text'],
'nonreg_title_preview': state['nonreg_title'],
'autonomy_intact': 'GODMODE' in (state['autonomy_text'] or ''),
'js_errors': errs,
'VERDICT': verdict
}
with open(f"{OUT}/proof.json",'w') as f: json.dump(report, f, indent=2)
print("=== VERDICT:", verdict)
print(json.dumps(report, indent=2))
asyncio.run(main())