/** The body `./eddy crash submit` sends (Eddy eddyctl/crashes.py send()), for the crash report tests. */ import { createHash } from "node:crypto"; const sha = (b: Buffer) => createHash("sha256").update(b).digest("hex"); export function crashBody(over: Record = {}, contents: Record = { "report.ips": '{"app_name":"TikTokM"}\n{"exception":{"type":"EXC_CRASH"}}', "exception.txt": "*** Terminating app due to uncaught exception", "devicesim.log": "[devicesim] camera: dual", "events.jsonl": '{"type":"launch"}', }) { const files: Record = {}; const listed = Object.entries(contents).map(([name, text]) => { const bytes = Buffer.from(text); files[sha(bytes)] = bytes.toString("base64"); return { name, sha256: sha(bytes), bytes: bytes.length }; }); return { report: { schema: "eddy-crash-v1", id: "crash-20261021T084146-1a2b3c4d", created: "2026-10-21T15:41:50Z", task: "t-1", baseline: "tiktokm-47.0.0-470000-af7106c6", class: "app", confidence: "confirmed", reasons: ["崩溃栈第一个非系统帧在 App:MusicallyCore"], note: "空白任务也崩", signature: "missing-selector:KMPBridgeNUJExperimentManager:smallScreenOptEnabled", exception: { type: "EXC_CRASH", signal: "SIGABRT", name: "NSInvalidArgumentException", reason: "-[KMPBridgeNUJExperimentManager smallScreenOptEnabled]: unrecognized selector" }, stack: ["MusicallyCore kfun:NujPageScaffold"], app: { bundle: "com.zhiliaoapp.musically.ep", version: "47.0.0", build: "470000", executableUUID: "af7106c6" }, versions: { eddy: "2026.10.22-eddy-home.17", deviceSim: { mode: "release", version: "2026.10.21.1" }, macos: "macOS 26.6.2 (25G83)" }, launch: { env: ["DEVICESIM_CAMERA_MODE"], devicesim: { DEVICESIM_CAMERA_MODE: "mac" }, arguments: 0 }, task: { edits: 0, keys: [], engine: null, appCompatibility: [], adhocPatches: [] }, process: { pid: 1, generation: 1, uptimeSeconds: 60 }, restart: "restarted", files: listed, reporter: { machine: "0123456789abcdef", user: "someone" }, ...over }, files }; }