Initial Beta build
All checks were successful
Validate and publish Kaleido / android (push) Successful in 2m27s

This commit is contained in:
Elijah 2026-10-24 09:09:55 -07:00
commit 2b585badac
65 changed files with 3535 additions and 0 deletions

117
scripts/repro_runtime.py Normal file
View file

@ -0,0 +1,117 @@
"""On-device regression loops for focus geometry, frame pacing, and episode replacement."""
import sys,time,re,json
from device import adb,OUT,screenshot
from verify_ui import key,snapshot,focus,labels,wait,focused,launch
def sections():
# The splash gates remote input; switch as soon as the first browsing frame is available.
# Initialization must remain independent of tab loading on slow servers.
adb('shell','am','force-stop','tv.kaleido.app')
adb('shell','am','start','-n','tv.kaleido.app/.MainActivity')
wait(lambda r:'Home' in labels(r) and labels(r).count('KALEIDO')==1,'Cold-start splash must finish')
key(22)
wait(lambda r:'Recently released' in labels(r),'Movies must finish loading after a startup tab switch')
focused('Movies');screenshot('cold-tabs-fixed')
key(22);wait(lambda r:'Next episodes' in labels(r),'TV recommendations must load');focused('TV Shows')
key(21);wait(lambda r:'Recently released' in labels(r),'Cached Movies must return');focused('Movies')
print('PASS startup tab switch, TV loading, and cached section return')
def controls():
adb('shell','am','force-stop','tv.kaleido.app')
adb('shell','am','start','-n','tv.kaleido.app/.MainActivity','--es','testTitleId','7599','--el','testOffset','90000','--ei','testMode','1')
time.sleep(9);key(127);focused('Play')
screenshot('direct-stream-episode')
key(4);wait(lambda r:not labels(r),'One Back must hide controls rather than only clearing focus')
key(23);focused('Play');key(126);time.sleep(6)
wait(lambda r:not labels(r),'Controls must auto-hide during playback')
key(4);wait(lambda r:'Continue Watching' in labels(r),'Back must exit hidden player')
print('PASS one-press Back, OK reveal, timed hide, and exit')
def browse():
launch();key(20)
if focus(snapshot()) in ('Play','Resume'):key(20)
wait(lambda r:focus(r) not in ('','Home','Play','Resume'),'Content focus')
adb('shell','dumpsys','gfxinfo','tv.kaleido.app','reset')
geometry=[]
for _ in range(5):
root=snapshot();node=next(n for n in root.iter('node') if n.get('focused')=='true')
bounds=list(map(int,re.findall(r'\d+',node.get('bounds'))))
geometry.append({'focus':focus(root),'bounds':bounds});key(22)
adb('shell','input','keyevent',*(['KEYCODE_DPAD_RIGHT']*15))
adb('shell','input','keyevent',*(['KEYCODE_DPAD_UP']*12))
stats=adb('shell','dumpsys','gfxinfo','tv.kaleido.app','framestats').decode(errors='replace')
(OUT/'browse-framestats.txt').write_text(stats)
(OUT/'browse-geometry.json').write_text(json.dumps(geometry,indent=2))
print(json.dumps(geometry),flush=True)
print('\n'.join(x for x in stats.splitlines() if any(k in x for k in ('Total frames','Janky frames','percentile','Missed Vsync'))),flush=True)
ys=[r['bounds'][1] for r in geometry]
assert max(ys)-min(ys)<=3,f'Horizontal navigation moved row vertically by {max(ys)-min(ys)}px'
print('PASS stable horizontal focus geometry')
p95=int(re.search(r'95th percentile: (\d+)ms',stats)[1])
assert p95<40,f'Browsing frame pacing regression: p95={p95}ms (target below 40ms)'
def episode():
from inspect_server import get
titles=get('/library/metadata/6115/allLeaves').get('Metadata',[])
item=titles[0];expected=str(titles[1]['ratingKey'])
adb('shell','am','force-stop','tv.kaleido.app')
adb('logcat','-c')
adb('shell','am','start','-n','tv.kaleido.app/.MainActivity','--es','testTitleId',str(item['ratingKey']),'--el','testOffset','90000','--ei','testMode','2')
time.sleep(9);key(127);focused('Play')
for _ in range(6):
if 'Next episode' in focus(snapshot()):break
key(22)
focused('Next episode');key(23);time.sleep(5)
logs=adb('logcat','-d','-t','700','-s','KaleidoPlayback:I','AndroidRuntime:E','*:S').decode(errors='replace')
(OUT/'episode-replacement.log').write_text(logs)
print(logs[-10000:],flush=True)
assert 'FATAL EXCEPTION' not in logs,'Next episode crashed Android runtime'
assert adb('shell','pidof','tv.kaleido.app').strip(),'Process exited'
assert re.search(r'topResumedActivity=.*tv\.kaleido\.app',adb('shell','dumpsys','activity','activities').decode(errors='replace')),'Lost foreground'
assert 'item='+expected in logs,'Next episode did not become the active player'
print('PASS next episode replaced player with expected title')
def postplay():
from inspect_server import get
item=get('/library/metadata/7599?includeMarkers=1')['Metadata'][0]
adb('shell','am','force-stop','tv.kaleido.app');adb('logcat','-c')
adb('shell','am','start','-n','tv.kaleido.app/.MainActivity','--es','testTitleId','7599','--el','testOffset',str(item['duration']-12000),'--ei','testMode','2')
deadline=time.monotonic()+45
while time.monotonic()<deadline:
time.sleep(1)
logs=adb('logcat','-d','-s','KaleidoPlayback:I','AndroidRuntime:E','*:S').decode(errors='replace')
if 'READY item=8594' in logs or 'FATAL EXCEPTION' in logs:break
(OUT/'postplay-ended.log').write_text(logs);print(logs[-8000:],flush=True)
assert 'FATAL EXCEPTION' not in logs,'Episode end crashed'
assert 'reason=ended' in logs,'Natural end did not open postplay'
assert 'AUTOPLAY starting next=8594' in logs,'Five-second countdown did not start next episode'
assert 'READY item=8594' in logs,'Autoplay did not reach READY'
print('PASS natural end -> five-second countdown -> next episode READY')
def credits():
from inspect_server import get
item=get('/library/metadata/7599?includeMarkers=1')['Metadata'][0]
marker=next(m for m in item['Marker'] if m['type']=='credits')
adb('shell','am','force-stop','tv.kaleido.app');adb('logcat','-c')
adb('shell','am','start','-n','tv.kaleido.app/.MainActivity','--es','testTitleId','7599','--el','testOffset',str(marker['startTimeOffset']+2000),'--ei','testMode','2')
time.sleep(6);key(127);focused('Play');key(19);focused('Playback timeline');key(19);focused('Skip credits')
screenshot('skip-credits-contrast');key(23)
deadline=time.monotonic()+8
while time.monotonic()<deadline:
time.sleep(.1)
ready=adb('logcat','-d','-s','KaleidoPlayback:I','*:S').decode(errors='replace')
if 'POSTPLAY focus=play' in ready:break
assert 'POSTPLAY focus=play' in ready,'Postplay initial action never received focus'
key(22);key(23)
wait(lambda r:'Autoplay off' in labels(r),'Autoplay cancellation')
screenshot('postplay-season-and-related');time.sleep(6)
root=snapshot();assert 'Up next' in labels(root),'Cancellation failed to keep postplay open'
assert 'Episodes in this season' in labels(root),'Season episodes absent'
assert 'Related shows' in labels(root),'Related shows absent'
logs=adb('logcat','-d','-s','KaleidoPlayback:I','AndroidRuntime:E','*:S').decode(errors='replace')
assert 'reason=skip-credits' in logs,'Skip credits did not open postplay'
assert 'AUTOPLAY starting' not in logs,'Cancelled autoplay still advanced'
(OUT/'postplay-cancel.log').write_text(logs)
print('PASS skip credits -> postplay, episode/related rows, cancellable autoplay')
globals()[sys.argv[1]]()