Enable exact correct03 dialogue dance and add standalone camera diagnostics
This commit is contained in:
@@ -9,7 +9,7 @@ parser=argparse.ArgumentParser(description=__doc__)
|
||||
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: network dance disabled; local media callbacks are doubles')
|
||||
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')
|
||||
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'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Exact user-authorized correct03 debug import/build; no Pi spoof or network dance admission.
|
||||
"""Exact user-authorized correct03 debug import/build; optional explicit network dance.
|
||||
Keep the separate Pi-reviewed white publication workflow unchanged. Owner media is read-only.
|
||||
"""
|
||||
import argparse, importlib.util, json, re, shutil, subprocess, urllib.request, zipfile
|
||||
@@ -15,11 +15,11 @@ OLD=ROOT/'artifacts/lan-voice-v0711-camera-matrix-code29-arm64-debug.apk'
|
||||
OLD_SHA='34905e98534d3b93b769717dd895183e2b06a87e70b564c0ac50c856f8ffa8de'
|
||||
require=pack.require
|
||||
|
||||
def authorization(pin,pi_pin=None,registry=None):
|
||||
def authorization(pin,pi_pin=None,registry=None,network_actions=False):
|
||||
require(pin==PIN,'exact user authorization required')
|
||||
require(pi_pin is None and registry is None,'user debug path cannot label Pi approval or install a dance registry')
|
||||
return {'authorization':'user_exact_revision_debug_integration','manifest_sha256':PIN,
|
||||
'independent_pi_pin':False,'network_dance_available':False,'music_listening':'not_run','device':'not_run'}
|
||||
'independent_pi_pin':False,'network_dance_available':network_actions,'music_listening':'not_run','device':'not_run'}
|
||||
|
||||
def verify_apk(apk,report):
|
||||
require(pack.file_sha(OLD)==OLD_SHA,'code29 rollback drift')
|
||||
@@ -40,26 +40,30 @@ def verify_apk(apk,report):
|
||||
if n.endswith('.mp4'):require(new.getinfo(n).compress_type==zipfile.ZIP_STORED,'compressed video')
|
||||
return {'runtime_referenced_files':len(actual),'retained_legacy_avatar_files':len(retained),'bootstrap_files':2,'all_avatar_files':len(paths(new)),'review_files_packaged':0}
|
||||
|
||||
def publish(report,output,version):
|
||||
def publish(report,output,version,network_actions=False):
|
||||
checks=pack.read_json(ROOT/'logs/black-tulle-correct03/checks.json')
|
||||
require(checks['status']=='passed' and checks['jvm_entry_points']==11 and checks['gateway_passed']>=110 and checks['gateway_skipped']==1 and checks['packaging_passed']>=48 and checks['gles_cases']>=200,'actual completed regression evidence required')
|
||||
for name,digest in checks['hashes'].items():require(pack.file_sha(ROOT/name)==digest,'untested source: '+name)
|
||||
require(version>=30 and version>=pack.next_version((ROOT/'artifacts').glob('*.apk')),'version occupied')
|
||||
flags=['-PavatarUserAssetCandidate=true','-PavatarActionCandidate=true','-PavatarNatural=true','-PavatarMouthCandidate=true',
|
||||
require(version>=(32 if network_actions else 30) and version>=pack.next_version((ROOT/'artifacts').glob('*.apk')),'version occupied')
|
||||
if network_actions:
|
||||
index=pack.read_json(ROOT/'app/src/main/assets'/startup.ASSET_ROOT/'manifest.json')
|
||||
pack.reviewed_actions(index,PIN,ROOT/'gateway/reviewed_action_packs.json')
|
||||
flags=['-PavatarUserNetworkActions='+str(network_actions).lower(),'-PavatarUserAssetCandidate=true','-PavatarActionCandidate=true','-PavatarNatural=true','-PavatarMouthCandidate=true',
|
||||
'-PnaturalManifestSha='+pack.LEGACY_PIN,'-PemotionManifestSha='+PIN,'-PactionVersionCode='+str(version)]
|
||||
flags += ['-P'+name+'=true' for name in ('avatarFullActionCandidate','avatarPlaybackClockFix','avatarStartupFix','presenceCandidate','faceDiagnosticsFix','cameraCompatibilityFix','cameraDirectYuv','cameraPreviewStream','cameraProbeDiagnostic')]
|
||||
subprocess.run([str(ROOT/'scripts/build.sh'),'assembleDebug','compileDebugAndroidTestKotlin',*flags],check=True,cwd=ROOT)
|
||||
built=ROOT/'app/build/outputs/apk/debug/app-debug.apk';badge=pack.badging(built)
|
||||
for value in ("name='com.gorios.lanvoice'",f"versionCode='{version}'","versionName='0.7.12'","sdkVersion:'26'","targetSdkVersion:'34'"):
|
||||
version_name='0.7.13' if network_actions else '0.7.12'
|
||||
for value in ("name='com.gorios.lanvoice'",f"versionCode='{version}'",f"versionName='{version_name}'","sdkVersion:'26'","targetSdkVersion:'34'"):
|
||||
require(value in badge,'APK metadata: '+value)
|
||||
require(re.search(r'^native-code: (.+)$',badge,re.M)[1].strip()=="'arm64-v8a'",'APK ABI')
|
||||
cert=subprocess.check_output([str(pack.TOOLS/'apksigner'),'verify','--verbose','--print-certs',str(built)],text=True)
|
||||
require(re.search(r'Signer #1 certificate SHA-256 digest: (\w+)',cert)[1]==pack.CERT,'same debug certificate required')
|
||||
inventory=verify_apk(built,report)
|
||||
config=(ROOT/'app/build/generated/source/buildConfig/debug/com/gorios/lanvoice/BuildConfig.java').read_text()
|
||||
for value in ('AVATAR_USER_ASSET_CANDIDATE = true','AVATAR_STARTUP_FIX = true','EMOTION_MANIFEST_SHA = "'+PIN+'"','EMOTION_ASSET_ROOT = "'+startup.ASSET_ROOT+'"','STARTUP_MANIFEST_SHA = "'+pack.file_sha(ROOT/'manifests/startup-black-tulle-correct03.json')+'"'):
|
||||
for value in ('AVATAR_NETWORK_ACTIONS_ALLOWED = '+str(network_actions).lower(),'AVATAR_USER_ASSET_CANDIDATE = true','AVATAR_STARTUP_FIX = true','EMOTION_MANIFEST_SHA = "'+PIN+'"','EMOTION_ASSET_ROOT = "'+startup.ASSET_ROOT+'"','STARTUP_MANIFEST_SHA = "'+pack.file_sha(ROOT/'manifests/startup-black-tulle-correct03.json')+'"'):
|
||||
require(value in config,'BuildConfig mismatch: '+value)
|
||||
artifact=ROOT/f'artifacts/lan-voice-v0712-black-tulle-correct03-code{version}-arm64-debug.apk'
|
||||
artifact=ROOT/f'artifacts/lan-voice-v{version_name.replace(".","")}-black-tulle-correct03-code{version}-arm64-debug.apk'
|
||||
with artifact.open('xb') as f,built.open('rb') as source:shutil.copyfileobj(source,f)
|
||||
digest=pack.file_sha(artifact);checksum=f'{digest} {artifact.name}\n'.encode()
|
||||
with artifact.with_suffix('.apk.sha256').open('xb') as f:f.write(checksum)
|
||||
@@ -67,8 +71,8 @@ def publish(report,output,version):
|
||||
opener=urllib.request.build_opener(urllib.request.ProxyHandler({}))
|
||||
with opener.open(url,timeout=30) as r:require(r.status==200 and pack.sha(r.read())==digest,'HTTP bytes mismatch')
|
||||
with opener.open(url+'.sha256',timeout=15) as r:require(r.status==200 and r.read()==checksum,'HTTP checksum mismatch')
|
||||
delivery={'status':'user_authorized_debug_asset_candidate','version_name':'0.7.12','version_code':version,'url':url,'sha256':digest,
|
||||
'certificate_sha256':pack.CERT,**authorization(PIN),**inventory,'combined_rgba_bytes':report['combined_rgba_bytes'],
|
||||
delivery={'status':'user_authorized_debug_asset_candidate','version_name':version_name,'version_code':version,'url':url,'sha256':digest,
|
||||
'certificate_sha256':pack.CERT,**authorization(PIN,network_actions=network_actions),**inventory,'combined_rgba_bytes':report['combined_rgba_bytes'],
|
||||
'http_bytes_verified':True,'gateway_deployed':False,'paid_calls':0,'naturalness':'not_certified'}
|
||||
(output/'delivery.json').write_text(json.dumps(delivery,indent=2)+'\n');return delivery
|
||||
|
||||
@@ -76,8 +80,9 @@ def main():
|
||||
parser=argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument('--manifest',type=Path,required=True);parser.add_argument('--user-authorized-sha',required=True)
|
||||
parser.add_argument('--output',type=Path,required=True);parser.add_argument('--import-only',action='store_true');parser.add_argument('--build',action='store_true')
|
||||
parser.add_argument('--enable-network-actions',action='store_true',help='Explicit user authorization to test normal dialogue dance with the exact registered pin; not music/device certification')
|
||||
parser.add_argument('--version-code',type=int,default=30);args=parser.parse_args()
|
||||
auth=authorization(args.user_authorized_sha);manifest=args.manifest.resolve(strict=True);out=args.output.resolve()
|
||||
auth=authorization(args.user_authorized_sha,network_actions=args.enable_network_actions);manifest=args.manifest.resolve(strict=True);out=args.output.resolve()
|
||||
require(not out.exists() and not out.is_relative_to(manifest.parent),'fresh evidence outside owner storage required')
|
||||
out.mkdir(parents=True)
|
||||
report=pack.check_bundle(manifest,PIN,out,user_authorized_debug=True)
|
||||
@@ -85,7 +90,7 @@ def main():
|
||||
pack.import_files(manifest.parent,report['files'],ROOT/'app/src/main/assets'/startup.ASSET_ROOT)
|
||||
basic=startup.prepare(manifest.parent)
|
||||
(out/'import.json').write_text(json.dumps({**auth,'files':len(report['files']),'asset_root':startup.ASSET_ROOT,'bootstrap':basic},indent=2)+'\n')
|
||||
result=publish(report,out,args.version_code) if args.build else report
|
||||
result=publish(report,out,args.version_code,args.enable_network_actions) if args.build else report
|
||||
print(json.dumps({k:v for k,v in result.items() if k not in ('files','runtime_packages')},indent=2))
|
||||
if __name__=='__main__':
|
||||
try:main()
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Verify/publish the sensor-only APK sharing production diagnostics; no device use."""
|
||||
import argparse
|
||||
import hashlib
|
||||
import json
|
||||
from pathlib import Path
|
||||
import re
|
||||
import shutil
|
||||
import subprocess
|
||||
import urllib.request
|
||||
import zipfile
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
TOOLS = Path('/home/ubuntu/android-build/sdk/build-tools/34.0.0')
|
||||
CERT = 'b9608336bc1ed1de3269bb4594f9fe718daaa5439511c5187aa385d2b799dcf1'
|
||||
SHARED = (
|
||||
'CameraDiagnosticsActivity.kt', 'expression/CameraProbeController.kt',
|
||||
'expression/CameraProbeState.kt', 'expression/CameraPreviewSurface.kt',
|
||||
'expression/FaceDiagnostics.kt', 'expression/FaceCueRules.kt',
|
||||
'expression/ExpressionRules.kt', 'expression/ExpressionState.kt',
|
||||
'expression/PresenceRules.kt', 'dialogue/ReplyEmotion.kt',
|
||||
'diag/DiagnosticLog.kt', 'diag/DiagnosticReportUpload.kt',
|
||||
)
|
||||
|
||||
def require(ok, reason):
|
||||
if not ok:
|
||||
raise RuntimeError(reason)
|
||||
|
||||
def digest(path):
|
||||
with path.open('rb') as stream:
|
||||
return hashlib.file_digest(stream, 'sha256').hexdigest()
|
||||
|
||||
def verify(apk):
|
||||
badge = subprocess.check_output([str(TOOLS/'aapt'), 'dump', 'badging', str(apk)], text=True)
|
||||
for value in ("name='com.gorios.lanvoice.cameraprobe'", "versionCode='1'",
|
||||
"versionName='camera-probe-0.1.0'", "sdkVersion:'26'", "targetSdkVersion:'34'"):
|
||||
require(value in badge, 'APK metadata: '+value)
|
||||
permissions = set(re.findall(r"^uses-permission: name='([^']+)'", badge, re.M))
|
||||
require(permissions == {'android.permission.CAMERA', 'android.permission.INTERNET',
|
||||
'com.gorios.lanvoice.cameraprobe.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION'},
|
||||
'unexpected permissions')
|
||||
native = re.search(r'^native-code: (.+)$', badge, re.M)
|
||||
require(native is not None and native[1].strip() == "'arm64-v8a'", 'unexpected native ABI')
|
||||
cert = subprocess.check_output([str(TOOLS/'apksigner'), 'verify', '--verbose', '--print-certs', str(apk)], text=True)
|
||||
require(re.search(r'Signer #1 certificate SHA-256 digest: (\w+)', cert)[1] == CERT, 'debug certificate drift')
|
||||
with zipfile.ZipFile(apk) as archive:
|
||||
paths = archive.namelist()
|
||||
require(not any(n.startswith('assets/') for n in paths), 'camera APK must contain no avatar/model assets')
|
||||
libraries = {n for n in paths if n.startswith('lib/')}
|
||||
require(libraries == {'lib/arm64-v8a/libandroidx.graphics.path.so',
|
||||
'lib/arm64-v8a/libimage_processing_util_jni.so',
|
||||
'lib/arm64-v8a/libsurface_util_jni.so'}, 'unexpected native dependency')
|
||||
dex = b''.join(archive.read(n) for n in paths if re.fullmatch(r'classes\d*\.dex', n))
|
||||
for klass in ('MainActivity', 'VoiceSession', 'ExpressionCameraManager',
|
||||
'ContinuousBodyRenderer', 'EmotionActionAvatarView'):
|
||||
require(('Lcom/gorios/lanvoice/'+klass+';').encode() not in dex and
|
||||
('Lcom/gorios/lanvoice/avatar/'+klass+';').encode() not in dex and
|
||||
('Lcom/gorios/lanvoice/expression/'+klass+';').encode() not in dex,
|
||||
'unexpected app component: '+klass)
|
||||
require(b'Lcom/google/mediapipe/' not in dex, 'face model dependency included')
|
||||
for klass in ('Lcom/gorios/lanvoice/CameraDiagnosticsActivity;',
|
||||
'Lcom/gorios/lanvoice/CameraProbeLauncherActivity;',
|
||||
'Lcom/gorios/lanvoice/expression/CameraProbeController;',
|
||||
'Lcom/gorios/lanvoice/diag/DiagnosticReportUpload;'):
|
||||
require(klass.encode() in dex, 'missing production diagnostic component: '+klass)
|
||||
staged = ROOT/'camera-probe/build/generated/sharedCameraSource'
|
||||
require({str(p.relative_to(staged)) for p in staged.rglob('*.kt')} == set(SHARED), 'shared source whitelist drift')
|
||||
sources = {}
|
||||
for name in SHARED:
|
||||
source = ROOT/'app/src/main/java/com/gorios/lanvoice'/name
|
||||
require((staged/name).read_bytes() == source.read_bytes(), 'shared source drift: '+name)
|
||||
sources[name] = digest(source)
|
||||
trust = ROOT/'camera-probe/build/generated/cameraTrust/res/raw/gateway_cert.pem'
|
||||
require(trust.read_bytes() == (ROOT/'app/src/main/res/raw/gateway_cert.pem').read_bytes(), 'gateway trust drift')
|
||||
return {'package': 'com.gorios.lanvoice.cameraprobe', 'version_name': 'camera-probe-0.1.0',
|
||||
'version_code': 1, 'min_sdk': 26, 'target_sdk': 34, 'certificate_sha256': CERT,
|
||||
'abi': 'arm64-v8a', 'assets': 0, 'microphone_permission': False,
|
||||
'shared_production_sources': sources, 'camera_tests': 7, 'device': 'not_run'}
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument('--output', type=Path, required=True, help='Fresh ignored delivery JSON path')
|
||||
parser.add_argument('--build', action='store_true')
|
||||
args = parser.parse_args()
|
||||
output = args.output.resolve()
|
||||
require(not output.exists() and output.is_relative_to(ROOT/'logs'), 'fresh ignored evidence path required')
|
||||
if args.build:
|
||||
subprocess.run([str(ROOT/'scripts/build.sh'), ':camera-probe:assembleDebug'], cwd=ROOT, check=True)
|
||||
built = ROOT/'camera-probe/build/outputs/apk/debug/camera-probe-debug.apk'
|
||||
report = verify(built)
|
||||
artifact = ROOT/'artifacts/lan-voice-camera-probe-v010-code1-debug.apk'
|
||||
require(not artifact.exists() and not artifact.with_suffix('.apk.sha256').exists(), 'published camera version occupied')
|
||||
with artifact.open('xb') as target, built.open('rb') as source:
|
||||
shutil.copyfileobj(source, target)
|
||||
sha = digest(artifact)
|
||||
checksum = f'{sha} {artifact.name}\n'.encode()
|
||||
with artifact.with_suffix('.apk.sha256').open('xb') as target:
|
||||
target.write(checksum)
|
||||
url = 'http://192.168.31.124:8080/'+artifact.name
|
||||
opener = urllib.request.build_opener(urllib.request.ProxyHandler({}))
|
||||
with opener.open(url, timeout=30) as response:
|
||||
require(response.status == 200 and hashlib.sha256(response.read()).hexdigest() == sha, 'HTTP APK bytes differ')
|
||||
with opener.open(url+'.sha256', timeout=15) as response:
|
||||
require(response.status == 200 and response.read() == checksum, 'HTTP checksum differs')
|
||||
report.update(status='camera_diagnostic_only', url=url, sha256=sha, bytes=artifact.stat().st_size,
|
||||
http_bytes_verified=True, paid_calls=0, model_calls=0)
|
||||
output.parent.mkdir(parents=True, exist_ok=True)
|
||||
output.write_text(json.dumps(report, indent=2)+'\n')
|
||||
print(json.dumps({k:v for k,v in report.items() if k!='shared_production_sources'}, indent=2))
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
@@ -2,7 +2,7 @@
|
||||
"""Finite model-free WS route replay of canonical deployed source in isolated localhost.
|
||||
No live phone/session/history, no inference, no fake pack approvals or live configuration.
|
||||
"""
|
||||
import json,subprocess
|
||||
import argparse,json,subprocess
|
||||
from pathlib import Path
|
||||
ROOT=Path(__file__).resolve().parents[1]
|
||||
REMOTE=r'''
|
||||
@@ -22,8 +22,7 @@ from history import History
|
||||
from guest_sessions import GuestSessions
|
||||
from tests_fake import FakeModel
|
||||
from action_protocol import configured_packs
|
||||
pin='987e125a7d7a2cde99121b5f5246c82f4dbe36c4899d3d49eaffd1a68bafb887'
|
||||
assert configured_packs()[pin]=={'asset_01':10042,'asset_02':10042}
|
||||
assert configured_packs()[pin]==durations
|
||||
async def main():
|
||||
with tempfile.TemporaryDirectory(prefix='startup-capabilities-probe-') as directory:
|
||||
history=History(Path(directory)/'public-empty.sqlite3');await history.initialize()
|
||||
@@ -66,11 +65,17 @@ print(json.dumps(asyncio.run(main())))
|
||||
stage_dir.cleanup()
|
||||
'''
|
||||
def main():
|
||||
parser=argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument('--pin',choices=['987e125a7d7a2cde99121b5f5246c82f4dbe36c4899d3d49eaffd1a68bafb887','208f703ed92bf795bfeb78a1cef89b67bed2e45da80038a56157fd1ecd4cfa93'],default='987e125a7d7a2cde99121b5f5246c82f4dbe36c4899d3d49eaffd1a68bafb887')
|
||||
parser.add_argument('--output',type=Path,default=ROOT/'logs/action-emotion/startup-074/capability-ws.json')
|
||||
args=parser.parse_args()
|
||||
if args.output.exists():raise SystemExit('Fresh output required')
|
||||
durations=json.loads((ROOT/'gateway/reviewed_action_packs.json').read_text())[args.pin]
|
||||
expected=json.loads((ROOT/'gateway/SOURCE_MANIFEST.json').read_text())['deployment_baseline']['files']
|
||||
payload='expected='+repr(expected)+'\n'+REMOTE
|
||||
payload='expected='+repr(expected)+'\npin='+repr(args.pin)+'\ndurations='+repr(durations)+'\n'+REMOTE
|
||||
result=subprocess.run(['ssh','-o','BatchMode=yes','-o','ConnectTimeout=5','gorios-spark-2@192.168.31.61','cd /home/gorios-spark-2/lan-voice && exec .venv/bin/python -'],input=payload.encode(),capture_output=True,timeout=25)
|
||||
if result.returncode:
|
||||
print('FAIL: isolated capability probe; remote exception suppressed, no live changes');raise SystemExit(1)
|
||||
report=json.loads(result.stdout);output=ROOT/'logs/action-emotion/startup-074/capability-ws.json'
|
||||
report=json.loads(result.stdout);report['manifest_sha256']=args.pin;report['action_durations_ms']=durations;output=args.output
|
||||
output.parent.mkdir(parents=True,exist_ok=True);output.write_text(json.dumps(report,indent=2)+'\n');print(json.dumps(report,indent=2))
|
||||
if __name__=='__main__':main()
|
||||
|
||||
Reference in New Issue
Block a user