UPDATED MASTER TELEMETRY FILE PACKAGING & AUTOMATED DOWNLOAD PIPELINE
# ================================================================================
# UPDATED MASTER TELEMETRY FILE PACKAGING & AUTOMATED DOWNLOAD PIPELINE
# ================================================================================
import os
import zipfile
import datetime
from google.colab import files
def package_and_download_workspace():
print("=" * 80)
print("🚀 INITIALIZING COMPLETE WORKSPACE PACKAGING & ARCHIVE EXTRACTION...")
print("=" * 80)
timestamp = datetime.datetime.now(datetime.timezone.utc).strftime("%Y%m%d_%H%M%S")
master_zip_name = f"/content/Model_C_Stage3_Complete_Suite_{timestamp}.zip"
# Core target array updated to explicitly capture our new markdown report file!
target_files = [
"/content/Model_C_Full_Prototype_Stage3_Validation_single.py",
"/content/Conclusions_and_Operational_Envelope_Report.md",
"/content/telemetry_stream.jsonl",
"/content/diagnostics_summary.json",
"/content/failure_atlas.json",
"/content/failure_atlas.pkl",
"/content/failure_summary.txt"
]
print("🔍 Scanning local disk for active CSV registries and sweep matrices...")
for file_name in os.listdir("/content"):
full_path = os.path.join("/content", file_name)
if os.path.isfile(full_path):
if file_name.startswith("stability_sweep_") and file_name.endswith(".json"):
target_files.append(full_path)
elif file_name.startswith("model_b_export_") and file_name.endswith(".json"):
target_files.append(full_path)
output_dir = "/content/output_20260719_002632"
if os.path.exists(output_dir):
for file_name in os.listdir(output_dir):
target_files.append(os.path.join(output_dir, file_name))
print(f"📦 Assembling Master Archive: {master_zip_name}")
print("-" * 80)
with zipfile.ZipFile(master_zip_name, 'w', zipfile.ZIP_DEFLATED) as zipf:
added_count = 0
for file_path in sorted(list(set(target_files))):
if os.path.exists(file_path):
arcname = os.path.basename(file_path)
if "output_20260719" in file_path:
arcname = os.path.join("output_numerical_eval", os.path.basename(file_path))
zipf.write(file_path, arcname=arcname)
print(f" ✓ Attached File -> {arcname:<45} ({os.path.getsize(file_path)} bytes)")
added_count += 1
print("-" * 80)
print(f"✅ Master Compression Complete. Total files locked inside zip: {added_count}")
print("📡 Launching automated download trigger handshake to local browser bar...")
print("=" * 80)
files.download(master_zip_name)
package_and_download_workspace()