Branchwell

PulseCanvas / app · pulsecanvas.ai / scripts / verify-onboarding-artifact.py

Raw 1.5 KB on f7455f5645a899a3879cf752f3536fe6de471c90
1#!/usr/bin/env python3
2"""Verify bundled onboarding art and absence of capture/fixture hooks in Release."""
3import hashlib
4import json
5from pathlib import Path
6import plistlib
7import sys
8
9app = Path(sys.argv[1]).resolve()
10mac = (app / "Contents/Info.plist").is_file()
11info = plistlib.loads((app / ("Contents/Info.plist" if mac else "Info.plist")).read_bytes())
12resources = app / "Contents/Resources/Resources" if mac else app
13art = resources / "Onboarding"
14source = Path(__file__).resolve().parents[1] / "Sources/PulseCanvas/Resources/Onboarding"
15expected = {p.name for p in source.glob("*.png")}
16assert expected == {"welcome.png", "visuals.png", "studio.png", "share.png", "logo.png"}
17assert {p.name for p in art.iterdir()} == expected
18for name in expected:
19 data = (art / name).read_bytes()
20 assert hashlib.sha256(data).digest() == hashlib.sha256((source / name).read_bytes()).digest(), name
21 assert data.startswith(b"\x89PNG\r\n\x1a\n"), name
22 if name != "logo.png":
23 assert data[25] == 6, f"{name} must retain RGBA transparency"
24binary = app / ("Contents/MacOS" if mac else "") / info["CFBundleExecutable"]
25data = binary.read_bytes()
26for marker in [b"PCOnboardingQA", b"PCOnboardingStep", b"PCMobileFullSoundtrackQA", b"PCMobileQA", b"PCUITesting"]:
27 assert marker not in data, f"Release contains test hook: {marker!r}"
28print(json.dumps({"version": info["CFBundleShortVersionString"], "build": info["CFBundleVersion"],
29 "exactOnboardingResources": True, "transparentIllustrations": True, "testHooksAbsent": True}, indent=2))