Integrate corrected char expressions into Liam code36
This commit is contained in:
@@ -10,6 +10,7 @@ parser.add_argument('--apk',type=Path,required=True)
|
||||
parser.add_argument('--sha256',required=True)
|
||||
parser.add_argument('--startup-loader',action='store_true',help='Production background repository over actual APK bytes, isolated private receipt, no rendering/connection')
|
||||
parser.add_argument('--user-asset-candidate',action='store_true',help='Exact user-authorized correct03 APK; this offline replay uses local media callback doubles and does not assert network admission')
|
||||
parser.add_argument('--media-bundle',default='black-correct03',help='Trusted user-debug bundle, when --user-asset-candidate is set')
|
||||
args=parser.parse_args()
|
||||
assert hashlib.sha256(args.apk.read_bytes()).hexdigest()==args.sha256, 'APK hash drift'
|
||||
ROOT=Path(__file__).resolve().parents[1];script=ROOT/'scripts/check-reply-regressions.py'
|
||||
@@ -90,20 +91,25 @@ graphics=(ROOT/'tests/avatar/Graphics.kt').read_text();graphics=graphics.replace
|
||||
}
|
||||
''')
|
||||
build='''package com.gorios.lanvoice
|
||||
object BuildConfig { const val AVATAR_STARTUP_FIX=false;const val DEBUG=true;const val AVATAR_NATURAL=true;const val AVATAR_ENGINEERING=true;const val AVATAR_MOUTH_CANDIDATE=true
|
||||
object BuildConfig { const val STARTUP_POSTER_RES_ID=1;const val AVATAR_STARTUP_FIX=false;const val DEBUG=true;const val AVATAR_NATURAL=true;const val AVATAR_ENGINEERING=true;const val AVATAR_MOUTH_CANDIDATE=true
|
||||
const val EMOTION_MANIFEST_SHA="987e125a7d7a2cde99121b5f5246c82f4dbe36c4899d3d49eaffd1a68bafb887"
|
||||
const val NATURAL_MANIFEST_SHA="0a3c4918ba746019cf1df885bec66e5858a8950997dac4f64e7d37094be64dad"
|
||||
}'''
|
||||
if args.user_asset_candidate:
|
||||
import importlib.util
|
||||
spec=importlib.util.spec_from_file_location('user_startup',ROOT/'scripts/prepare-user-avatar-startup.py');asset_config=importlib.util.module_from_spec(spec);spec.loader.exec_module(asset_config)
|
||||
media=json.loads((ROOT/'manifests/character-build-profiles.json').read_bytes())['mediaBundles'][args.media_bundle]
|
||||
assert media.get('userAuthorizedDebug') is True
|
||||
asset_root=media['assetRoot'];basic_root=media['bootstrapRoot'];pin=media['indexSha256']
|
||||
with zipfile.ZipFile(args.apk) as archive:
|
||||
raw=archive.read('assets/'+asset_config.ASSET_ROOT+'manifest.json');assert hashlib.sha256(raw).hexdigest()==asset_config.PIN
|
||||
raw=archive.read('assets/'+asset_root+'manifest.json');assert hashlib.sha256(raw).hexdigest()==pin
|
||||
index=json.loads(raw);refs=[p['runtimeManifest'] for p in index['conversationPackages']]+[e['mouthRuntimeManifest'] for e in index['edges'] if 'mouthRuntimeManifest' in e]
|
||||
patch_count=sum(len(json.loads(archive.read('assets/'+asset_config.ASSET_ROOT+r['path']))['patches'])*5 for r in refs)
|
||||
build=build.replace('const val EMOTION_MANIFEST_SHA="987e125a7d7a2cde99121b5f5246c82f4dbe36c4899d3d49eaffd1a68bafb887"','const val EMOTION_MANIFEST_SHA="'+asset_config.PIN+'"')
|
||||
patch_count=sum(len(json.loads(archive.read('assets/'+asset_root+r['path']))['patches'])*5 for r in refs)
|
||||
fallback_row=next(p for p in index['conversationPackages'] if p['id']==index['fallbackPackageId'])
|
||||
fallback_frames=json.loads(archive.read('assets/'+asset_root+fallback_row['runtimeManifest']['path']))['body']['frameCount']
|
||||
build=build.replace('const val EMOTION_MANIFEST_SHA="987e125a7d7a2cde99121b5f5246c82f4dbe36c4899d3d49eaffd1a68bafb887"','const val EMOTION_MANIFEST_SHA="'+pin+'"')
|
||||
build=build.replace('const val AVATAR_STARTUP_FIX=false','const val AVATAR_STARTUP_FIX=true')
|
||||
build=build.replace('object BuildConfig {','object BuildConfig { const val AVATAR_USER_ASSET_CANDIDATE=true;const val EMOTION_ASSET_ROOT="'+asset_config.ASSET_ROOT+'";const val STARTUP_ASSET_ROOT="'+asset_config.BASIC_ROOT+'";const val STARTUP_MANIFEST_SHA="'+hashlib.sha256((ROOT/'manifests/startup-black-tulle-correct03.json').read_bytes()).hexdigest()+'";')
|
||||
build=build.replace('object BuildConfig {','object BuildConfig { const val AVATAR_USER_ASSET_CANDIDATE=true;const val EMOTION_ASSET_ROOT="'+asset_root+'";const val STARTUP_ASSET_ROOT="'+basic_root+'";const val STARTUP_MANIFEST_SHA="'+media['bootstrapSha256']+'";')
|
||||
else:
|
||||
patch_count=3185
|
||||
build=build.replace('object BuildConfig {','object BuildConfig { const val AVATAR_USER_ASSET_CANDIDATE=false;const val EMOTION_ASSET_ROOT="avatar/a01-expression-action-v1/";const val STARTUP_ASSET_ROOT="avatar/startup-white-01/";const val STARTUP_MANIFEST_SHA="461f5cfc10036de5f10ca3ce765fb8d9998697d3fd035aa9b1862d2ccfc3eaa2";')
|
||||
@@ -173,17 +179,17 @@ fun main(args: Array<String>) {
|
||||
println("EMOTION|requested=sad1|current=${binding.currentPackageId}|visual=${binding.visualStatus}")
|
||||
printTrace("happy_sad",trace);check(trace.none { it.second.actual=="media_failed" });check(binding.currentPackageId=="sad-01");view.dispose();TestScheduler.advanceBy(100)
|
||||
}
|
||||
for(initial in listOf(RoleEmotion.NEUTRAL,RoleEmotion.HAPPY)) {
|
||||
for(initial in listOf(RoleEmotion.NEUTRAL,RoleEmotion.HAPPY)) for(assetChoice in 0..1) {
|
||||
val(view,binding,trace)=rig();binding.intent(mediaReply(initial),false);TestScheduler.advanceBy(6000)
|
||||
var stop: ((Boolean)->Unit)?=null;val statuses=mutableListOf<ActionStatus>()
|
||||
val controller=ActionController(index.actionPack,binding,{TestScheduler.now},{stop=it},statuses::add,choose={0})
|
||||
val controller=ActionController(index.actionPack,binding,{TestScheduler.now},{stop=it},statuses::add,choose={assetChoice})
|
||||
check(controller.offer(ActionPlan("public_fixture_action_id_001",7,index.actionPack!!.manifestSha,120000)))
|
||||
println("DANCE|initial=${initial.wire}|offered=true|before_stop_players=${MediaPlayer.created.size}")
|
||||
stop!!(true);MediaPlayer.created.single().let { it.prepared!!(it) };TestScheduler.until(15000) { MediaPlayer.created.any { it.started } || trace.any { it.second.actual=="media_failed" } }
|
||||
val movie=MediaPlayer.created.single();println("DANCE|started=${movie.started}|current=${binding.currentPackageId}|status=${statuses.last().status}")
|
||||
val field=view.javaClass.getDeclaredField("textures").apply { isAccessible=true };val textures=field.get(view) as List<TextureView>
|
||||
val listener=textures[3].surfaceTextureListener!!;val surface=textures[3].surfaceTexture!!
|
||||
index.actionPack.assets.first().media!!.ptsUs.forEachIndexed { i,pts ->
|
||||
index.actionPack.assets[assetChoice].media!!.ptsUs.forEachIndexed { i,pts ->
|
||||
if(i>0) TestScheduler.advanceBy(42);surface.timestamp=pts*1000;listener.onSurfaceTextureUpdated(surface)
|
||||
if(i==0) {
|
||||
println("DANCE_LAYER|initial=${initial.wire}|first_frame_alpha=${textures[3].alpha}|body_alpha=${textures.take(3).map { it.alpha }}")
|
||||
@@ -193,7 +199,7 @@ fun main(args: Array<String>) {
|
||||
}
|
||||
check(textures[3].alpha==1f && textures.take(3).all { it.alpha==0f })
|
||||
}
|
||||
println("DANCE_OWNER|initial=${initial.wire}|frames=${index.actionPack.assets.first().media!!.ptsUs.size}|music_visible=${index.actionPack.assets.first().media!!.ptsUs.size}|conversation_visible=0|state=${binding.diagnosticState}")
|
||||
println("DANCE_OWNER|initial=${initial.wire}|asset=${index.actionPack.assets[assetChoice].id}|frames=${index.actionPack.assets[assetChoice].media!!.ptsUs.size}|music_visible=${index.actionPack.assets[assetChoice].media!!.ptsUs.size}|conversation_visible=0|state=${binding.diagnosticState}")
|
||||
TestScheduler.advanceBy(50);movie.completion!!(movie);TestScheduler.until(15000) { statuses.last().status!="started" }
|
||||
println("DANCE|ended=${statuses.last().status}|released=${movie.released}|return=${binding.currentPackageId}")
|
||||
printTrace("dance_${initial.wire}",trace);check(statuses.last().status=="completed");check(binding.currentPackageId=="neutral-01");view.dispose();TestScheduler.advanceBy(100)
|
||||
@@ -223,6 +229,26 @@ fun main(args: Array<String>) {
|
||||
println("STARTUP_REPOSITORY|mode=${args[2]}|main_asset_reads=0|patch_reads=$patchReads|same_process_reloads=0|packages=5|bridge_mouths=8|sensors=0|device=false")
|
||||
}
|
||||
'''
|
||||
if args.user_asset_candidate:
|
||||
fallback=index['fallbackPackageId']
|
||||
variants=[p['id'] for p in index['conversationPackages'] if p['emotion']=='neutral' and p['id']!=fallback]
|
||||
assert variants, 'idle-variant replay requires an actual neutral variant'
|
||||
variant_set='setOf('+','.join(json.dumps(x) for x in variants)+')'
|
||||
main=main.replace('it.second.actual.startsWith("body_idle-")','it.second.actual in '+
|
||||
'setOf('+','.join(json.dumps('body_'+x) for x in variants)+')')
|
||||
main=main.replace('binding.currentPackageId?.startsWith("idle-")==true','binding.currentPackageId in '+variant_set)
|
||||
main=main.replace('listOf("idle-breathe-01","idle-microshift-01")',
|
||||
'listOf('+','.join(json.dumps(x) for x in variants)+')')
|
||||
main=main.replace('neutral-01',fallback)
|
||||
for emotion in ('happy','sad'):
|
||||
actual=next(p['id'] for p in index['conversationPackages'] if p['emotion']==emotion)
|
||||
main=main.replace(emotion+'-01',actual)
|
||||
# A two-bridge reversal can wait a full fallback loop (145 frames in this pack).
|
||||
main=main.replace('TestScheduler.advanceBy(7000)','TestScheduler.advanceBy(15000)')
|
||||
startup_main=startup_main.replace('body.frameCount==97','body.frameCount=='+str(fallback_frames))
|
||||
startup_main=startup_main.replace('packages.size==5','packages.size=='+str(len(index['conversationPackages'])))
|
||||
startup_main=startup_main.replace('packages=5|bridge_mouths=8','packages='+str(len(index['conversationPackages']))+
|
||||
'|bridge_mouths='+str(sum('mouthRuntimeManifest' in e for e in index['edges'])))
|
||||
with tempfile.TemporaryDirectory(prefix='baji-runtime-audit-') as td:
|
||||
tmp=Path(td);files=[]
|
||||
for path in (ROOT/'tests/avatar').glob('*.kt'):
|
||||
|
||||
Reference in New Issue
Block a user