("playbook.sec4119", pb_clean), ): for pred_name, _gid, _cell_pat, prose_pat in predicate_specs: if pred_name == "R3P-06_ada_targets" and doc_name == "decision_tree.crosswalk": continue if pred_name == "R3P-05_single_dose_93350" and doc_name == "decision_tree.crosswalk": if "93,350" not in blob: raise ValueError(f"Missing single-dose 93,350 disclosure in {doc_name}") continue if not re.search(prose_pat, blob): raise ValueError(f"Typed predicate parity failure ({pred_name}) in {doc_name}") # Verify EVERY individual product record in registry AND its ACTUAL 16 typed cells match! product_summaries: List[Dict[str, Any]] = [] for pvid in sorted(pc.STAGED_DESIGN_Y_V2_PRODUCT_IDS): prod = by_id[pvid] bind = prod["staged_design_y_fullstack_v2_donor_binding"] role = str(bind["role"]) gates_txt = " ".join(prod.get("pending_assay_gates") or []) if role == "FULL_CHR15_11TU_REFERENCE": for pred_name, gid, cell_pat, prose_pat in predicate_specs: if pred_name in ("Y-05_backup_hold", "Y-05_pigk_bound", "Y-05_cd47_floor"): continue if not re.search(cell_pat, cell_map[(pvid, gid)]["threshold"]): raise ValueError(f"Typed cell threshold semantic mismatch ({pred_name}) on {pvid}:{gid}") if not re.search(prose_pat, gates_txt): raise ValueError(f"Registry predicate mismatch ({pred_name}) on {pvid}") elif role == "GATE0V_CD55_CFH_BACKUP_COMPARATOR": for pred_name, gid, cell_pat, prose_pat in predicate_specs: if not re.search(cell_pat, cell_map[(pvid, gid)]["threshold"]): raise ValueError(f"Typed cell threshold semantic mismatch ({pred_name}) on {pvid}:{gid}") if not re.search(prose_pat, gates_txt): raise ValueError(f"Registry predicate mismatch ({pred_name}) on {pvid}") elif role == "EQUAL_SPACING_ATTRIBUTION_CONTROL": if "0.80" not in cell_map[(pvid, "Y-05")]["threshold"] or "0.85" not in cell_map[(pvid, "Y-07")]["threshold"]: raise ValueError(f"Control typed cells Y-05/Y-07 missing ratio thresholds on {pvid}") for req in ("Y-05", "CD59", "CD47-IgV-GPI", "0.80", "180,000", "Y-07", "SI AND first-phase AUC", "0.85"): if req not in gates_txt: raise ValueError(f"Control registry {pvid} missing Y-05/Y-07 comparator clause {req!r}") elif role in ("SEQUENTIAL_STEP1_ATTB_GT_DONOR", "SEQUENTIAL_STEP2_ATTB_CA_DONOR"): if "0.8%-1.0%_HOLD" not in cell_map[(pvid, "Y-05")]["threshold"] or "384" not in cell_map[(pvid, "Y-05")]["threshold"]: raise ValueError(f"Component typed cell Y-05 missing HOLD interval / colony cap on {pvid}") if "0.8% <= rate < 1.0% -> HOLD" not in gates_txt or "384" not in gates_txt: raise ValueError(f"Component registry {pvid} missing Y-05 HOLD interval / colony cap") elif role == "DEC053_CHR13_CLYBL_SAFETY_SWITCH": if "0.1%" not in cell_map[(pvid, "Y-09")]["threshold"] or "4.0_log10" not in cell_map[(pvid, "Y-09")]["threshold"]: raise ValueError(f"Component typed cell Y-09 missing thresholds on {pvid}") if "0.1%" not in gates_txt or "4-log10" not in gates_txt or "0.005 uM" not in gates_txt: raise ValueError(f"Component registry {pvid} missing Y-09 thresholds") if "Not encoded by this standalone chr13 donor" not in str((prod.get("hla_retention") or {}).get("classical_MHC_I") or ""): raise ValueError(f"Standalone DEC053 record {pvid} must distinguish encoded payload from intended host genotype") dispositions_by_gate = {g: cell_map[(pvid, g)]["disposition"] for g in EXPECTED_96_GATES} product_summaries.append({ "product_variant_id": pvid, "role": role, "fullstack_clearance_eligible": role in expected_fullstack_roles, "gate_dispositions": dispositions_by_gate, "typed_cell_operators_and_thresholds_verified": True, "registry_predicates_verified_against_typed_contract": True, }) return { "registry_loaded_via_product_contract": True, "dec113_decision_tree_sha256_verified": dec113_sha, "dec113_playbook_sec4119_sha256_verified": pb_sha, "playbook_commonmark_parser": { "rendered_4119_headings_found": len(matched_4119), "heading_kind": h4119["kind"], "heading_level": h4119["level"], "container_depth": h4119["container_depth"], "total_document_headings_parsed": sum(1 for h in all_headings if h["start_offset"] <= h4119["start_offset"]), }, "typed_product_by_gate_contract_audit": { "products_checked": len(product_summaries), "gates_per_product": len(EXPECTED_96_GATES), "cells_verified": len(cell_map), "dec102_endpoints_mapped": len(xwalk_rows), "contradiction_guards_passed": len(forbidden_patterns), "typed_predicates_verified": len(predicate_specs), "product_gate_matrix": product_summaries, }, "staged_fasta_sha256_verified": pc.DESIGN_Y_V2_FASTA_SHA256, "staged_design_y_v2_record_count": len(pc.STAGED_DESIGN_Y_V2_PRODUCT_IDS), "resolved_fullstack_candidate_ids": resolved_fullstack_ids, "resolved_excluded_component_and_control_ids": resolved_excluded_ids, "resolved_design_y_v2_routes_from_registry": sorted(resolved_fullstack_route_codes), "design_y_v2_bound_strictly_to_route3p_matching_registry": True, "scope_note": ( "Verifies exact FASTA file/record lengths and SHA-256s, whole-record canonical product-entry SHA-256s, " "canonical JSON SHA-256 of the DEC-113 stage0_decision_tree_v1.json block (including its 96-cell typed " "product_by_gate_contract and 30-endpoint DEC-102 crosswalk matching wetlab_contract.py:5526-5634), " "LF-normalized trimmed CommonMark-parsed Playbook section 4.1.19 SHA-256 (with HTML character-reference " "decoding), closed cell/crosswalk operator allowlists, placeholder/duplicate rejection, direct typed-cell " "threshold concordance against all 3 controlling documents, execution_supported=False, role-scoped eligibility, " "and 1:1 physical_route_id alignment against ALLOWED_CELL_ROUTE_PAIRS_IIP0034; does not claim verbatim prose " "equality across differently structured views and does not independently recompute full sequence-grammar motif scans." ), } def compute_full_verification(repo_root: Path | None = None) -> Dict[str, Any]: active_root = ROOT if repo_root is None else Path(repo_root) registry_audit = _resolve_and_verify_design_y_v2_registry(active_root) r3p05_audit = compute_r3p05_dec103_thinning_boundary_audit() mechanics = compute_planar_mechanics_table() fvm_cases = [ solve_planar_route3p_fvm( label="Naive_147cm2_H180_Day0_Clean_FAIL", area_cm2=147.0, h_slot_um=180.0, cluster_diam_um=65.0, bed_po2_mmhg=35.0, sleeve_um=0.0, sleeve_d_factor=1.0, k_perf_gel_s_inv=0.0, k_perf_islet_s_inv=0.0, ocr_mult=1.097, ), solve_planar_route3p_fvm( label="SubARS300_H180_Day0_Clean_65um_PASS", area_cm2=300.0, h_slot_um=180.0, cluster_diam_um=65.0, bed_po2_mmhg=35.0, sleeve_um=0.0, sleeve_d_factor=1.0, k_perf_gel_s_inv=0.0, k_perf_islet_s_inv=0.0, ocr_mult=1.097, ), solve_planar_route3p_fvm( label="SubARS300_H200_Day0_Clean_65um_PASS", area_cm2=300.0, h_slot_um=200.0, cluster_diam_um=65.0, bed_po2_mmhg=35.0, sleeve_um=0.0, sleeve_d_factor=1.0, k_perf_gel_s_inv=0.0, k_perf_islet_s_inv=0.0, ocr_mult=1.097, ), solve_planar_route3p_fvm( label="Hybrid333_H180_Day0_Clean_65um_PASS", area_cm2=333.3, h_slot_um=180.0, cluster_diam_um=65.0, bed_po2_mmhg=35.0, sleeve_um=0.0, sleeve_d_factor=1.0, k_perf_gel_s_inv=0.0, k_perf_islet_s_inv=0.0, ocr_mult=1.097, ), solve_planar_route3p_fvm( label="Hybrid333_H200_Day0_Clean_65um_PASS", area_cm2=333.3, h_slot_um=200.0, cluster_diam_um=65.0, bed_po2_mmhg=35.0, sleeve_um=0.0, sleeve_d_factor=1.0, k_perf_gel_s_inv=0.0, k_perf_islet_s_inv=0.0, ocr_mult=1.097, ), solve_planar_route3p_fvm( label="Hybrid333_H180_Day0_10umFibrin_0p5D_65um_FACE_FAIL", area_cm2=333.3, h_slot_um=180.0, cluster_diam_um=65.0, bed_po2_mmhg=35.0, sleeve_um=10.0, sleeve_d_factor=0.5, k_perf_gel_s_inv=0.0, k_perf_islet_s_inv=0.0, ocr_mult=1.097, ), solve_planar_route3p_fvm( label="Hybrid333_H180_Day0_15umFibrin_0p5D_65um", area_cm2=333.3, h_slot_um=180.0, cluster_diam_um=65.0, bed_po2_mmhg=35.0, sleeve_um=15.0, sleeve_d_factor=0.5, k_perf_gel_s_inv=0.0, k_perf_islet_s_inv=0.0, ocr_mult=1.097, ), solve_planar_route3p_fvm( label="Hybrid333_H180_Day0_30umDenseThrombus_0p5D_CORE_FAIL", area_cm2=333.3, h_slot_um=180.0, cluster_diam_um=65.0, bed_po2_mmhg=35.0, sleeve_um=30.0, sleeve_d_factor=0.5, k_perf_gel_s_inv=0.0, k_perf_islet_s_inv=0.0, ocr_mult=1.097, ), solve_planar_route3p_fvm( label="SubARS300_H180_Day0_30umDenseThrombus_0p5D_CORE_FAIL", area_cm2=300.0, h_slot_um=180.0, cluster_diam_um=65.0, bed_po2_mmhg=35.0, sleeve_um=30.0, sleeve_d_factor=0.5, k_perf_gel_s_inv=0.0, k_perf_islet_s_inv=0.0, ocr_mult=1.097, ), solve_planar_route3p_fvm( label="SubARS300_H180_Day0_Clean_65um_Bed30mmHg_FACE_FAIL", area_cm2=300.0, h_slot_um=180.0, cluster_diam_um=65.0, bed_po2_mmhg=30.0, sleeve_um=0.0, sleeve_d_factor=1.0, k_perf_gel_s_inv=0.0, k_perf_islet_s_inv=0.0, ocr_mult=1.097, ), solve_planar_route3p_fvm( label="SubARS300_H200_Day0_Clean_65um_Bed30mmHg_FACE_FAIL", area_cm2=300.0, h_slot_um=200.0, cluster_diam_um=65.0, bed_po2_mmhg=30.0, sleeve_um=0.0, sleeve_d_factor=1.0, k_perf_gel_s_inv=0.0, k_perf_islet_s_inv=0.0, ocr_mult=1.097, ), solve_planar_route3p_fvm( label="Hybrid333_H180_Day0_Clean_65um_Bed30mmHg_PASS", area_cm2=333.3, h_slot_um=180.0, cluster_diam_um=65.0, bed_po2_mmhg=30.0, sleeve_um=0.0, sleeve_d_factor=1.0, k_perf_gel_s_inv=0.0, k_perf_islet_s_inv=0.0, ocr_mult=1.097, ), solve_planar_route3p_fvm( label="Hybrid333_H200_Day0_Clean_65um_Bed30mmHg_FACE_FAIL", area_cm2=333.3, h_slot_um=200.0, cluster_diam_um=65.0, bed_po2_mmhg=30.0, sleeve_um=0.0, sleeve_d_factor=1.0, k_perf_gel_s_inv=0.0, k_perf_islet_s_inv=0.0, ocr_mult=1.097, ), solve_planar_route3p_fvm( label="FourMod260_H180_Day0_Clean_65um_Bed30mmHg_FACE_FAIL", area_cm2=260.0, h_slot_um=180.0, cluster_diam_um=65.0, bed_po2_mmhg=30.0, sleeve_um=0.0, sleeve_d_factor=1.0, k_perf_gel_s_inv=0.0, k_perf_islet_s_inv=0.0, ocr_mult=1.097, ), solve_planar_route3p_fvm( label="SubARS300_H180_Day0_Avascular_VPIO120_Clean_FACE_FAIL", area_cm2=300.0, h_slot_um=180.0, cluster_diam_um=120.0, bed_po2_mmhg=35.0, sleeve_um=0.0, sleeve_d_factor=1.0, k_perf_gel_s_inv=0.0, k_perf_islet_s_inv=0.0, ocr_mult=1.097, ), solve_planar_route3p_fvm( label="Hybrid333_H180_Day0_Avascular_VPIO120_Clean_PASS", area_cm2=333.3, h_slot_um=180.0, cluster_diam_um=120.0, bed_po2_mmhg=35.0, sleeve_um=0.0, sleeve_d_factor=1.0, k_perf_gel_s_inv=0.0, k_perf_islet_s_inv=0.0, ocr_mult=1.097, ), solve_planar_route3p_fvm( label="SubARS300_H180_Day0_Avascular_VPIO120_14p9umFibrin_0p5D_FAIL", area_cm2=300.0, h_slot_um=180.0, cluster_diam_um=120.0, bed_po2_mmhg=35.0, sleeve_um=14.9, sleeve_d_factor=0.5, k_perf_gel_s_inv=0.0, k_perf_islet_s_inv=0.0, ocr_mult=1.097, ), solve_planar_route3p_fvm( label="Hybrid333_H180_Day0_Avascular_VPIO120_14p9umFibrin_0p5D_FAIL", area_cm2=333.3, h_slot_um=180.0, cluster_diam_um=120.0, bed_po2_mmhg=35.0, sleeve_um=14.9, sleeve_d_factor=0.5, k_perf_gel_s_inv=0.0, k_perf_islet_s_inv=0.0, ocr_mult=1.097, ), solve_planar_route3p_fvm( label="SubARS300_H180_VPIO120_PostAnast_2p5xGSIS_45umFBR_PASS", area_cm2=300.0, h_slot_um=180.0, cluster_diam_um=120.0, bed_po2_mmhg=35.0, sleeve_um=45.0, sleeve_d_factor=1.0 / 3.0, k_perf_gel_s_inv=5.0, k_perf_islet_s_inv=3.0, ocr_mult=1.097 * 2.5, ), solve_planar_route3p_fvm( label="Hybrid333_H180_VPIO120_PostAnast_2p5xGSIS_45umFBR_PASS", area_cm2=333.3, h_slot_um=180.0, cluster_diam_um=120.0, bed_po2_mmhg=35.0, sleeve_um=45.0, sleeve_d_factor=1.0 / 3.0, k_perf_gel_s_inv=5.0, k_perf_islet_s_inv=3.0, ocr_mult=1.097 * 2.5, ), solve_planar_route3p_fvm( label="Hybrid333_H180_VPIO120_PostAnast_GelOnlyNoIsletPerf_CORE_FAIL", area_cm2=333.3, h_slot_um=180.0, cluster_diam_um=120.0, bed_po2_mmhg=35.0, sleeve_um=45.0, sleeve_d_factor=1.0 / 3.0, k_perf_gel_s_inv=5.0, k_perf_islet_s_inv=0.0, ocr_mult=1.097 * 2.5, ), ] shutoff = compute_planar_insulin_shutoff_table() colonies = compute_sequential_colony_screening_audit() solubility_sensitivity_30mmhg = solve_planar_route3p_fvm( label="Hybrid333_H180_Day0_Clean_65um_Bed30mmHg_Alpha1p27e9_FACE_FAIL", area_cm2=333.3, h_slot_um=180.0, cluster_diam_um=65.0, bed_po2_mmhg=30.0, sleeve_um=0.0, sleeve_d_factor=1.0, k_perf_gel_s_inv=0.0, k_perf_islet_s_inv=0.0, ocr_mult=1.097, alpha_mol_cm3_mmhg=ALPHA_PHYS_BUFFER, ) solubility_sensitivity_120um_bed35 = solve_planar_route3p_fvm( label="Hybrid333_H180_Day0_Clean_VPIO120_Bed35mmHg_Alpha1p27e9_FAIL", area_cm2=333.3, h_slot_um=180.0, cluster_diam_um=120.0, bed_po2_mmhg=35.0, sleeve_um=0.0, sleeve_d_factor=1.0, k_perf_gel_s_inv=0.0, k_perf_islet_s_inv=0.0, ocr_mult=1.097, alpha_mol_cm3_mmhg=ALPHA_PHYS_BUFFER, )