scripts/verify_iip0041_clinical_h1_cd64t_siglec.py
Use this file in any AI chat (paste-only or attachment-capable):
Pinned raw file: https://openislet.org/files/gen-eb955f8266035aba/scripts/verify_iip0041_clinical_h1_cd64t_siglec.py · SHA-256: f004cf6d8259b8b4…
True,
expected_lead_auth=True,
expected_arb_closed=True,
expected_inc_retained=False,
)
# 2. Full qualification via independent directory store promotes winner
_check_case(
"full_qualification_dir_store_promotes_winner",
base_full_pass,
"PASS_FULL_GY025_AND_GATE28B_PROMOTE",
True,
store=store_dir,
expected_lead_auth=True,
expected_arb_closed=True,
expected_inc_retained=False,
)
# 3. Full qualification with incumbent L2_V3 holding quantitatively retains incumbent with lead_promotion_authorized=False! (M4)
_check_case(
"full_qualification_retain_incumbent_l2v3",
retain_payload,
"PASS_FULL_GY025_AND_GATE28B_RETAIN_L2V3",
False,
expected_lead_auth=False,
expected_arb_closed=True,
expected_inc_retained=True,
)
# 4. Self-attested inline records WITHOUT trusted_qualification_store NEVER authorize promotion! (B3)
p_self_attest = copy.deepcopy(base_full_pass)
p_self_attest["upstream_qualification_records"] = {
"gate0v_record": base_recs["gate0v_record"],
"rule_s11_record": base_recs["rule_s11_record"],
"gy025_tier6b_record": base_recs["gy025_tier6b_record"],
}
p_self_attest["paired_comparator_record"] = base_recs["paired_comparator_record"]
_check_case(
"self_attested_inline_records_without_trusted_store_capped",
p_self_attest,
"COMPONENT_PASS_CIITA_ARBITRATION_ONLY_PENDING_FULL_GY025",
False,
store=None,
)
# 5. Bare caller boolean l2v3_broken=True WITHOUT trusted paired comparator record capped! (B3)
p_no_comp = copy.deepcopy(base_full_pass)
p_no_comp["upstream_record_refs"].pop("paired_comparator_record_sha256")
_check_case(
"bare_caller_l2v3_boolean_without_trusted_paired_comparator_capped",
p_no_comp,
"COMPONENT_PASS_CIITA_ARBITRATION_ONLY_PENDING_FULL_GY025",
False,
)
# 6. Caller l2v3_broken=True contradicting trusted quantitative comparator (L2_V3 held) fails closed! (B3)
p_comp_contra = copy.deepcopy(retain_payload)
p_comp_contra["l2v3_broken_by_t1d_sera_gt_5pct"] = True
_check_case(
"caller_l2v3_flag_contradicting_trusted_quantitative_comparator_rejected",
p_comp_contra,
"FAIL_OR_PENDING",
False,
)
# 7. Unauthorized issuer_authority_id in trusted store rejected fail-closed! (B3)
bad_issuer_store = td_path / "bad_issuer_store.json"
bad_g0v = build_authenticated_upstream_record(
gate_id="GATE_0V_WHOLEGRAFT",
verdict="PASS_WHOLEGRAFT_GATE0V_AND_STRESS_AP1903",
lot_id=base_full_pass["lot_id"],
mcb_id=base_full_pass["mcb_id"],
construct_id=base_full_pass["construct_id"],
chassis_id=base_full_pass["chassis_id"],
issuer_authority_id="UNTRUSTED_SELF_ISSUER_X",
evidence_summary={"beta_alpha_delta_iec_pericyte_persistent_vp1_ie1_events": 0},
)
write_gate28b_trusted_qualification_store(
bad_issuer_store,
upstream_records=[bad_g0v, base_recs["rule_s11_record"], base_recs["gy025_tier6b_record"]],
paired_comparator_records=[base_recs["paired_comparator_record"]],
)
p_bad_iss = copy.deepcopy(base_full_pass)
p_bad_iss["upstream_record_refs"]["gate0v_record_sha256"] = bad_g0v["record_sha256"]
_check_case(
"untrusted_issuer_authority_in_store_rejected",
p_bad_iss,
"FAIL_OR_PENDING",
False,
store=bad_issuer_store,
)
# 8. Alternate / mutated side-contract policy file CANNOT authorize promotion! (B4)
alt_sc = td_path / "mutated_side_contract.json"
sc_orig = load_strict_json_bytes((OPENISLET_ROOT / PINNED_SIDE_CONTRACT_REL).read_bytes(), "orig_sc")
sc_orig["executable_stage0_gates"]["Gate_28_B"]["promotion_eligible_construct_ids"].append("UNAUTHORIZED_MUTANT_LEAD")
alt_sc.write_text(json.dumps(sc_orig, indent=2) + "\n", encoding="utf-8")
_check_case(
"mutated_alternate_side_contract_non_authorizing_diagnostic",
base_full_pass,
"NON_AUTHORIZING_UNPINNED_POLICY_DIAGNOSTIC",
False,
sc_path=alt_sc,
expected_pin_verified=False,
)
# 9. Whitespace-padded construct_id and lot_id fail closed (zero silent stripping!) (M4)
p_ws_cid = copy.deepcopy(base_full_pass)
p_ws_cid["construct_id"] = " ABX_L2_v2_CD64T_IL1RN "
_check_case("whitespace_padded_construct_id_rejected", p_ws_cid, "FAIL_HARD_STOP", False)
p_ws_lot = copy.deepcopy(base_full_pass)
p_ws_lot["lot_id"] = "LOT-ABX-2026-001 "
_check_case("whitespace_padded_lot_id_rejected", p_ws_lot, "FAIL_OR_PENDING", False)
# 10. Missing raw t0_mfi/day90_mfi and contradictory Day-90 MFI retention fail closed! (M4)
p_no_mfi = copy.deepcopy(base_full_pass)
p_no_mfi["copy1_monoallelic"].pop("t0_mfi")
_check_case("missing_raw_t0_mfi_rejected", p_no_mfi, "FAIL_OR_PENDING", False)
p_bad_ret = copy.deepcopy(base_full_pass)
p_bad_ret["copy1_monoallelic"]["day90_mfi_retention_pct_vs_t0"] = 99.0 # contradicts 6100/7200 = 84.72%!
_check_case("contradictory_day90_mfi_retention_rejected", p_bad_ret, "FAIL_OR_PENDING", False)
# 11. Component-only pass (missing full GY-025 physical fields & refs) does NOT authorize promotion
p_comp = copy.deepcopy(base_full_pass)
for k in (
"exact_stack_efferocytosis_abs_pct", "exact_stack_efferocytosis_pct_of_wt",
"iec_morphogenesis_t50_h", "iec_viability_pct", "gate0g_pericyte_pct",
"gate0v_viral_safety_passed", "rule_s11_molecular_battery_passed",
"gy025_tier6b_master_lot_outgrowth_passed", "upstream_record_refs",
):
p_comp.pop(k)
_check_case(
"partial_component_only_pending_full_gy025",
p_comp,
"COMPONENT_PASS_CIITA_ARBITRATION_ONLY_PENDING_FULL_GY025",
False,
)
# 12. Summary-flag-only run (bare booleans True WITHOUT trusted-store refs) stays strictly capped!
p_sum_only = copy.deepcopy(base_full_pass)
p_sum_only.pop("upstream_record_refs")
_check_case(
"summary_flags_only_without_trusted_store_refs_capped_at_component",
p_sum_only,
"COMPONENT_PASS_CIITA_ARBITRATION_ONLY_PENDING_FULL_GY025",
False,
)
# 13. Mismatched lot_id on trusted-store Gate 0V record rejected fail-closed
mis_lot_store = td_path / "mis_lot_store.json"
mis_g0v = build_authenticated_upstream_record(
gate_id="GATE_0V_WHOLEGRAFT",
verdict="PASS_WHOLEGRAFT_GATE0V_AND_STRESS_AP1903",
lot_id="LOT-DIFFERENT-999",
mcb_id=base_full_pass["mcb_id"],
construct_id=base_full_pass["construct_id"],
chassis_id=base_full_pass["chassis_id"],
evidence_summary={"beta_alpha_delta_iec_pericyte_persistent_vp1_ie1_events": 0},
)
write_gate28b_trusted_qualification_store(
mis_lot_store,
upstream_records=[mis_g0v, base_recs["rule_s11_record"], base_recs["gy025_tier6b_record"]],
paired_comparator_records=[base_recs["paired_comparator_record"]],
)
p_lot_mis = copy.deepcopy(base_full_pass)
p_lot_mis["upstream_record_refs"]["gate0v_record_sha256"] = mis_g0v["record_sha256"]
_check_case("mismatched_lot_upstream_gate0v_record_rejected", p_lot_mis, "FAIL_OR_PENDING", False, store=mis_lot_store)
# 14. Tampered record_sha256 reference rejected fail-closed
p_tamp = copy.deepcopy(base_full_pass)
orig_h = p_tamp["upstream_record_refs"]["rule_s11_record_sha256"]
p_tamp["upstream_record_refs"]["rule_s11_record_sha256"] = ("0" if orig_h[0] != "0" else "1") + orig_h[1:]
_check_case("tampered_upstream_record_sha256_rejected", p_tamp, "FAIL_OR_PENDING", False)
# 15. Single complement interval only (lectin omitted) rejected fail-closed per owning GY-025
p_no_lectin = copy.deepcopy(base_full_pass)
p_no_lectin.pop("lectin_c4b2a_l95_pct")
p_no_lectin.pop("lectin_c4b2a_u95_pct")
_check_case("missing_lectin_c4b2a_interval_rejected", p_no_lectin, "FAIL_OR_PENDING", False)
# 16. Classical C4b2a HOLD inconclusive band (L95<=10 < U95) with matched paired head-to-head record!
p_cl_hold, _ = build_valid_gate28b_reference_bundle(
store_path=store_json,
l2v3_broken=True,
candidate_arm_override={"classical_c4b2a_l95_pct": 7.5, "classical_c4b2a_u95_pct": 12.4},
)
_check_case("classical_c4b2a_inconclusive_hold_band", p_cl_hold, "HOLD_UNDERPOWERED_EXPAND_N", False)
# 17. Lectin C4b2a HOLD inconclusive band (L95<=10 < U95) while classical passes, with matched paired head-to-head record!
p_lec_hold, _ = build_valid_gate28b_reference_bundle(
store_path=store_json,
l2v3_broken=True,
candidate_arm_override={"lectin_c4b2a_l95_pct": 6.8, "lectin_c4b2a_u95_pct": 11.9},
)
_check_case("lectin_c4b2a_inconclusive_hold_band", p_lec_hold, "HOLD_UNDERPOWERED_EXPAND_N", False)
# 18. Track-2 B'-SCT blocked
p_tr2 = copy.deepcopy(base_full_pass)
p_tr2["product_track"] = "TRACK_2_B_PRIME_SCT"
_check_case("track2_b_prime_sct_blocked", p_tr2, "FAIL_HARD_STOP", False)
# 19. Non-Core track (e.g. autologous D1b) blocked fail-closed
p_noncore = copy.deepcopy(base_full_pass)
p_noncore["product_track"] = "AUTOLOGOUS_D1B_AUTO_C_V2"
_check_case("non_core_track_autologous_d1b_blocked", p_noncore, "FAIL_HARD_STOP", False)
# 20. Archived CD46_WT hold comparator blocked
p_cd46 = copy.deepcopy(base_full_pass)
p_cd46["construct_id"] = "ABX_L2_v2_CD64T_CD46WT_COMP"
p_cd46["cand034_cd46_tropic_addendum_cleared"] = False
_check_case("cd46wt_archived_hold_blocked", p_cd46, "HOLD_BLOCKED", False)
# 21. Tertiary CFH-CD55 hold comparator blocked
p_cfh = copy.deepcopy(base_full_pass)
p_cfh["construct_id"] = "ABX_L2_v2_CD64T_CFH_CD55_COMP"
_check_case("tertiary_cfh_cd55_hold_blocked", p_cfh, "HOLD_BLOCKED", False)
# 22. Single-cargo attribution control ABX_L2_v2_CTRL_CD64T_ONLY non-promotable
p_ctrl_full = copy.deepcopy(base_full_pass)
p_ctrl_full["construct_id"] = "ABX_L2_v2_CTRL_CD64T_ONLY"
_check_case("single_cargo_control_cd64t_only_non_promotable", p_ctrl_full, "CONTROL_ATTRIBUTION_ONLY_NON_PROMOTABLE", False)
# 23. Short control alias CTRL_CD64T_ONLY non-promotable
p_ctrl_short = copy.deepcopy(base_full_pass)
p_ctrl_short["construct_id"] = "CTRL_CD64T_ONLY"
_check_case("short_alias_control_ctrl_cd64t_only_non_promotable", p_ctrl_short, "CONTROL_ATTRIBUTION_ONLY_NON_PROMOTABLE", False)
# 24. Absent construct_id blocked fail-closed
p_no_cid = copy.deepcopy(base_full_pass)
p_no_cid.pop("construct_id")
_check_case("absent_construct_id_blocked", p_no_cid, "FAIL_HARD_STOP", False)
# 25. Chassis-mismatched incumbent comparator rejected (ISLET1_B with A/X comparator)
p_comp_mis = copy.deepcopy(base_full_pass)
p_comp_mis["chassis_id"] = "ISLET1_B"
_check_case("mismatched_incumbent_comparator_for_chassis_rejected", p_comp_mis, "FAIL_OR_PENDING", False)
# 26. Only 2-copy passes (1-copy fails density) -> manufacturing fail
p_1c = copy.deepcopy(base_full_pass)
p_1c["copy1_monoallelic"]["quantibrite_t0_molecules_per_cell"] = 22000.0
_check_case("monoallelic_1copy_fail_blocks_promotion", p_1c, "FAIL_OR_PENDING", False)
# 27. Pending FcRgamma co-IP blocks promotion
p_fcr = copy.deepcopy(base_full_pass)
p_fcr["fcr_gamma_coip_and_phospho_syk_negative"] = False
_check_case("pending_fcr_gamma_blocks_promotion", p_fcr, "FAIL_OR_PENDING", False)
# 28. Explicit Gate 0V failure blocks promotion even when all CIITA/humoral checks pass