PulseCanvas / app · pulsecanvas.ai / scripts / verify-onboarding-artifact.py
| 1 | #!/usr/bin/env python3 |
| 2 | """Verify bundled onboarding art and absence of capture/fixture hooks in Release.""" |
| 3 | import hashlib |
| 4 | import json |
| 5 | from pathlib import Path |
| 6 | import plistlib |
| 7 | import sys |
| 8 | |
| 9 | app = Path(sys.argv[1]).resolve() |
| 10 | mac = (app / "Contents/Info.plist").is_file() |
| 11 | info = plistlib.loads((app / ("Contents/Info.plist" if mac else "Info.plist")).read_bytes()) |
| 12 | resources = app / "Contents/Resources/Resources" if mac else app |
| 13 | art = resources / "Onboarding" |
| 14 | source = Path(__file__).resolve().parents[1] / "Sources/PulseCanvas/Resources/Onboarding" |
| 15 | expected = {p.name for p in source.glob("*.png")} |
| 16 | assert expected == {"welcome.png", "visuals.png", "studio.png", "share.png", "logo.png"} |
| 17 | assert {p.name for p in art.iterdir()} == expected |
| 18 | for 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" |
| 24 | binary = app / ("Contents/MacOS" if mac else "") / info["CFBundleExecutable"] |
| 25 | data = binary.read_bytes() |
| 26 | for 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}" |
| 28 | print(json.dumps({"version": info["CFBundleShortVersionString"], "build": info["CFBundleVersion"], |
| 29 | "exactOnboardingResources": True, "transparentIllustrations": True, "testHooksAbsent": True}, indent=2)) |