{"record":{"id":"8e026297845cd89d","repo":"nexu-io/open-design","slug":"running-left-mirror-source-hash-does-not-match-ima","errorCode":null,"errorMessage":"running-left mirror source hash does not match imagegen-jobs.json","messagePattern":"running-left mirror source hash does not match imagegen-jobs\\.json","errorType":"exception","errorClass":"SystemExit","httpStatus":null,"severity":"error","filePath":"skills/hatch-pet/scripts/finalize_pet_run.py","lineNumber":108,"sourceCode":"            \"use derive_running_left_from_running_right.py after visual review\"\n        )\n\n    expected_source_hash = job.get(\"source_sha256\")\n    expected_output_hash = job.get(\"output_sha256\")\n    if not isinstance(expected_source_hash, str) or not expected_source_hash:\n        raise SystemExit(\"running-left mirror job is missing source_sha256\")\n    if not isinstance(expected_output_hash, str) or not expected_output_hash:\n        raise SystemExit(\"running-left mirror job is missing output_sha256\")\n    if not source.is_file():\n        raise SystemExit(f\"running-left mirror source image no longer exists: {source}\")\n    if not output.is_file():\n        raise SystemExit(f\"running-left mirrored output is missing: {output}\")\n    if source.name != \"running-right.png\" or source.parent.name != \"decoded\":\n        raise SystemExit(\"running-left mirror source must be decoded/running-right.png\")\n    if output.name != \"running-left.png\" or output.parent.name != \"decoded\":\n        raise SystemExit(\"running-left mirror output must be decoded/running-left.png\")\n    if file_sha256(source) != expected_source_hash:\n        raise SystemExit(\"running-left mirror source hash does not match imagegen-jobs.json\")\n    if file_sha256(output) != expected_output_hash:\n        raise SystemExit(\n            \"running-left mirrored output hash does not match imagegen-jobs.json; \"\n            \"rerun derive_running_left_from_running_right.py\"\n        )\n    with Image.open(source) as source_image, Image.open(output) as output_image:\n        expected = ImageOps.mirror(source_image.convert(\"RGBA\"))\n        actual = output_image.convert(\"RGBA\")\n        if expected.size != actual.size or expected.tobytes() != actual.tobytes():\n            raise SystemExit(\n                \"running-left mirrored output is not an exact horizontal mirror of running-right\"\n            )\n\n\ndef validate_completed_job_source(\n    job: dict[str, object],\n    *,\n    run_dir: Path,","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/nexu-io/open-design/blob/5be4028344c2eb4c667c5a97bda8f750c5597ef7/skills/hatch-pet/scripts/finalize_pet_run.py#L90-L126","documentation":"Raised by validate_mirror_hash when the SHA-256 of the on-disk running-right.png (source) does not equal job['source_sha256'] recorded in imagegen-jobs.json. This detects post-generation mutation of the source strip that the mirror is supposed to derive from.","triggerScenarios":"file_sha256(source) != job['source_sha256'] for the running-left mirror job. Occurs if running-right.png was re-encoded, re-saved, or overwritten after the mirror job's hashes were recorded.","commonSituations":"Re-running the running-right imagegen job without updating the running-left mirror job's source_sha256; image editor that re-compressed the PNG; copying a different file over decoded/running-right.png.","solutions":["Re-generate decoded/running-right.png via the real $imagegen flow so its hash matches the recorded source_sha256.","If running-right.png was intentionally refreshed, re-derive running-left with derive_running_left_from_running_right.py so both source_sha256 and output_sha256 are recomputed.","Audit git/file mtimes to find what modified decoded/running-right.png after ingest."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import hashlib\ndef sha256(p):\n    h = hashlib.sha256()\n    with open(p, 'rb') as f:\n        for chunk in iter(lambda: f.read(1<<20), b''):\n            h.update(chunk)\n    return h.hexdigest()\nif sha256(source) != job['source_sha256']:\n    raise RuntimeError('running-right.png changed since mirror job was recorded')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never re-encode decoded/running-right.png after the mirror hashes are recorded.","When re-running the running-right imagegen job, re-derive running-left so source_sha256 stays consistent.","Treat the decoded/ directory as immutable between derive and finalize."],"tags":["integrity","sha256","mirror","pet-pipeline"],"backgroundTag":null,"analyzedSha":"5be4028344c2eb4c667c5a97bda8f750c5597ef7","analyzedAt":"2026-08-12T12:03:58.812Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}