#!/usr/bin/env python3 """Recalculate bounded results from retained raw evidence, without new execution. WHY: a fixture stop must not be upgraded to a demonstrated compositor defect. CONTRACT: retain failed raw gates and explicit NOT TESTED downstream cells. INVARIANT: never alter old results/manifests or refund experiment reservations. """ import argparse from collections import Counter import json from pathlib import Path import re from PIL import Image,ImageChops from support import REPO,save,sha p=argparse.ArgumentParser();p.add_argument('lab',type=Path);a=p.parse_args();lab=a.lab.resolve() assert not (lab/'results/evidence-sha256.txt').exists(),'sealed results are immutable' run=lab/'run';text=(run/'compositor.log').read_text();runtime=json.loads((lab/'results/static-runtime.json').read_text()) rows=[] for line in text.splitlines(): m=re.search(r"binding file (.*?) \[0\] to (.*?) \[0\].*symbol `([^']+)'",line) if m and 'libwlroots' in m[1] and m[3].startswith('wlr_scene_'): row={'consumer':m[1],'provider':m[2],'symbol':m[3]} if row not in rows:rows.append(row) binary=lab/'stage-static/usr/bin/swayfx-mosaic';own=[r for r in rows if r['provider']==str(binary)];wl=[r for r in rows if 'libwlroots' in r['provider']] assert len(rows)==34 and len(own)==31 and len(wl)==3 expected={'wlr_scene_subsurface_tree_create','wlr_scene_surface_try_from_buffer','wlr_scene_surface_create'} assert {r['symbol'] for r in wl}==expected save(lab,'runtime-bindings',{'status':'PASS','records':rows,'executable':31,'wlroots':3,'historical_pattern':'same 31/3 suppliers; full semantic ABI still unproven'}) renderer=[s for s in text.splitlines() if re.search(r'\[render/fx_renderer/fx_renderer.c:\d+\].*(Using OpenGL|GL vendor:|GL renderer:)',s)] save(lab,'renderer',{'observed':renderer,'requested_env':'WLR_RENDERER=pixman','actual':'SceneFX FX / OpenGL ES, AMD Radeon 780M; headless outputs, not pixman renderer'}) reference=Image.open(run/'h2-reference.png').convert('RGB');mosaic=Image.open(run/'h2-mosaic.png').convert('RGB');left=Image.open(run/'h1-mosaic.png').convert('RGB') # This fixed interior matches the mapped reference's IPC client bounds. The # comparison is supplemental evidence; it never replaces failed whole-H2 gate. events=[json.loads(x) for x in (run/'events.jsonl').read_text().splitlines()] trees=[e['result'] for e in events if e['kind']=='ipc' and e['args']==['-t','get_tree']] def nodes(n): yield n for child in n.get('nodes',[])+n.get('floating_nodes',[]):yield from nodes(child) refs=[n for n in nodes(trees[-1]) if n.get('app_id')=='org.mosaic.StaticReference' and n['rect']['x']>=0];assert len(refs)==1 ref=refs[0];rect=ref['rect'];win=ref['window_rect'];deco=ref['deco_rect'] # IPC rect/window_rect describe the standard reference content, while # applied Mosaic target geometry is retained separately from scene traces. x=rect['x']+win['x'];y=rect['y']+win['y'];box=(x,y,x+win['width'],y+win['height']) assert 0<=box[0]