"operational_tier": res_nm["operational_tier"], "legacy_passed": (res_nm.get("legacy_result_summary") or {}).get("legacy_evaluator_passed"), "legacy_tier": (res_nm.get("legacy_result_summary") or {}).get("lot_release_readiness_tier"), "legacy_resolved_pvid": (res_nm.get("legacy_result_summary") or {}).get("resolved_product_variant_id"), "gate0v_passed": (res_nm.get("gate0v_result_summary") or {}).get("gate0v_evaluator_passed"), "gate0v_verdict": (res_nm.get("gate0v_result_summary") or {}).get("verdict"), "expected_token": "HOLD_COMPOSITE_NONCANONICAL_OR_NONFINITE_PAYLOAD", "exit_code": 2 if ok_nm else -1, "hard_stops": res_nm["hard_stops"][:2], "holds": res_nm["holds"][:3], "passed": ok_nm, }) # ------------------------------------------------------------------ # Round-10 Final-Closure Regressions (R10-B1 Coupled NW-08 Binding & R10-B2 Structured Type/Range Holds) # ------------------------------------------------------------------ clin_ev_sha = v38._valid_digest("r10_b1_clinical_respirometry_raw_v1") clin_r2_bundle = _make_composite_bundle( clin_lot_id, mcb_id, pv_lead, leg_clin, g0v_clin, nw08_route_id="R2_DZ40", nw08_measurement_evidence_sha256=clin_ev_sha, nw08_measurement_not_before_utc="2026-11-28T00:00:00Z", ) clin_r1_bundle = _make_composite_bundle( clin_lot_id, mcb_id, pv_lead, leg_clin, g0v_clin, nw08_route_id="R1_350_stress", nw08_measurement_evidence_sha256=clin_ev_sha, nw08_measurement_not_before_utc="2026-11-28T00:00:00Z", ) clin_r2_f = Path(td) / "r10_b1_clin_r2.json" clin_r2_f.write_text(json.dumps(clin_r2_bundle, sort_keys=True), encoding="utf-8") clin_r1_f = Path(td) / "r10_b1_clin_r1.json" clin_r1_f.write_text(json.dumps(clin_r1_bundle, sort_keys=True), encoding="utf-8") clin_noroute_f = Path(td) / "r10_b1_clin_noroute.json" clin_noroute_f.write_text(json.dumps(clin_bundle, sort_keys=True), encoding="utf-8") # 64. R10-B1a: Clinical LOT_RELEASE_SURROGATE lot declaring R2_DZ40 + matched passing bound OCR -> PASS (exit 0)! clin_ocr_r2_pass = v38.build_bound_nw08_ocr_record( lot_id=clin_lot_id, mcb_id=mcb_id, product_variant_id=pv_lead, route_id="R2_DZ40", lot_payload_sha256=clin_r2_bundle["payload_sha256"], measured_ocr=1.3164, uncertainty_se=0.0, measurement_record_id="OCR-CLIN-R2-PASS-001", measurement_evidence_sha256=clin_ev_sha, measurement_timestamp_utc="2026-11-29T01:00:00Z", ) clin_ocr_r2_f = Path(td) / "r10_b1_ocr_clin_r2_pass.json" clin_ocr_r2_f.write_text(json.dumps(clin_ocr_r2_pass, sort_keys=True), encoding="utf-8") res_64, rc_64 = evaluate_composite_lot_file( clin_r2_f, legacy_evaluator=leg_fn, gate0v_evaluator=g0v_fn, trusted_qualification_store=trusted_store, openislet_root=openislet_root, nw08_ocr_json_path=clin_ocr_r2_f, ) ok_64 = bool( rc_64 == 0 and res_64["composite_verdict"] == "PASS_COMPOSITE_CLINICAL_RELEASE" and (res_64.get("nw08_measured_ocr_dispatch_result") or {}).get("lot_binding_verified") is True and (res_64.get("nw08_measured_ocr_dispatch_result") or {}).get("solver_executed") is True and (res_64.get("nw08_measured_ocr_dispatch_result") or {}).get("route_id") == "R2_DZ40" ) cases.append({ "case": "r10_b1a_coupled_clinical_lot_matched_passing_bound_ocr_passes_exit_0", "expected_verdict": "PASS_COMPOSITE_CLINICAL_RELEASE", "actual_verdict": res_64["composite_verdict"], "operational_tier": res_64["operational_tier"], "legacy_passed": (res_64.get("legacy_result_summary") or {}).get("legacy_evaluator_passed"), "legacy_tier": (res_64.get("legacy_result_summary") or {}).get("lot_release_readiness_tier"), "legacy_resolved_pvid": (res_64.get("legacy_result_summary") or {}).get("resolved_product_variant_id"), "gate0v_passed": (res_64.get("gate0v_result_summary") or {}).get("gate0v_evaluator_passed"), "gate0v_verdict": (res_64.get("gate0v_result_summary") or {}).get("verdict"), "expected_token": None, "exit_code": rc_64, "hard_stops": res_64["hard_stops"][:2], "holds": res_64["holds"][:2], "passed": ok_64, }) # 65. R10-B1b: Exact Round-09 route-swap exploit — clinical lot declares R1_350_stress, sidecar # claims R2_DZ40 (even with matching lot/MCB/product/lot_payload_sha256/self-digest) -> HOLD exit 2! clin_ocr_swap = v38.build_bound_nw08_ocr_record( lot_id=clin_lot_id, mcb_id=mcb_id, product_variant_id=pv_lead, route_id="R2_DZ40", lot_payload_sha256=clin_r1_bundle["payload_sha256"], measured_ocr=1.3164, uncertainty_se=0.0, measurement_record_id="OCR-CLIN-SWAP-R2", measurement_evidence_sha256=clin_ev_sha, measurement_timestamp_utc="2026-11-29T01:00:00Z", ) clin_ocr_swap_f = Path(td) / "r10_b1_ocr_swap.json" clin_ocr_swap_f.write_text(json.dumps(clin_ocr_swap, sort_keys=True), encoding="utf-8") res_65, rc_65 = evaluate_composite_lot_file( clin_r1_f, legacy_evaluator=leg_fn, gate0v_evaluator=g0v_fn, trusted_qualification_store=trusted_store, openislet_root=openislet_root, nw08_ocr_json_path=clin_ocr_swap_f, ) ok_65 = bool( rc_65 == 2 and res_65["composite_verdict"] == "HOLD_COMPOSITE_RELEASE" and "HOLD_NW08_COUPLED_ROUTE_ID_MISMATCH" in res_65["holds"] and (res_65.get("nw08_measured_ocr_dispatch_result") or {}).get("lot_binding_verified") is False and (res_65.get("nw08_measured_ocr_dispatch_result") or {}).get("solver_executed") is False ) cases.append({ "case": "r10_b1b_coupled_clinical_lot_route_swap_r1_350_to_r2_dz40_held_exit_2", "expected_verdict": "HOLD_COMPOSITE_RELEASE", "actual_verdict": res_65["composite_verdict"], "operational_tier": res_65["operational_tier"], "legacy_passed": (res_65.get("legacy_result_summary") or {}).get("legacy_evaluator_passed"), "legacy_tier": (res_65.get("legacy_result_summary") or {}).get("lot_release_readiness_tier"), "legacy_resolved_pvid": (res_65.get("legacy_result_summary") or {}).get("resolved_product_variant_id"), "gate0v_passed": (res_65.get("gate0v_result_summary") or {}).get("gate0v_evaluator_passed"), "gate0v_verdict": (res_65.get("gate0v_result_summary") or {}).get("verdict"), "expected_token": "HOLD_NW08_COUPLED_ROUTE_ID_MISMATCH", "exit_code": rc_65, "hard_stops": res_65["hard_stops"][:2], "holds": res_65["holds"][:3], "passed": ok_65, }) # 66. R10-B1c: Matched failing R1_350_stress bound OCR record (1.3164 -> 14.8446 mmHg < 15.0) -> FAIL exit 3! clin_ocr_r1_fail = v38.build_bound_nw08_ocr_record( lot_id=clin_lot_id, mcb_id=mcb_id, product_variant_id=pv_lead, route_id="R1_350_stress", lot_payload_sha256=clin_r1_bundle["payload_sha256"], measured_ocr=1.3164, uncertainty_se=0.0, measurement_record_id="OCR-CLIN-R1-FAIL-001", measurement_evidence_sha256=clin_ev_sha, measurement_timestamp_utc="2026-11-29T01:00:00Z", ) clin_ocr_r1_fail_f = Path(td) / "r10_b1_ocr_clin_r1_fail.json" clin_ocr_r1_fail_f.write_text(json.dumps(clin_ocr_r1_fail, sort_keys=True), encoding="utf-8") res_66, rc_66 = evaluate_composite_lot_file( clin_r1_f, legacy_evaluator=leg_fn, gate0v_evaluator=g0v_fn, trusted_qualification_store=trusted_store, openislet_root=openislet_root, nw08_ocr_json_path=clin_ocr_r1_fail_f, ) ok_66 = bool( rc_66 == 3 and res_66["composite_verdict"] == "FAIL_HARD_STOP_COMPOSITE_RELEASE" and "FAIL_HARD_STOP_NW08_3D_FVM_BELOW_15MMHG_FLOOR" in res_66["hard_stops"] and (res_66.get("nw08_measured_ocr_dispatch_result") or {}).get("lot_binding_verified") is True and (res_66.get("nw08_measured_ocr_dispatch_result") or {}).get("solver_executed") is True and (res_66.get("nw08_measured_ocr_dispatch_result") or {}).get("face_min_mmhg_unrounded", 99.0) < 15.0 ) cases.append({ "case": "r10_b1c_coupled_clinical_lot_matched_failing_r1_350_ocr_hard_stop_exit_3", "expected_verdict": "FAIL_HARD_STOP_COMPOSITE_RELEASE", "actual_verdict": res_66["composite_verdict"], "operational_tier": res_66["operational_tier"], "legacy_passed": (res_66.get("legacy_result_summary") or {}).get("legacy_evaluator_passed"), "legacy_tier": (res_66.get("legacy_result_summary") or {}).get("lot_release_readiness_tier"), "legacy_resolved_pvid": (res_66.get("legacy_result_summary") or {}).get("resolved_product_variant_id"), "gate0v_passed": (res_66.get("gate0v_result_summary") or {}).get("gate0v_evaluator_passed"), "gate0v_verdict": (res_66.get("gate0v_result_summary") or {}).get("verdict"), "expected_token": "FAIL_HARD_STOP_NW08_3D_FVM_BELOW_15MMHG_FLOOR", "exit_code": rc_66, "hard_stops": res_66["hard_stops"][:2], "holds": res_66["holds"][:2], "passed": ok_66, }) # 67. R10-B1d: Stale lot_payload_sha256, mismatched lot/MCB/product, tampered ocr_record_sha256, # mismatched evidence digest, stale timestamp, unbound 3-field legacy JSON, and lot missing # nw08_route_id -> ALL HOLD_COMPOSITE_RELEASE (exit 2)! bad_coupled_matrix: List[Tuple[str, Path, Dict[str, Any], str]] = [ ( "stale_lot_hash", clin_r2_f, v38.build_bound_nw08_ocr_record( lot_id=clin_lot_id, mcb_id=mcb_id, product_variant_id=pv_lead, route_id="R2_DZ40", lot_payload_sha256=v38._valid_digest("older_lot_hash"), measured_ocr=1.097, uncertainty_se=0.0, measurement_record_id="OCR-STALE-1", measurement_evidence_sha256=clin_ev_sha, measurement_timestamp_utc="2026-11-29T01:00:00Z", ), "HOLD_NW08_COUPLED_STALE_OR_MISMATCHED_LOT_PAYLOAD_SHA256", ), ( "wrong_lot_id", clin_r2_f, v38.build_bound_nw08_ocr_record( lot_id="LOT-OTHER-999", mcb_id=mcb_id, product_variant_id=pv_lead, route_id="R2_DZ40", lot_payload_sha256=clin_r2_bundle["payload_sha256"], measured_ocr=1.097, uncertainty_se=0.0, measurement_record_id="OCR-BADLOT-1", measurement_evidence_sha256=clin_ev_sha, measurement_timestamp_utc="2026-11-29T01:00:00Z", ), "HOLD_NW08_COUPLED_LOT_ID_MISMATCH", ), ( "wrong_mcb_id", clin_r2_f, v38.build_bound_nw08_ocr_record( lot_id=clin_lot_id, mcb_id="MCB-WRONG-999", product_variant_id=pv_lead, route_id="R2_DZ40", lot_payload_sha256=clin_r2_bundle["payload_sha256"], measured_ocr=1.097, uncertainty_se=0.0, measurement_record_id="OCR-BADMCB-1", measurement_evidence_sha256=clin_ev_sha, measurement_timestamp_utc="2026-11-29T01:00:00Z", ), "HOLD_NW08_COUPLED_MCB_ID_MISMATCH", ), ( "wrong_pvid", clin_r2_f, v38.build_bound_nw08_ocr_record( lot_id=clin_lot_id, mcb_id=mcb_id, product_variant_id="ISLET1_A4_ARM1A", route_id="R2_DZ40", lot_payload_sha256=clin_r2_bundle["payload_sha256"], measured_ocr=1.097, uncertainty_se=0.0, measurement_record_id="OCR-BADPV-1", measurement_evidence_sha256=clin_ev_sha, measurement_timestamp_utc="2026-11-29T01:00:00Z", ), "HOLD_NW08_COUPLED_PRODUCT_VARIANT_ID_MISMATCH", ), ( "tampered_self_digest", clin_r2_f, {**clin_ocr_r2_pass, "measured_ocr": 1.097}, "HOLD_NW08_OCR_RECORD_SHA256_MISMATCH", ), ( "mismatched_evidence_sha", clin_r2_f, v38.build_bound_nw08_ocr_record( lot_id=clin_lot_id, mcb_id=mcb_id, product_variant_id=pv_lead, route_id="R2_DZ40", lot_payload_sha256=clin_r2_bundle["payload_sha256"], measured_ocr=1.097, uncertainty_se=0.0, measurement_record_id="OCR-BADEV-1", measurement_evidence_sha256=v38._valid_digest("other_ev"), measurement_timestamp_utc="2026-11-29T01:00:00Z", ),