Files
baji-vc/scripts/finalize-emotion-release.sh

73 lines
5.7 KiB
Bash
Executable File

#!/bin/bash
# Explicit source-only release commit/push; no runtime, diagnostics or binary staging.
set -euo pipefail
cd "$(dirname "$0")/.."
[ "$(git branch --show-current)" = main ]
[ "$(git remote get-url origin)" = 'git@git.oops.school:heihei/baji-vc.git' ]
git merge-base --is-ancestor 19a7adccd9322986eb0646b165b9ce1cf2650cf2 HEAD
if [ -n "$(git diff --cached --name-only)" ]; then
echo 'Existing staged changes preserved; refusing mixed release commit.' >&2
exit 1
fi
python3 - <<'PY'
from pathlib import Path
import hashlib,json,runpy
root=Path.cwd();directory=root/'logs/voice-investigation'
load=lambda name:json.loads((directory/name).read_text())
release=load('release-emotion.json');probe=load('probe-emotion.json');deploy=load('gateway-emotion-deploy.json');client=load('client-emotion-tests.json')
assert release['version_name']=='0.5.1' and release['version_code']==9 and release['signature']=='apksigner_verified'
assert release['download_http_status']==200 and release['download_bytes']==release['bytes']
assert hashlib.sha256((root/release['apk']).read_bytes()).hexdigest()==release['sha256']
assert hashlib.sha256((root/'artifacts/lan-voice-v040-arm64-debug.apk').read_bytes()).hexdigest()=='5a6f88cb2f825dbcd5c7b8c1f212b369534bc53c49533e196fb5e9287902e934'
assert hashlib.sha256((root/'artifacts/lan-voice-v050-arm64-debug.apk').read_bytes()).hexdigest()=='da47f7a08f63a68fbb6dbe7fb3d803ee58b402de393112a32f92a63ad50c1f33'
assert probe['status']=='passed' and probe['downlink_bytes']>0 and probe['llm_chars']>0 and probe['drained_ack']
assert probe['emotion_count']==1 and probe['emotion_before_pcm'] and probe['tts_input_matches_body'] and probe['tts_requests']==1
assert deploy['status']=='deployed' and deploy['applied'] and deploy['health']=='ok' and client['status']=='passed'
assert deploy['environment_unchanged'] and load('reply-structure.json')['status']=='passed'
verification=load('provider-release-verified.json')
assert verification['status']=='passed' and verification['live_source_hashes_match'] and verification['private_environment_and_unit_unchanged']
for name,digest in deploy['hashes'].items():assert hashlib.sha256((root/'gateway'/name).read_bytes()).hexdigest()==digest,name
for name,digest in client['hashes'].items():assert hashlib.sha256((root/name).read_bytes()).hexdigest()==digest,name
manifest=load('gateway-baseline-git.json');assert manifest['commit']=='19a7adccd9322986eb0646b165b9ce1cf2650cf2'
source=json.loads((root/'gateway/SOURCE_MANIFEST.json').read_text())
for name,row in source['files'].items():assert hashlib.sha256((root/'gateway'/name).read_bytes()).hexdigest()==row['sha256'],name
scan=runpy.run_path('scripts/archive-gateway.py',run_name='archive_library')['scan']
for p in (root/'gateway').rglob('*'):
if p.is_file() and '__pycache__' not in p.parts:scan(str(p.relative_to(root/'gateway')),p.read_bytes())
print('Verified APK, bounded live pipeline, full gateway/client tests, canonical deployed source hashes; real phone remains untested')
PY
git diff --check
git add -- app/build.gradle app/src/main/java/com/gorios/lanvoice/MainActivity.kt \
app/src/main/java/com/gorios/lanvoice/audio/VoiceSession.kt \
app/src/main/java/com/gorios/lanvoice/dialogue/ReplyEmotion.kt app/src/main/java/com/gorios/lanvoice/diag/DiagnosticReportUpload.kt \
app/src/main/java/com/gorios/lanvoice/expression/ExpressionController.kt app/src/main/java/com/gorios/lanvoice/expression/CameraPermissionGate.kt \
app/src/main/java/com/gorios/lanvoice/expression/ExpressionState.kt \
app/src/main/java/com/gorios/lanvoice/expression/ExpressionUi.kt \
app/src/main/java/com/gorios/lanvoice/net/DialogueProtocol.kt \
gateway/gateway.py gateway/llm_provider.py gateway/reply_emotion.py gateway/SOURCE_MANIFEST.json gateway/README.md gateway/env.example gateway/scripts/check-archive.py \
gateway/tests/test_debug.py gateway/tests/test_continuity.py gateway/tests/test_reply_emotion.py gateway/tests/test_gateway_emotion.py gateway/tests/test_llm_provider.py \
tests/session/AudioDoubles.kt tests/session/ProtocolEvents.kt tests/session/ConnectionCheck.kt tests/protocol/ProtocolCheck.kt \
scripts/check-expression-rules.sh tests/expression/CameraPermissionCheck.kt scripts/check-reply-regressions.py scripts/check-reply-structure.py scripts/check-emotion-regressions.sh \
scripts/deploy-gateway-source.py scripts/rollback-gateway-source.py scripts/update-gateway-manifest.py scripts/deploy-gateway.py scripts/archive-gateway.py \
scripts/probe-reply-emotion.py scripts/package-emotion-release.sh scripts/finalize-emotion-release.sh \
docs/CAMERA_EMOTION_051.md docs/REPLY_EMOTION_050.md docs/PLAN.md
git diff --cached --check
python3 - <<'PY'
import subprocess
names=subprocess.check_output(['git','diff','--cached','--name-only'],text=True).splitlines()
assert names and all(n.startswith(('app/','gateway/','tests/','scripts/','docs/')) for n in names)
assert not any(any(x in n.split('/') for x in ('logs','artifacts','.runtime','__pycache__','models')) or n.endswith(('.pem','.key','.apk','.wav','.pcm','.pyc')) for n in names)
PY
git -c user.name=zenord -c user.email=zenord@email.com commit -m 'fix: preserve camera permission intent and distinguish unknown reply expression'
git push origin main
python3 - <<'PY'
import json,subprocess
from pathlib import Path
commit=subprocess.check_output(['git','rev-parse','HEAD'],text=True).strip()
remote=subprocess.check_output(['git','ls-remote','origin','refs/heads/main'],text=True).split()[0]
assert commit==remote
result={'commit':commit,'branch':'main','push':'verified','archive':'gateway/','version':'0.5.1','archive_baseline':'19a7adccd9322986eb0646b165b9ce1cf2650cf2'}
Path('logs/voice-investigation/git-emotion-release.json').write_text(json.dumps(result,indent=2)+'\n')
print(json.dumps(result,indent=2))
PY