Add bounded avatar rejection fields and task music ASR audit
This commit is contained in:
@@ -35,8 +35,12 @@ parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument('--suite', choices=[name for name, _, _ in suites])
|
||||
parser.add_argument('--runtime-manifest',type=Path,help='Additionally exercise real continuous parser with actual offline manifest metadata')
|
||||
parser.add_argument('--index-manifest',type=Path,help='Additionally admit an exact offline v2 index and each referenced runtime through production parsers; no activation')
|
||||
parser.add_argument('--metadata-only',action='store_true',help='Only the actual manifest admission, without repeating fixtures')
|
||||
parser.add_argument('--rejection-report',type=Path,help='New bounded structural field report; no raw values')
|
||||
args = parser.parse_args()
|
||||
if args.index_manifest and args.runtime_manifest: parser.error('Choose runtime or index manifest, not both')
|
||||
if args.metadata_only and not (args.index_manifest or args.runtime_manifest): parser.error('Actual manifest required')
|
||||
if args.rejection_report and (not args.index_manifest or args.rejection_report.exists()): parser.error('Index and new rejection report required')
|
||||
for name, main, real in suites:
|
||||
if args.suite and name != args.suite: continue
|
||||
with tempfile.TemporaryDirectory(prefix=f'lan-voice-{name}-') as out:
|
||||
@@ -86,17 +90,35 @@ for name, main, real in suites:
|
||||
extra=Path(out)/'ActualIndexCheck.kt'
|
||||
extra.write_text('import com.gorios.lanvoice.avatar.*\n'+''.join(definitions)+
|
||||
'fun main() {\nval root='+index_literal+'\nval runtimes='+runtime_literal+'\nval hashes='+hash_literal+'\n'+
|
||||
'val index=checkNotNull(EmotionActionManifest.read(root,"'+digest+'","'+digest+'","fixture/") { path,hash ->\n'+
|
||||
'check(hashes[path]==hash)\n@Suppress("UNCHECKED_CAST")\n'+
|
||||
'ContinuousAvatarManifest.read(runtimes[path] as Map<String,Any?>,hash,hash,true,"fixture/"+path.substringBeforeLast(47.toChar())+"/")\n})\n'+
|
||||
'val parsed=runtimes.mapValues { (path,value) ->\nval hash=hashes.getValue(path) as String\n'+
|
||||
'@Suppress("UNCHECKED_CAST")\nContinuousAvatarManifest.read(value as Map<String,Any?>,hash,hash,true,"fixture/"+path.substringBeforeLast(47.toChar())+"/",'+
|
||||
'onReject={ field -> println("REJECT_FIELD|"+path+"|"+field) })\n}\n'+
|
||||
'val index=checkNotNull(EmotionActionManifest.read(root,"'+digest+'","'+digest+'","fixture/",'+
|
||||
'onReject={ field -> println("REJECT_FIELD|manifest.json|"+field) }) { path,hash ->\n'+
|
||||
'check(hashes[path]==hash)\nparsed[path]\n})\n'+
|
||||
'check(index.packages.values.all { it.textureImages.size==it.body.frameCount*5 })\n'+
|
||||
('check(index.actionPack==null)\n' if not data['actions'] else 'check(index.actionPack?.assets?.size==2)\n')+
|
||||
'println("PASS: actual exported v2 index parsed by production Kotlin, exact hash '+digest+'; packages="+index.packages.size+" rgbaBytes="+index.packages.values.sumOf { it.rgbaBytes }+" danceAvailable="+(index.actionPack!=null))\n}\n')
|
||||
files.append(extra)
|
||||
subprocess.run([JAVA,'-cp',compiler,'org.jetbrains.kotlin.cli.jvm.K2JVMCompiler','-no-stdlib',
|
||||
'-no-reflect','-jvm-target','17','-nowarn','-classpath',cp,'-d',out, *map(str,files)],check=True,cwd=ROOT)
|
||||
subprocess.run([JAVA,'-cp',out+':'+cp,main],check=True,cwd=ROOT,timeout=30)
|
||||
if not args.metadata_only:
|
||||
subprocess.run([JAVA,'-cp',out+':'+cp,main],check=True,cwd=ROOT,timeout=30)
|
||||
if name == 'avatar' and args.runtime_manifest:
|
||||
subprocess.run([JAVA,'-cp',out+':'+cp,'ActualRuntimeCheckKt'],check=True,cwd=ROOT,timeout=30)
|
||||
if name == 'avatar' and args.index_manifest:
|
||||
subprocess.run([JAVA,'-cp',out+':'+cp,'ActualIndexCheckKt'],check=True,cwd=ROOT,timeout=30)
|
||||
result=subprocess.run([JAVA,'-cp',out+':'+cp,'ActualIndexCheckKt'],capture_output=True,text=True,cwd=ROOT,timeout=30)
|
||||
if args.rejection_report:
|
||||
rejects=[]
|
||||
for line in result.stdout.splitlines():
|
||||
if line.startswith('REJECT_FIELD|'):
|
||||
_,path,field=line.split('|',2)
|
||||
if len(rejects)<128: rejects.append({'file':path,'field':field,'code':'production_metadata_rejected'})
|
||||
args.rejection_report.parent.mkdir(parents=True,exist_ok=True)
|
||||
with args.rejection_report.open('x') as f:
|
||||
json.dump({'status':'passed' if result.returncode==0 else 'rejected','manifest_sha256':digest,
|
||||
'scope':'production_metadata_only_no_media_admission_no_activation','rejects':rejects},f,indent=2)
|
||||
f.write('\n')
|
||||
print(result.stdout,end='')
|
||||
if result.returncode: print('FAIL: production index admission; structural fields above, no raw metadata output',file=__import__('sys').stderr)
|
||||
result.check_returncode()
|
||||
|
||||
Reference in New Issue
Block a user