scripts/verify_iip0055_hygiene_safecell_minifh_orthogonality.py
Use this file in any AI chat (paste-only or attachment-capable):
Pinned raw file: https://openislet.org/files/gen-eb955f8266035aba/scripts/verify_iip0055_hygiene_safecell_minifh_orthogonality.py · SHA-256: d5b98e2ba1310333…
d1a = next((x for x in prods if isinstance(x, dict) and "ISLET1_D1_AUTO_V2_L1A" in str(x.get("product_variant_id", x.get("id", "")))), {})
else:
d1a = {}
live_repo_findings = {
"repo_cross_checked": True,
"mandatory_files_verified": {
"wetlab_contract.py_sha256": sha256_bytes(wlc_bytes),
"islet1_product_definitions_v0.8.0.json_sha256": sha256_bytes(pdef_bytes),
"iip0042_master_multilayer_portfolio_crosswalk_v0.8.0.json_sha256": sha256_bytes(p42_bytes),
},
"wetlab_contract_txnip_ko_bug_detected": "LOCK_RNLS_WT_AND_TXNIP_KO" in wlc_txt,
"d1b_v2_mislabeled_K1_B2_familyA_detected": bool(
d1a.get("family") == "A" and d1a.get("K") == 1 and d1a.get("B") == 2
),
"d1b_v2_3lineage_vs_gy030_5lineage_detected": bool(
d1a.get("donor_lineage", {}).get("derivative_lineages") == ["beta", "alpha", "delta"]
),
"website_cross_checked": False,
}
w_root = website_root if website_root is not None else (repo_root.parent / "OpenIslet-Website")
web_th = w_root / "src" / "data" / "therapeutics.ts"
web_cr = w_root / "public" / "therapeutics" / "v1.3" / "CLEANROOM_RELEASE_V1_3.md"
if website_root is not None:
require_cond(web_th.is_file() and web_cr.is_file(), "FAIL_CLOSED: mandatory website files missing under --website-root")
if web_th.is_file() and web_cr.is_file():
live_repo_findings["website_cross_checked"] = True
live_repo_findings["website_therapeutics_ts_wrong_pmid_22229122_detected"] = "22229122" in web_th.read_text(encoding="utf-8")
live_repo_findings["website_cleanroom_md_wrong_pmid_22229122_detected"] = "22229122" in web_cr.read_text(encoding="utf-8")
return {
"d1b_lean_k2_architecture": {
"disposition": "PATCHED_K2_B0_SINGLE_LAYER_REPLACING_KILLED_UNPATCHED_D1B_LEAN_K1",
"rt2_kill_rationale_for_k1": "Unpatched K=1, B=0 left unedited self-HLA beta-cells exposed to recurrent T1D autoimmunity: Sutherland et al. 1989 (PMID:2642862) documented 3 identical-twin recipients with selective beta-cell autoimmune recurrence (alongside 2 functioning twin grafts in the cohort), and Vendrame et al. 2010 (PMID:20086230) documented pathogenic CD4+/autoimmune T-cell responses in recurrent T1D. Upgrading to K=2, B=0 saves +3.03 pp standalone if exogenous biologics fail.",
"cell_source": "16-day patient adipose CiPSC (Liuyang et al. 2023 PMID:36944335; avoids 26.9% blood-hiPSC BCOR mutation load PMID:35953586)",
"truthful_registry_metadata": {
"product_id": d_manifest["product_id"],
"family": "D",
"bank_origin": "autologous_hiPSC",
"K": 2,
"B": 0,
"dsb_loci": ["chr7:ACTB_iCasp8", "chr4:CXCL10_KI(SERPINB9+PD-L1[SYN6+])"],
"base_edit_loci": [],
"dual_switch_required_for_release": False,
"dual_switch_wetlab_qualified": False,
"safety_switch": d_manifest["safety_switch"],
"gy030_required_release_lineages": sorted(GY030_REQUIRED_5_LINEAGES),
"r4_sars_backup_eligible": False,
},
"hla_preservation": "100% native self-HLA-I/II intact (0 B2M/CIITA/HLA-A/B edits -> 0.0% AH8.1 HLA-C*07:01 edit-exclusion mechanism, 0 RYAFSGVAY neoepitope; does not eliminate non-HLA exclusions or autoimmune recurrence risk)",
"edit_1_safety": "STRICTLY single-layer ACTB-3'UTR-IRES::iCasp8 (3,613 bp arithmetic AAV6 pkg; ZERO inherited dual-escape scalar; gated on GMLEDGKKV/GSSESQTL MS immunopeptidomics + cFLIP/GSDMD pyroptosis + live GY-030 5-lineage whole-graft release; WT FRB/FKBP12 backup)",
"edit_2_ctl_defense": {
"construct": "Universal HLA-agnostic chr4 CXCL10::SERPINB9 + PD-L1[SYN6+]",
"donor_bp": len(d1b_l2),
"packaged_aav6_arithmetic_bp": len(d1b_l2) + AAV6_ITR_OVERHEAD_BP,
"aav6_arithmetic_headroom_bp": AAV6_MAX_PACKAGED_BP - (len(d1b_l2) + AAV6_ITR_OVERHEAD_BP),
"serpinb9_wt_intact": sb9_present,
"pdl1_syn6plus_intact": pdl1_present,
"payload_hygiene": d1b_l2_payload_h,
},
"turnaround_weeks": [18, 20],
"portfolio_hurdles_standalone": {"H1": 0.78, "H2": 0.92, "H3": 0.68, "H4": 0.70},
},
"repo_and_blueprint_hygiene_remediation_spec": {
"gy026_txnip_ko_removal": {
"status": "PENDING_ATOMIC_FOLDIN_MIGRATION",
"active_violation": "scripts/wetlab_contract.py:7850 still emits 'LOCK_RNLS_WT_AND_TXNIP_KO' on the read-only live repo, violating GY-026 (BLOCK, Traini et al. 2025 PMID:40320524)",
"wetlab_endpoint_contract_v080_patch": "PENDING_ATOMIC_FOLDIN_MIGRATION: add explicit GY-026 txnip_ko_prohibited=true guard on atomic fold-in and replace wetlab_contract.py:7850 with 'LOCK_RNLS_WT_TXNIP_WT_GY026_COMPLIANT' (0-byte untouched now under Zero-LIMS-Touch; never claimed as already enforced on live read-only repo).",
},
"quarantined_legacy_error_pmids": QUARANTINED_ERROR_PMIDS,
"product_registry_and_gy030_5lineage_reconciliation": {
"archival_d1b_v2_correction": "Correct ISLET1_D1_AUTO_V2_* metadata from mislabeled family='A', K=1, B=2 to truthful archival K=4, B=2, family='D'.",
"wave6_d1b_k2_registration": "Register ISLET1_DESIGN_D1B_LEAN_K2 as truthful family='D', bank_origin='autologous_hiPSC', K=2, B=0, single-layer ACTB::iCasp8 (dual_switch_required_for_release=false, dual_switch_wetlab_qualified=false), with mandatory live GY-030 5-lineage whole-graft release.",
"gy030_5lineage_enforcement": "ALL 6 arms (A, B, X, Y, D, Z) MUST clear live GY-030 5-lineage whole-graft release (beta, alpha, delta, plvap_iec, pericyte); legacy 3-lineage D1b wording is retired.",
},
"live_repo_drift_audit": live_repo_findings,
},
}
# =============================================================================
# PART E — MANIFEST-DRIVEN 6-ARM x 8-AXIS ORTHOGONALITY MATRIX (ZERO EXEMPTIONS)
# =============================================================================
def _build_tokens_from_canonical_manifest(
arm_manifest: Dict[str, Any],
*,
design_a_variant: str = "V090_TBP_CANDIDATE",
include_shared_gp2_sorting: bool = False,
token_equality_mode: str = "PHYSICAL_IDENTITY",
) -> Dict[str, Set[str]]:
"""Derive 6-arm x 8-axis atomic tokens strictly from wave6_canonical_arm_manifest.json.
Zero hand-typed drift across candidates and NO fake 'zero biologic' unique token on Design A!
Explicitly versions BOTH physical components of governed reference ISLET1_DESIGN_A_V080_REF
(chr19 AAVS1::iCasp9 switch AND v0.8.0 ARM1B SERPINB9-GSG-P2A-PD-L1 bystander cassette)
distinctly from separately versioned ISLET1_DESIGN_A_V090_TBP_CANDIDATE (chr6 TBP::iCasp9
+ ARM5_v0.9.0 SERPINB9+PD-L1[SYN6+] repair):
- token_equality_mode='PHYSICAL_IDENTITY': token equality denotes identical physical
construct version (V080_REF carries H3:CXCL10_SERPINB9_P2A_PDL1_v080_ARM1B_ref;
V090_TBP_CANDIDATE and X/Y/D/Z carry H3:CXCL10_SERPINB9_PDL1_SYN6plus_ARM5_v090).
- token_equality_mode='FUNCTIONAL_FAMILY': token equality groups CXCL10::SERPINB9+PD-L1
cassettes by shared biological effector family (H3:CXCL10_SERPINB9_PDL1_family).
"""
require_cond(design_a_variant in ("V080_REF", "V090_TBP_CANDIDATE"), f"Invalid design_a_variant={design_a_variant!r}")
require_cond(token_equality_mode in ("PHYSICAL_IDENTITY", "FUNCTIONAL_FAMILY"), f"Invalid token_equality_mode={token_equality_mode!r}")
out: Dict[str, Set[str]] = {}
for arm_id in ("A", "B", "X", "Y", "D", "Z"):
a = arm_manifest["arms"][arm_id]
toks: Set[str] = set()
# Axis 1: Cell origin (+ optional shared GP2 sorting process sensitivity on allogeneic arms)
toks.add(f"H1:{a['cell_origin']}")
if include_shared_gp2_sorting and arm_id in ("A", "B", "X", "Y", "Z"):
toks.add("Sort:GP2_shared_allogeneic")
# Axis 2: HLA state
hla = a["hla_state"]
if "B2M-/-" in hla:
toks.add("H2:B2M_KO")
if "HLA-C-retained" in hla:
toks.add("H2:B2M_partial_HLA_C_retained")
if "CIITA-/-" in hla:
toks.add("H2:CIITA_KO")
if "HLA-E" in hla:
toks.add("H2:HLA_E")
if "CD47" in hla:
toks.add("H2:CD47")
if "+ PD-L1" in hla:
toks.add("H2:PD_L1_constitutive")
if "autologous self-HLA" in hla:
toks.add("H2:Native_Autologous_Self_HLA")
# Axis 3: Complement
comp = a["complement_module"]
if "TM-mini-FH-mono-v2" in comp:
toks.add("Comp:TM_miniFH_mono_v2")
if "CD55" in comp and "zero CD46_WT/CD55" not in comp:
toks.add("Comp:CD55_cell_intrinsic")
if "CD59" in comp:
toks.add("Comp:CD59_cell_intrinsic")
if "Encapsulation barrier" in comp:
toks.add("Comp:Encapsulation_barrier_no_CaO2")
if "autologous complement" in comp:
toks.add("Comp:Native_Autologous_Complement")
# Axis 4: Bystander / intrinsic H3 (physical version vs functional family; NO fake zero-biologic token!)
bys = a["bystander_module"]
if "CXCL10::SERPINB9" in bys:
if token_equality_mode == "FUNCTIONAL_FAMILY":
toks.add("H3:CXCL10_SERPINB9_PDL1_family")
elif arm_id == "A" and design_a_variant == "V080_REF":
toks.add("H3:CXCL10_SERPINB9_P2A_PDL1_v080_ARM1B_ref")
else:
toks.add("H3:CXCL10_SERPINB9_PDL1_SYN6plus_ARM5_v090")
if "CD64t" in bys:
toks.add("H3:ModeB_CD64t")
if "IL1RN" in bys:
toks.add("H3:ModeB_IL1RN")
# Axis 5: Eligible optional exogenous/adjunct modules (Design A has EMPTY set — strictly 0!)
if a["shield_eligible"]:
toks.add("Opt:SHIELD_eligible")
if a["invvax_eligible"]:
toks.add("Opt:InvVax_eligible")
if a["cuff_v2_eligible"]:
toks.add("Opt:Cuff_v2_eligible")
if a["exvivo_rest_eligible"]:
toks.add("Opt:ExVivoRest_eligible")
if a["ins_l82i_eligible"]:
toks.add("Opt:INS_L82I_eligible")
# Axis 6: Safety switch & GY-030 5-lineage release
sw = a["safety_switch"]
if arm_id == "A":
if design_a_variant == "V080_REF":
toks.add("Safe:AAVS1_iCasp9_v080_ref")
else:
toks.add("Safe:TBP_iCasp9")
else:
if "TBP::iCasp9" in sw:
toks.add("Safe:TBP_iCasp9")
if "CDK1::HSV-TK" in sw:
toks.add("Safe:CDK1_HSV_TK")
if "ACTB::iCasp8" in sw and "comparator" not in sw:
toks.add("Safe:ACTB_iCasp8")
if "GY-030 5-lineage" in sw:
toks.add("Safe:GY030_5lineage_wholegraft")
# Axis 7: Edited genomic loci
for loc in a["loci"]:
base = loc.split("(")[0].strip()
if base.startswith("chr15:B2M_KO"):
toks.add("Loci:chr15_B2M_KO_KI")
elif base.startswith("chr15:B2M_partial"):
toks.add("Loci:chr15_B2M_partial_HLAC")
elif base.startswith("chr16:CIITA"):
toks.add("Loci:chr16_CIITA_KO")
elif base.startswith("chr13:CLYBL_ModeB"):
toks.add("Loci:chr13_CLYBL_ModeB")
elif base.startswith("chr13:CLYBL_KI"):
toks.add("Loci:chr13_CLYBL_Yv3_Z")
elif base.startswith("chr4:CXCL10"):
toks.add("Loci:chr4_CXCL10_KI")
elif base.startswith("chr19:AAVS1"):
if arm_id == "A" and design_a_variant == "V090_TBP_CANDIDATE":
toks.add("Loci:chr6_TBP_iCasp9")
else:
toks.add("Loci:chr19_AAVS1_iCasp9_v080_ref")
elif base.startswith("chr6:TBP"):
toks.add("Loci:chr6_TBP_iCasp9")
elif base.startswith("chr10:CDK1"):
toks.add("Loci:chr10_CDK1_HSV_TK")
elif base.startswith("chr7:ACTB"):
toks.add("Loci:chr7_ACTB_iCasp8")
# Axis 8: Routes
toks.add(f"H4:home_{a['home_route']}")
for r in a["allowed_routes"]:
toks.add(f"H4:allowed_{r}")
out[arm_id] = toks
return out
def compute_part_e_honest_orthogonality_matrix(arm_manifest: Dict[str, Any]) -> Dict[str, Any]:
w5_full: Dict[str, Set[str]] = {
"A": {
"H1:hPSC_Stage0_7", "Sort:CD49a_ITGA2_risk", "H2:B2M_KO", "H2:CIITA_KO",
"H2:HLA_E_VMAPRTLVL", "H2:CD47_IgV_GPI", "Comp:CD64t_IgG_only",
"H3:CIITA_CD64t_IL1RN", "H3:CXCL10_SB9_PDL1", "H3:Foundry_v13_6kDa",
"Safe:AAVS1_UCOE455_iCasp9WT", "Loci:chr15_B2M", "Loci:chr16_CIITA",
"Loci:chr4_CXCL10", "Loci:chr19_AAVS1", "H4:R1_CaO2", "H4:65um_SubQ_FBR",
},
"B": {
"H1:hPSC_Stage0_7", "Sort:CD49a_ITGA2_risk", "H2:HLA_AB_KO_HLA_C_retain", "H2:CIITA_KO",
"H2:CD47_IgV_GPI", "Comp:CD64t_IgG_only",
"H3:CIITA_CD64t_IL1RN", "H3:CXCL10_SB9_PDL1", "H3:Foundry_v13_6kDa",
"Safe:AAVS1_UCOE455_iCasp9WT", "Loci:chr6_HLA", "Loci:chr16_CIITA",
"Loci:chr4_CXCL10", "Loci:chr19_AAVS1", "H4:R2_ThinSheet", "H4:65um_SubQ_FBR",
},
"X": {
"H1:hPSC_Stage0_7", "Sort:CD49a_ITGA2_risk", "H2:B2M_KO", "H2:CIITA_KO",
"H2:HLA_E_VMAPRTLVL", "H2:CD47_IgV_GPI", "Comp:CD64t_IgG_only",
"H3:CIITA_CD64t_IL1RN", "H3:CXCL10_SB9_PDL1", "H3:MultiMiR_IL1R1_FAS", "H3:Foundry_v13_6kDa",
"Safe:AAVS1_UCOE455_iCasp9WT", "Loci:chr15_B2M", "Loci:chr16_CIITA",
"Loci:chr4_CXCL10", "Loci:chr19_AAVS1", "H4:R1_CaO2", "H4:65um_SubQ_FBR",
},
"Y_v2": {
"H1:hPSC_Stage0_7", "Sort:CD49a_ITGA2_risk", "H2:B2M_KO", "H2:CIITA_KO",
"H2:HLA_E_VMAPRTLVL", "H2:CD47_IgV_GPI", "Comp:CD46_WT_viral_hazard", "Comp:CD64t_IgG_only",
"H3:CIITA_CD64t_IL1RN", "H3:CXCL10_SB9_PDL1", "H3:VTCN1_FSP1", "H3:Foundry_v13_6kDa",
"Safe:UCOE455_iCasp9WT_chr15LOH", "Safe:CLYBL_CDK1_hTMPK", "Loci:chr15_B2M",
"Loci:chr13_CLYBL", "H4:R3P_Planar_FibrinCliff", "H4:65um_SubQ_FBR",
},
"D1b_v2": {
"H1:Auto_CiPSC_Stage0_7", "Sort:CD49a_ITGA2_risk", "H2:HLA_AB_KO_HLA_C_retain", "H2:AH81_SP3C_excl",
"H2:CIITA_KO", "Comp:CD64t_IgG_only",
"H3:CIITA_CD64t_IL1RN", "H3:CXCL10_SB9_PDL1", "H3:VTCN1_FSP1", "H3:Foundry_v13_6kDa",
"Safe:AAVS1_UCOE455_iCasp9WT", "Safe:CLYBL_CDK1_hTMPK", "Loci:chr6_HLA", "Loci:chr16_CIITA",