OUTPUT #737
PARÇA 4 / 4
TOPLAM: 132172 karakter | 2996 satır
BU PARÇA: 12172 karakter
eet": str(sheet.resolve()),
875: "contact_sheet_sha256": sheet_sha,
876- "repair_token": token,
877- "verification": declared.get("verification"),
878- }
879- state_path.write_text(json.dumps(obj, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")
880-
881- question = None
882- if obj.get("state") in {"repair_attempted", "verification_pending"}:
883- question = (
--
887- "verdict must be PASS or FAIL; verifier must be vision_analyze; "
888- "post_repair_semantic_verified must be a boolean; copy repair_token exactly."
889- )
890- brief_path = work / "vision_qa_brief.json"
891- brief = json.loads(brief_path.read_text(encoding="utf-8"))
892- brief["repair_verification_contract"] = {
893- "state": obj.get("state"),
894- "artifact_sha256": artifact_sha,
895: "contact_sheet_sha256": sheet_sha,
896- "repair_token": obj.get("repair_token"),
897- "required_post_repair_verdict": "vision_analyze PASS",
898- "claim_fixed_before_verified": False,
899- }
900- brief_path.write_text(json.dumps(brief, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")
901- return obj, question
902-
903-def parse_cli_args(argv=None):
--
1410- "creative_intent": m.get("creative_intent", {}),
1411- "performance_plan": m.get("performance_plan", {}),
1412- "directing_plan": m.get("directing_plan", {}),
1413- "audio_intent": m.get("audio_intent", {}),
1414- }, sort_keys=True, ensure_ascii=False))
1415- qa_meta = work / ".qa.json"
1416- cached_qa = False
1417-
1418: if qa_meta.exists() and (work / "final_contact_sheet.jpg").exists():
1419- try:
1420- cached_qa = json.loads(
1421- qa_meta.read_text(encoding="utf-8")
1422- ).get("sig") == qa_sig
1423- except Exception:
1424- pass
1425-
1426- if not cached_qa:
--
1451- "creative_status": "PENDING_FINAL_SEMANTIC_VISION_QA",
1452- "version": VERSION,
1453- "cached_tts": cached_tts,
1454- "cached_visual": cached_visual,
1455- "cached_final": cached_final,
1456- "cached_qa": cached_qa,
1457- "duration": probe_duration(final),
1458- "final": str(final),
1459: "contact_sheet": str(work / "final_contact_sheet.jpg"),
1460- "vision_qa_brief": str(work / "vision_qa_brief.json"),
1461- "vision_question": repair_vision_question or final_vision_question,
1462- "vision_question_mode": "repair_inline" if repair_vision_question else "canonical_sibling_file",
1463- "caption_plan": str(work / "caption_plan.json"),
1464- "caption_grouping_mode": caption_plan["grouping_mode"],
1465- "timing_plan": str(work / "timing_plan.json"),
1466- "video_md5": final_md5,
1467- "repair_state": repair_state.get("state"),
/home/hermes/.hermes/skills/media/shorts-core/scripts/test_shorts_fast_pipeline.py.pre-timing-lock-regressions-20260909-163506
161- final_target, "Return strict final JSON.", {"payoff": "shown"}
162- )
163- self.assertEqual(final_ref, f"@file:{final_target.resolve()}")
164- self.assertIn('"payoff": "shown"', final_target.read_text(encoding="utf-8"))
165-
166- def test_valid_receipt_short_circuits_unchanged_proof_without_new_question(self):
167- with tempfile.TemporaryDirectory() as td:
168- root = Path(td)
169: sheet = root / "proof_gate" / "proof_contact_sheet.jpg"
170- sheet.parent.mkdir()
171- sheet.write_bytes(b"accepted evidence")
172- receipt = sheet.parent / "proof_receipt.json"
173- manifest_path = root / "manifest.json"
174- manifest = {
175- "creative_intent": {
176- "promise": "visible promise",
177- "primary_visual_proof": "visible proof",
--
209- "frame_tolerance_sec": 1/30,
210- }), encoding="utf-8")
211-
212- receipt.write_text(json.dumps({
213- "pass": True,
214- "receipt_source": "shorts-production-guard/post_tool_call",
215- "verifier": "vision_analyze",
216- "fingerprint": guard.proof_fingerprint(manifest),
217: "contact_sheet": str(sheet),
218: "contact_sheet_sha256": guard.sha_file(sheet),
219- }), encoding="utf-8")
220-
221- result = guard.proof_check(manifest_path, sheet.parent)
222-
223- self.assertTrue(result["pass"])
224- self.assertFalse(result["vision_required"])
225- self.assertEqual(result["proof_status"], "already_accepted")
226- self.assertIsNone(result["vision_question"])
/home/hermes/.hermes/skills/media/shorts-core/scripts/production_guardrails.py.bak-p0-quality-20260907-202909
625-
626- if r.get("pass") is not True:
627- errors.append("PROOF_GATE_INVALID: receipt does not contain pass=true")
628- if r.get("verifier") != "vision_analyze":
629- errors.append("PROOF_GATE_INVALID: verifier must be vision_analyze")
630- if r.get("receipt_source") != "shorts-production-guard/post_tool_call":
631- errors.append("PROOF_GATE_INVALID: receipt was not issued by the vision post-tool hook")
632-
633: sheet = r.get("contact_sheet")
634: sheet_hash = r.get("contact_sheet_sha256")
635- if not isinstance(sheet, str) or not Path(sheet).exists():
636- errors.append("PROOF_GATE_INVALID: accepted proof contact sheet is missing")
637- elif not isinstance(sheet_hash, str) or sha_file(sheet) != sheet_hash:
638- errors.append("PROOF_GATE_STALE: accepted proof contact sheet changed after Vision verification")
639-
640- if r.get("fingerprint") != proof_fingerprint(data):
641- errors.append(
642- "PROOF_GATE_STALE: creative intent, proof candidates, or proof source changed after acceptance"
--
801- })
802-
803- missing_cover = sorted(required_cover - covered)
804- if missing_cover:
805- hard.append(
806- "proof_gate candidates do not cover required targets: " + ", ".join(missing_cover)
807- )
808-
809: sheet = wd / "proof_contact_sheet.jpg"
810- if proof_frames:
811- cols = 5
812- rows = max(1, (len(proof_frames) + cols - 1) // cols)
813- run([
814- FFMPEG, "-y", "-v", "error",
815- "-framerate", "1",
816- "-i", str(wd / "proof_frame_%03d.jpg"),
817- "-vf", f"tile={cols}x{rows}:margin=0:padding=0",
--
853- passed = not hard and bool(valid) and sheet.exists()
854-
855- pending_path = wd / "proof_pending.json"
856- if passed:
857- pending = {
858- "fingerprint": fingerprint,
859- "proof_token": proof_token,
860- "manifest": str(mp),
861: "contact_sheet": str(sheet.resolve()),
862: "contact_sheet_sha256": sha_file(sheet),
863- "receipt": str(receipt),
864- "created_at": time.time(),
865- }
866- pending_path.write_text(
867- json.dumps(pending, ensure_ascii=False, indent=2) + "\n",
868- encoding="utf-8"
869- )
870- else:
--
882- "notes must be a short string. "
883- "proof_token must be copied exactly."
884- )
885-
886- return {
887- "pass": passed,
888- "version": VERSION,
889- "fingerprint": fingerprint,
890: "proof_contact_sheet": str(sheet) if sheet.exists() else None,
891- "proof_qa_brief": str(brief_path),
892- "proof_pending": str(pending_path) if passed else None,
893- "vision_question": vision_question if passed else None,
894- "valid_candidates": len(valid),
895- "hard_failures": hard,
896- "next": (
897: "Call vision_analyze on proof_contact_sheet using vision_question. "
898- "A PASS receipt is issued automatically by the shorts-production-guard post_tool_call hook. "
899- "Never create a verdict or proof receipt manually."
900- if passed else "Repair proof candidates before any TTS/render work."
901- )
902- }
903-
904-
905-def proof_accept(*args, **kwargs):
/home/hermes/.hermes/skills/media/shorts-core/scripts/production_guardrails.py.bak-agentic-directing-20260907-014810
553-
554- if r.get("pass") is not True:
555- errors.append("PROOF_GATE_INVALID: receipt does not contain pass=true")
556- if r.get("verifier") != "vision_analyze":
557- errors.append("PROOF_GATE_INVALID: verifier must be vision_analyze")
558- if r.get("receipt_source") != "shorts-production-guard/post_tool_call":
559- errors.append("PROOF_GATE_INVALID: receipt was not issued by the vision post-tool hook")
560-
561: sheet = r.get("contact_sheet")
562: sheet_hash = r.get("contact_sheet_sha256")
563- if not isinstance(sheet, str) or not Path(sheet).exists():
564- errors.append("PROOF_GATE_INVALID: accepted proof contact sheet is missing")
565- elif not isinstance(sheet_hash, str) or sha_file(sheet) != sheet_hash:
566- errors.append("PROOF_GATE_STALE: accepted proof contact sheet changed after Vision verification")
567-
568- if r.get("fingerprint") != proof_fingerprint(data):
569- errors.append(
570- "PROOF_GATE_STALE: creative intent, proof candidates, or proof source changed after acceptance"
--
723- })
724-
725- missing_cover = sorted(required_cover - covered)
726- if missing_cover:
727- hard.append(
728- "proof_gate candidates do not cover required targets: " + ", ".join(missing_cover)
729- )
730-
731: sheet = wd / "proof_contact_sheet.jpg"
732- if proof_frames:
733- cols = 5
734- rows = max(1, (len(proof_frames) + cols - 1) // cols)
735- run([
736- FFMPEG, "-y", "-v", "error",
737- "-framerate", "1",
738- "-i", str(wd / "proof_frame_%03d.jpg"),
739- "-vf", f"tile={cols}x{rows}:margin=0:padding=0",
--
775- passed = not hard and bool(valid) and sheet.exists()
776-
777- pending_path = wd / "proof_pending.json"
778- if passed:
779- pending = {
780- "fingerprint": fingerprint,
781- "proof_token": proof_token,
782- "manifest": str(mp),
783: "contact_sheet": str(sheet.resolve()),
784: "contact_sheet_sha256": sha_file(sheet),
785- "receipt": str(receipt),
786- "created_at": time.time(),
787- }
788- pending_path.write_text(
789- json.dumps(pending, ensure_ascii=False, indent=2) + "\n",
790- encoding="utf-8"
791- )
792- else:
--
804- "notes must be a short string. "
805- "proof_token must be copied exactly."
806- )
807-
808- return {
809- "pass": passed,
810- "version": VERSION,
811- "fingerprint": fingerprint,
812: "proof_contact_sheet": str(sheet) if sheet.exists() else None,
813- "proof_qa_brief": str(brief_path),
814- "proof_pending": str(pending_path) if passed else None,
815- "vision_question": vision_question if passed else None,
816- "valid_candidates": len(valid),
817- "hard_failures": hard,
818- "next": (
819: "Call vision_analyze on proof_contact_sheet using vision_question. "
820- "A PASS receipt is issued automatically by the shorts-production-guard post_tool_call hook. "
821- "Never create a verdict or proof receipt manually."
822- if passed else "Repair proof candidates before any TTS/render work."
823- )
824- }
825-
826-
827-def proof_accept(*args, **kwargs):
root@213-238-170-219:~#