set -euo pipefail release=/home/ps/knowledge-v5-search-20260916 cd "$release" mkdir -m 700 payload tar -xzf payload.tar.gz -C payload python3 - <<'PY' from pathlib import Path import json,hashlib root=Path('/home/ps/knowledge-v5-search-20260916') manifest=json.loads((root/'manifest.json').read_text()) for row in manifest: data=(root/'payload'/row['path']).read_bytes() assert len(data)==row['bytes'] and hashlib.sha256(data).hexdigest()==row['sha256'],row['path'] print('Release files verified:',len(manifest),flush=True) PY docker exec -i im-admin-api-1 python -u - <<'PY' | tee "$release/backup-verification.json" from pathlib import Path import sqlite3,shutil,json,os,time folder=Path('/data/backups/knowledge-v5-search-20260916');folder.mkdir(mode=0o700) started=time.monotonic() source=sqlite3.connect('/data/backend.db',timeout=30) backup=sqlite3.connect(folder/'backend.db') try: source.execute('BEGIN');source.execute('SELECT COUNT(*) FROM sqlite_master').fetchone() source.backup(backup,pages=4096,sleep=0.05) finally: backup.close();source.close() with sqlite3.connect(f'file:{folder}/backend.db?mode=ro',uri=True) as checkdb: check=checkdb.execute('PRAGMA quick_check').fetchone()[0];assert check=='ok',check tables=['archive_message','archive_conversation','archive_person','archive_source_account','desktop_accounts','model_providers','users','knowledge_item','knowledge_job','knowledge_watch'] counts={t:checkdb.execute('SELECT COUNT(*) FROM '+t).fetchone()[0] for t in tables} os.chmod(folder/'backend.db',0o600) keys=[] for key in Path('/data').glob('*.key'): shutil.copy2(key,folder/key.name);os.chmod(folder/key.name,0o600);keys.append(key.name) assert keys,'Missing key backup' print(json.dumps({'backup':str(folder),'bytes':(folder/'backend.db').stat().st_size,'quick_check':check,'counts':counts,'key_files':keys,'seconds':round(time.monotonic()-started,1)}),flush=True) PY docker build --network=none -f Dockerfile.overlay -t zyt/wecom-admin:knowledge-v5-search-20260916 . 2>&1 | tee build.log docker run --rm --network=none --read-only --tmpfs /tmp:size=256m,mode=1777 zyt/wecom-admin:knowledge-v5-search-20260916 python -X utf8 -m unittest test_knowledge test_knowledge_tasks test_knowledge_model_output test_knowledge_review test_knowledge_search test_model_gateway -q 2>&1 | tee candidate-tests.log