Integrate reviewed full action pack admission and bounded idle scheduling
This commit is contained in:
@@ -252,10 +252,25 @@ def next_version(paths):
|
||||
return max([16,*codes])+1
|
||||
|
||||
|
||||
def tested_source():
|
||||
def reviewed_actions(index,pin,registry):
|
||||
"""External pin is necessary but never replaces production media validation."""
|
||||
require(registry is not None,'dance import/publication requires separately reviewed gateway capability admission; read-only gate supported')
|
||||
table=read_json(registry)
|
||||
expected={row['id']:(row['clip']['durationUs']+999)//1000 for row in index['actions']}
|
||||
require(set(expected)=={'asset_01','asset_02'} and all(row['kind']=='dance' and row['mouthAllowed'] is False for row in index['actions']),'reviewed dance shape')
|
||||
require(table.get(pin)==expected,'reviewed action pin/duration mismatch')
|
||||
return expected
|
||||
|
||||
|
||||
def tested_source(full=False):
|
||||
client=json.loads((ROOT/'logs/avatar-safe-061/client-tests.json').read_text())
|
||||
require(client['status']=='passed' and client['jvm_entry_points']==9,'client regression evidence')
|
||||
for name,digest in client['hashes'].items(): require(file_sha(ROOT/name)==digest,'untested source: '+name)
|
||||
if full:
|
||||
evidence=read_json(ROOT/'logs/action-emotion/full-release/checks.json')
|
||||
require(evidence['gateway_passed']==97 and evidence['gateway_skipped']==1 and evidence['offline_gles_goldens']==200 and evidence['packaging_passed']>=27,'full release regression evidence')
|
||||
for name,digest in evidence['hashes'].items(): require(file_sha(ROOT/name)==digest,'full release evidence drift: '+name)
|
||||
return
|
||||
evidence=json.loads((ROOT/'logs/action-emotion/bridge-talk/delivery.json').read_text())
|
||||
require(evidence['gateway_passed']==97 and evidence['gateway_skipped']==1 and evidence['offline_gles_goldens']==40,'gateway/GLES evidence')
|
||||
for name,digest in evidence['source_hashes'].items():
|
||||
@@ -268,18 +283,20 @@ def packaging_tests_current():
|
||||
for name,digest in evidence['hashes'].items(): require(file_sha(ROOT/name)==digest,'untested packaging source: '+name)
|
||||
|
||||
|
||||
def publish(report,output,requested):
|
||||
def publish(report,output,requested,full=False):
|
||||
require(all(edge.get('nativeLoop') is True or 'mouthRuntimeManifest' in edge for edge in read_json(ROOT/'app/src/main/assets'/ASSET_ROOT/'manifest.json')['edges']),
|
||||
'live emotion release needs bridge-own TALK runtimes')
|
||||
tested_source();packaging_tests_current();require(file_sha(ROLLBACK)==ROLLBACK_SHA,'rollback drift')
|
||||
tested_source(full);packaging_tests_current();require(file_sha(ROLLBACK)==ROLLBACK_SHA,'rollback drift')
|
||||
version=next_version((ROOT/'artifacts').glob('*.apk'))
|
||||
if requested is not None:
|
||||
require(requested>=version,'version code occupied');version=requested
|
||||
require(not full or version>=18,'full candidate needs code >=18')
|
||||
subprocess.run([str(ROOT/'scripts/build.sh'),'assembleDebug','compileDebugAndroidTestKotlin','-PavatarActionCandidate=true',
|
||||
'-PavatarNatural=true','-PavatarMouthCandidate=true','-PnaturalManifestSha='+LEGACY_PIN,
|
||||
'-PemotionManifestSha='+report['manifest_sha256'],'-PactionVersionCode='+str(version)],check=True,cwd=ROOT)
|
||||
'-PemotionManifestSha='+report['manifest_sha256'],'-PactionVersionCode='+str(version),'-PavatarFullActionCandidate='+str(full).lower()],check=True,cwd=ROOT)
|
||||
built=ROOT/'app/build/outputs/apk/debug/app-debug.apk';badge=badging(built)
|
||||
for text in ("name='com.gorios.lanvoice'",f"versionCode='{version}'","versionName='0.7.0-emotion-dev'","sdkVersion:'26'","targetSdkVersion:'34'"):
|
||||
version_name='0.7.0' if full else '0.7.0-emotion-dev'
|
||||
for text in ("name='com.gorios.lanvoice'",f"versionCode='{version}'",f"versionName='{version_name}'","sdkVersion:'26'","targetSdkVersion:'34'"):
|
||||
require(text in badge,'APK metadata: '+text)
|
||||
require(re.search(r'^native-code: (.+)$',badge,re.M)[1].strip()=="'arm64-v8a'",'APK ABI')
|
||||
cert=subprocess.check_output([str(TOOLS/'apksigner'),'verify','--verbose','--print-certs',str(built)],text=True)
|
||||
@@ -295,7 +312,8 @@ def publish(report,output,requested):
|
||||
config=ROOT/'app/build/generated/source/buildConfig/debug/com/gorios/lanvoice/BuildConfig.java'
|
||||
require('EMOTION_MANIFEST_SHA = "'+report['manifest_sha256']+'"' in config.read_text(),'compiled index pin mismatch')
|
||||
require(version>=next_version((ROOT/'artifacts').glob('*.apk')),'version became occupied during build')
|
||||
artifact=ROOT/f'artifacts/lan-voice-v070-emotion-candidate-code{version}-arm64-debug.apk'
|
||||
stem='action-emotion' if full else 'emotion-candidate'
|
||||
artifact=ROOT/f'artifacts/lan-voice-v070-{stem}-code{version}-arm64-debug.apk'
|
||||
with artifact.open('xb') as f,built.open('rb') as source: shutil.copyfileobj(source,f)
|
||||
digest=file_sha(artifact);checksum=f'{digest} {artifact.name}\n'.encode()
|
||||
with artifact.with_suffix('.apk.sha256').open('xb') as f: f.write(checksum)
|
||||
@@ -304,8 +322,8 @@ def publish(report,output,requested):
|
||||
with opener.open(url,timeout=30) as response: require(response.status==200 and sha(response.read())==digest,'HTTP APK bytes mismatch')
|
||||
with opener.open(url+'.sha256',timeout=15) as response: require(response.status==200 and response.read()==checksum,'HTTP checksum mismatch')
|
||||
require(file_sha(ROLLBACK)==ROLLBACK_SHA,'rollback modified')
|
||||
delivery={'status':'partial_emotion_candidate','version_name':'0.7.0-emotion-dev','version_code':version,'url':url,'sha256':digest,
|
||||
'certificate_sha256':CERT,'manifest_sha256':report['manifest_sha256'],'dance_available':False,'action_count':0,
|
||||
delivery={'status':'full_action_emotion_candidate' if full else 'partial_emotion_candidate','version_name':version_name,'version_code':version,'url':url,'sha256':digest,
|
||||
'certificate_sha256':CERT,'manifest_sha256':report['manifest_sha256'],'dance_available':full,'action_count':report['action_count'],
|
||||
'http_bytes_verified':True,'device':'not_run','naturalness':'not_certified','paid_calls':0,'gateway_deployed':False}
|
||||
(output/'delivery.json').write_text(json.dumps(delivery,indent=2)+'\n')
|
||||
return delivery
|
||||
@@ -320,12 +338,13 @@ def main():
|
||||
parser.add_argument('--previous-import-report',type=Path,help='Verified previous bundle-gate.json; requires --previous-pin and fresh backup')
|
||||
parser.add_argument('--previous-pin')
|
||||
parser.add_argument('--backup',type=Path)
|
||||
parser.add_argument('--action-registry',type=Path,help='Reviewed public gateway registry required for full dance release')
|
||||
parser.add_argument('--version-code',type=int,help='Default max existing APK code+1, minimum17')
|
||||
args=parser.parse_args();manifest=args.manifest.resolve(strict=True);output=args.output.resolve()
|
||||
require(not output.exists() and not output.is_relative_to(manifest.parent),'new evidence outside owner root required')
|
||||
if args.import_only or args.publish: require(args.pi_pin==args.sha256 and re.fullmatch('[0-9a-f]{64}',args.pi_pin or ''),'external Pi pin required')
|
||||
if args.import_only or args.publish:
|
||||
require(read_json(manifest)['actions']==[],'dance import/publication requires separately reviewed gateway capability admission; read-only gate supported')
|
||||
if read_json(manifest)['actions']: reviewed_actions(read_json(manifest),args.pi_pin,args.action_registry)
|
||||
output.mkdir(parents=True)
|
||||
report=check_bundle(manifest,args.sha256,output)
|
||||
if args.import_only or args.publish:
|
||||
@@ -337,7 +356,7 @@ def main():
|
||||
require(not args.previous_pin and not args.backup,'previous import report required')
|
||||
import_files(manifest.parent,report['files'],target)
|
||||
(output/'import.json').write_text(json.dumps({'externally_pinned_sha256':args.pi_pin,'files':len(report['files']),'naturalness':'not_certified'})+'\n')
|
||||
result=publish(report,output,args.version_code) if args.publish else {k:v for k,v in report.items() if k!='files'}
|
||||
result=publish(report,output,args.version_code,bool(report['action_count'])) if args.publish else {k:v for k,v in report.items() if k!='files'}
|
||||
print(json.dumps(result,indent=2))
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user