"""Private theme rollback and named workload adapter for one owned board trial.""" from pathlib import Path import base64,hashlib,importlib.util,json,os,pwd,shutil,subprocess,sys,time root=Path(__file__).parent;code=Path('/run/k230-source3-paired12-code-20261021-attempt4');sys.path.insert(0,str(code/'tools')) s=importlib.util.spec_from_file_location('trial',code/'tools/handheld-theme-trial.py');trial=importlib.util.module_from_spec(s);s.loader.exec_module(trial) from theme_transaction import _pointer,_public_links from theme_preferences import _read def env_now(): end=time.monotonic()+60 while time.monotonic()end:raise time.sleep(.5) prefs,_=_read(state);before=base64.b64decode(snap['preferences']) if snap['preferences'] else None;assert prefs==before assert str(_pointer(state))==snap['previous'];app=trial.app_pointer(state);assert (str(app) if app else None)==snap['app_appearance'] print(json.dumps({'theme_restored':True,'generation':_pointer(state).name,'preferences_sha256':hashlib.sha256(prefs or b'').hexdigest(),'preferences_bytes':len(prefs or b''),'app_appearance_generation':app.name if app else None})) else:raise RuntimeError('unknown private theme adapter mode')