chore: archive recoverable gateway source baseline

This commit is contained in:
zenord
2026-10-11 20:57:05 +08:00
parent 9b428fb76f
commit 19a7adccd9
58 changed files with 4060 additions and 0 deletions
+54
View File
@@ -0,0 +1,54 @@
#!/bin/bash
# Commit recoverable server source baseline only; no deployment or feature implementation.
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 9b428fb76ffa1468aa46124b33d9c598cf3740d8 HEAD
if [ -n "$(git diff --cached --name-only)" ]; then
echo 'Existing staged changes preserved; review them before this archive-only commit.' >&2
exit 1
fi
python3 - <<'PY'
import hashlib,json,runpy
from pathlib import Path
root=Path.cwd(); gateway=root/'gateway'
check=json.loads((root/'logs/voice-investigation/gateway-archive.json').read_text())
assert check['status']=='passed'
manifest=json.loads((gateway/'SOURCE_MANIFEST.json').read_text())
assert len(manifest['files']) >= 20
required=['gateway.py','guest_sessions.py','vad.py','history.py','persona_resolver.py','protocol.py','tts_debug.py','face_context.py','requirements.lock','tests/test_gateway.py','personas/lvbu.lorebook.json','personas/yangmi.lorebook.json']
assert all(name in manifest['files'] for name in required)
for name,row in manifest['files'].items():
assert hashlib.sha256((gateway/name).read_bytes()).hexdigest()==row['sha256'],name
scan=runpy.run_path('scripts/archive-gateway.py',run_name='archive_library')['scan']
for path in gateway.rglob('*'):
if not path.is_file(): continue
rel=path.relative_to(gateway)
if any(part in ('.runtime','.venv','venv','models','logs','tmp','__pycache__') for part in rel.parts): continue
assert path.suffix not in ('.pem','.key','.wav','.pcm','.mp3','.apk','.pyc'),str(rel)
scan(str(rel),path.read_bytes())
print(f'Verified complete gateway source baseline: {len(manifest["files"])} hashed files + portable restore/test helpers')
PY
git diff --check
git add -- gateway scripts/archive-gateway.py scripts/commit-gateway-baseline.sh
python3 - <<'PY'
import subprocess
names=subprocess.check_output(['git','diff','--cached','--name-only'],text=True).splitlines()
assert names
assert all(name.startswith('gateway/') or name in ('scripts/archive-gateway.py','scripts/commit-gateway-baseline.sh') for name in names), 'Unrelated staged changes preserved; refusing mixed commit'
assert not any('/.runtime/' in name or '/__pycache__/' in name for name in names)
PY
git diff --cached --check
git -c user.name=zenord -c user.email=zenord@email.com commit -m 'chore: archive recoverable gateway source baseline'
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/','android_baseline':'9b428fb76ffa1468aa46124b33d9c598cf3740d8'}
Path('logs/voice-investigation/gateway-baseline-git.json').write_text(json.dumps(result,indent=2)+'\n')
print(json.dumps(result,indent=2))
PY