preserves exact `Decimal` on all adjudication-boundary keys (`clustering_design_effect_deff`, `deff`, `measured_ocr`, `uncertainty_se`, `p_bed_mmhg`, `baseline_vasc_ocr_mult`, `floor_mmhg`, `z_one_sided_95`, etc.) so JSON numbers and JSON strings never diverge on precision or sign. - When `max_int_abs` is set (enforced on all operator lot/OCR/store intake files with `MAX_STRICT_JSON_INT_ABS = 10**300`), rejects out-of-float64-range finite JSON integers (e.g. `10**350`, `10**400`) via `parse_int`, raising `StrictJSONDecodeError(reason_code="OUT_OF_RANGE_JSON_INTEGER")`. - Rejects standard syntax errors via `json.JSONDecodeError`. """ if not isinstance(raw_text, str): raise StrictJSONDecodeError( f"Expected JSON text str, got {type(raw_text).__name__}", reason_code="INVALID_JSON_INPUT_TYPE", ) if not _is_strict_int(max_depth) or max_depth < 1: raise StrictJSONDecodeError( f"Invalid max_depth={max_depth!r}", reason_code="INVALID_JSON_MAX_DEPTH", ) _check_json_nesting_depth_iterative(raw_text, max_depth=max_depth) kw: Dict[str, Any] = { "object_pairs_hook": _make_strict_json_object_pairs_hook(bool(preserve_boundary_decimals)), "parse_constant": _strict_json_reject_constant, "parse_float": _strict_json_parse_finite_float, "parse_int": _make_bounded_int_parser(max_int_abs), } try: parsed = json.loads(raw_text, **kw) except RecursionError as exc: raise StrictJSONDecodeError( f"JSON parser recursion limit exceeded (max supported nesting depth={max_depth})", reason_code="JSON_DEPTH_OR_RECURSION_LIMIT_EXCEEDED", ) from exc return _coerce_non_dict_decimals_to_float(parsed) def strict_json_load_file( path: Path, *, max_int_abs: int | None = None, max_depth: int = MAX_JSON_NESTING_DEPTH, preserve_boundary_decimals: bool = True, ) -> Any: """Read UTF-8 text from `path` and decode strictly with `strict_json_loads`.""" return strict_json_loads( path.read_text(encoding="utf-8"), max_int_abs=max_int_abs, max_depth=max_depth, preserve_boundary_decimals=preserve_boundary_decimals, ) def _resolve_roots( repo_root_arg: Path | None = None, investigations_root_arg: Path | None = None, ) -> Tuple[Path, Path | None]: """Resolve OpenIslet science repo root and optional Investigations root portably.""" if repo_root_arg is not None: openislet_root = repo_root_arg.resolve() else: cand_installed = SCRIPT_DIR.parent cand_sibling = SCRIPT_DIR.parents[3] / "OpenIslet" if len(SCRIPT_DIR.parents) >= 4 else cand_installed if (cand_installed / "data" / "extracted" / "context_evidence_graph_v1.json").is_file(): openislet_root = cand_installed elif (cand_sibling / "data" / "extracted" / "context_evidence_graph_v1.json").is_file(): openislet_root = cand_sibling else: openislet_root = cand_installed if investigations_root_arg is not None: inv_root: Path | None = investigations_root_arg.resolve() else: cand_inv = SCRIPT_DIR.parents[2] if len(SCRIPT_DIR.parents) >= 3 else None if cand_inv is not None and (cand_inv / "ideas" / "CEG-DELTA-STAGING.md").is_file(): inv_root = cand_inv else: inv_root = None return openislet_root, inv_root # --------------------------------------------------------------------------- # Default Baseline Protected Pins (Overridable via --protected-manifest at S5) # Playbook is pinned by canonical §4.1.20 section SHA-256 (matching verify_iip0035), # NOT a brittle whole-file hash! # In public-bundle mode (detected via `.openislet_public_bundle`), the two # publisher-redacted study extracts (17375075.json, 39571901.json) are pinned # strictly to their exact public-redacted SHA-256 hashes. # --------------------------------------------------------------------------- IIP0035_17_PROTECTED_FILES_SHA256: Dict[str, str] = { "scripts/wetlab_contract.py": "331ecd2f2d8602dfceae8b89263d0f360cfadfd0638a46d7d668a376294cfc73", "scripts/ingest_wetlab_results.py": "e050593675170515382257ce379449db596c87cc06ffc26d31d128e127630cb1", "data/protocols/wetlab_endpoint_contract_v0.8.0.json": "757bc1d9c2722c129cc4fd5962e8995b9f5bc5f7035f8530f5716da9aa2ac26f", "data/extracted/islet1_multiparadigm_portfolio_v0.8.0.json": "3ed4d53f1756b8b8615fbbc4e9a15755b9ab4968d206da61160eeb04d833cd45", "data/extracted/iip0034_planar_and_portfolio_verification_v0.8.0.json": "e54c7ee4759267befd8f77fc6dd47a72452e2e1c39c1a103bf00281db39f97f1", "data/extracted/iip0033_bilayer_and_respirometry_verification_v0.8.0.json": "bf581a628a69efa41acfc4d5e01de08d36b1c52fc913a0a9c309a27b6b97807e", "data/extracted/islet1_combinatorial_pareto_and_ladder_v0.8.0.json": "460ebc1939eb98b38627eaa7d6603c086e5a75c127fc1ddeced0d5a325305f40", "data/extracted/17375075.json": "b8decbb5b7ef6807b9ed53eddee4159c98d524200dbbfb8601d0dcf02f5ea3b5", "data/extracted/39571901.json": "73d155458b30d631326a5362403e8fa30d03a92a93dbcf44da960e686a3998f1", "data/constructs/islet1_design_b_complete_constructs_v0.8.0.fasta": "4bb20389773c76b2705031ba675487825dfbd94d920a692cde75b7d56af22aa4", "data/constructs/islet1_design_y_fullstack_v2_v0.8.0.fasta": "9826f7917c73f56b62f38db9df0fd61d2ffbf90da3f454392c9f415c16de336c", "data/constructs/islet1_design_y_wildcard_comparators_v0.8.0.fasta": "c7f54b824a73cf9d40247d4fd251cb5c28a8eca4a1530b9661284200bb4cbabc", "data/constructs/islet1_locus1_s10_modeb_comparators_v0.8.0.fasta": "a589ea72144cf1ad2cfa82e9b08c22e075746c63a9264e276a3bd4ec3f896854", "data/constructs/islet1_locus2_ciita_modeb_comparators_v0.8.0.fasta": "25ffcb10e2bad77a4b34725c7eff0532990ebf7b80864cf7217d33f5ccbe5b6d", "data/constructs/islet1_locus3_multimir_modeb_comparators_v0.8.0.fasta": "22df54a27ef3f68b646b63dc036b11f5a66a9fcadb50378dfb8057e108c79ffa", "data/constructs/islet1_scenario_a_constructs_v0.7.0.fasta": "b5ba4e2b4bbbcc7d6cf1138975c5fae5c6ab074dda43973f071c671cd8cd1d88", "data/constructs/nm_021999_5_archival_mrna.fasta": "4a4cb15d0544884a62d86ebf4137c5284edad8210b6e32e74c2eb0aff005d13e", } PUBLIC_BUNDLE_REDACTED_FILES_SHA256: Dict[str, str] = { "data/extracted/17375075.json": "04338bd37bf6149aacc1d8153f7455ee1a4e4a71fa8398dff1c77ced66eac48b", "data/extracted/39571901.json": "fd0fea4c563a674ed67c6f9ae260a38ab7d204c4238cfa19bf3671de457a45e7", } IIP0035_OWN_FROZEN_OUTPUTS_SHA256: Dict[str, str] = { "data/constructs/islet1_d1b_auto_v2_v0.8.0.fasta": "36b5c38181fd6d9409e82d53edee16130f4309e08c481a59055d705de4f01974", "data/extracted/iip0035_d1b_auto_and_portfolio_verification_v0.8.0.json": "9d3252b780f14781154a7b969c5ada4907e037c19da1a8559e4977ce1ebe81d5", "data/extracted/islet1_5arm_autologous_portfolio_v0.8.0.json": "31320c0e6ac039773c2ca58160f064e8655d1a58b97050a713dfbf00d283ff99", } PLAYBOOK_SEC4120_EXPECTED_SHA256 = "e3fb5ec701678dfdeb62a77c15866327842b60b6b4c503cb86dfc79885a626a8" GRAVEYARD_GUARDRAIL_ID = "OFFGRID_GUARD_020_BETA_ONLY_VIRAL_GATE_AND_UNVERIFIED_STRESSED_AP1903_ERASURE" GRAVEYARD_CARD_ID = "GY-030" TRUSTED_STORE_SCHEMA_VERSION = "0.8.0-iip0043-trusted-qualification-store-v1" BANK_QUAL_RECORD_SCHEMA_VERSION = "0.8.0-iip0043-bank-qual-record-v2" PROC_QUAL_RECORD_SCHEMA_VERSION = "0.8.0-iip0043-d1b-proc-qual-record-v2" # 5 living graft lineages in OpenIslet Islet-1 (500,000 IEQ = 8.00e8 endocrine + 1.335e8 vascular = 9.335e8 total cells) GRAFT_LINEAGES: Tuple[str, ...] = ("beta", "alpha", "delta", "plvap_iec", "pericyte") GRAFT_COMPOSITION_CELLS: Dict[str, int] = { "beta": 480_000_000, # 60% of 8.00e8 endocrine (51.4194% of total graft) "alpha": 240_000_000, # 30% of 8.00e8 endocrine (25.7097% of total graft) "delta": 80_000_000, # 10% of 8.00e8 endocrine (8.5699% of total graft) "plvap_iec": 100_125_000, # 75% of 1.335e8 vascular stroma (10.7258% of total graft) "pericyte": 33_375_000, # 25% of 1.335e8 vascular stroma (3.5753% of total graft) } TOTAL_GRAFT_CELLS: int = sum(GRAFT_COMPOSITION_CELLS.values()) # 933,500,000 GATE0V_PATHOGENS: Tuple[str, ...] = ("cvb4_e2", "cvb3", "hcmv") HCMV_REQUIRED_DDPCR_TARGETS: Tuple[str, ...] = ("UL138", "UL55") CVB_REQUIRED_DDPCR_TARGETS: Tuple[str, ...] = ( "CVB_5PRIME_DELETION_POS_RNA", "CVB_5PRIME_DELETION_NEG_RNA", ) CD46_ADDENDUM_VIRUSES: Tuple[str, ...] = ( "hhv6a", "measles_edmonston_vaccine_strain", "adenovirus_group_b", ) CD55_REQUIRED_ECHOVIRUS_STRAINS: Tuple[str, ...] = ( "echovirus_7", "echovirus_11", ) ALLOWED_ECTOPIC_RECEPTORS = frozenset({"CD46_WT", "CD55_FULL_LENGTH"}) # Explicit canonical ectopic viral-receptor registry (ZERO substring inference!). # Products expressing only the 37-aa CD55(345-381) GPI stalk on CD47-IgV-GPI do NOT # express full-length DAF/CD55 and are intentionally excluded from CD55_FULL_LENGTH. CANONICAL_ECTOPIC_VIRAL_RECEPTORS: Dict[str, Tuple[str, ...]] = { "ISLET1_Y_FULLSTACK_V2_B2M_11TU": ("CD46_WT",), "ISLET1_D1_AUTO_V2_L1B_CIITA_CD64T_CD46WT_COMPARATOR": ("CD46_WT",), "ABX_L2_v2_CD64T_CD46WT_COMP": ("CD46_WT",), "ABX_L2_v2_CTRL_CD46WT_ONLY": ("CD46_WT",), "ISLET1_Y_FULLSTACK_V2_CD55_CFH_COMPARATOR": ("CD55_FULL_LENGTH",), "ABX_L2_v2_CD64T_CFH_CD55_COMP": ("CD55_FULL_LENGTH",), } ALLOWED_QUALIFICATION_TIERS = frozenset({ "BANK_QUALIFICATION", "LOT_RELEASE_SURROGATE", "AUTOLOGOUS_D1B_PROCESS_QUAL", }) # R12-B1: Minimum independent biological units and canonical sampling-unit class allowlist. MIN_INDEPENDENT_BIOLOGICAL_UNITS_N: int = 6 ALLOWED_INDEPENDENT_SAMPLING_UNIT_CLASSES: Tuple[str, ...] = ( "INDEPENDENT_SINGLE_CELL_OR_LIMITING_DILUTION_UNIT", "RECONCILED_MULTI_WELL_CELL_ASSAY_WITH_UNIT_PARTITION", ) # R13-B4: Machine-readable software qualification scope emitted directly on live PASS results # across all tiers (explicitly separating modeled Stage-0 software checks from physical qualification). QUALIFICATION_SCOPE_MODELED_PENDING_PHYSICAL: str = ( "CONDITIONAL_ON_MODELED_ASSUMPTIONS_PENDING_PHYSICAL_QUALIFICATION" ) # R04-B1: Strict canonical product-family-to-qualification-tier allowlist. # AUTOLOGOUS_D1B_PROCESS_QUAL is strictly restricted to canonical autologous D1b-Auto-C # variants (ISLET1_D1_AUTO_*); BANK_QUALIFICATION and LOT_RELEASE_SURROGATE are restricted # to allogeneic MCB-banked product families (including IIP-0041 allogeneic ABX side-contract donors). PRODUCT_TIER_FAMILY_ALLOWED_TIERS: Dict[str, Tuple[str, ...]] = { "ALLOGENEIC_MCB_BANKED": ("BANK_QUALIFICATION", "LOT_RELEASE_SURROGATE"), "ALLOGENEIC_ABX_SIDE_CONTRACT": ("BANK_QUALIFICATION", "LOT_RELEASE_SURROGATE"), "AUTOLOGOUS_D1B_AUTO_C": ("AUTOLOGOUS_D1B_PROCESS_QUAL",), } # R04-B5 + R17-B2: Provably outward-conservative one-sided >=95% standard-normal quantile # z_{0.95} > Phi^{-1}(0.95) = 1.644853626951472714863848907991632136083195744275322071769672094... # (applicable ONLY to explicitly declared KNOWN_SIGMA_NORMAL measurement models with external # calibration provenance). Both the 60-digit Decimal constant and its upward-rounded IEEE-754 # float64 value strictly satisfy 1 - Phi(z) <= 0.05 (eliminating the ~5.39e-17 undercoverage of # float 1.6448536269514722). MIN_NW08_CONSERVATIVE_Z_ONE_SIDED_95_DEC: Decimal = Decimal( "1.644853626951472714863848907991632136083195744275322071769673" ) MIN_NW08_CONSERVATIVE_Z_ONE_SIDED_95: float = 1.6448536269514729 # R14-B2: Canonical NW-08 measured-OCR inferential uncertainty models (NIST §8.6 compliant). # Small-sample estimated SE requires STUDENT_T_ESTIMATED_SE with integer replicates/df (using exact # one-sided 95% Student-t critical value t_{0.95, df}), or INDEPENDENT_JUSTIFIED_UPPER_BOUND with # explicit provenance, or KNOWN_SIGMA_NORMAL strictly scoped to externally known sigma provenance. NW08_OCR_UNCERTAINTY_MODEL_ZERO_POINT: str = "ZERO_UNCERTAINTY_DETERMINISTIC_POINT" NW08_OCR_UNCERTAINTY_MODEL_STUDENT_T: str = "STUDENT_T_ESTIMATED_SE" NW08_OCR_UNCERTAINTY_MODEL_KNOWN_SIGMA: str = "KNOWN_SIGMA_NORMAL" NW08_OCR_UNCERTAINTY_MODEL_INDEPENDENT_UPPER: str = "INDEPENDENT_JUSTIFIED_UPPER_BOUND" NW08_ALLOWED_OCR_UNCERTAINTY_MODELS = frozenset({ NW08_OCR_UNCERTAINTY_MODEL_ZERO_POINT, NW08_OCR_UNCERTAINTY_MODEL_STUDENT_T, NW08_OCR_UNCERTAINTY_MODEL_KNOWN_SIGMA, NW08_OCR_UNCERTAINTY_MODEL_INDEPENDENT_UPPER, }) MAX_NW08_STUDENT_T_DF: int = 10 ** 9 # R05-B2: Immutable canonical GSIS oxygen safety floor for NW-08 release adjudication (mmHg). # Alternate diagnostic floors may be reported separately, but NEVER alter canonical release pass/verdict! CANONICAL_NW08_PO2_FLOOR_MMHG: float = 15.0 # R14-B1 + R15-B2: Predeclared 3-grid numerical convergence verification policy (NASA / Roache GCI & ASME V&V-20). # Any solve within its route-family near-floor screening band around 15.0 mmHg executes the predeclared # refinement ladder; cases whose coarse-to-medium grids directly cross 15.0 mmHg or whose 3-grid # conservative discretization interval straddles 15.0 mmHg route to unresolved HOLD (exit 2) before any # coupled release authorization. Monotone sequences with sub-asymptotic slow observed order (`p_obs < 0.5`), # non-positive/unverifiable order, extreme super-convergence (`p_obs > 2.5`), or non-asymptotic acceleration # toward 15.0 mmHg NEVER clamp `p` upward to shrink GCI and instead route fail-closed to unresolved HOLD # (`HOLD_NW08_MESH_CONVERGENCE_UNQUALIFIED_SLOW_OR_NON_ASYMPTOTIC_ORDER`, exit 2, `interval_valid = False`). NW08_MESH_CONVERGENCE_POLICY_VERSION: str = "NW08_THREE_GRID_CONVERGENCE_HOLD_POLICY_V2" NW08_MESH_CONVERGENCE_TRIGGER_BAND_MMHG: float = 0.25 NW08_MESH_CONVERGENCE_TRIGGER_BANDS_BY_FAMILY: Dict[str, Tuple[float, float]] = { "R1": (-0.12, 0.25), "R2": (-0.25, 0.25), "R3P": (-0.30, 0.30), } NW08_MESH_CONVERGENCE_SAFETY_FACTOR_FS: float = 1.25 NW08_MESH_CONVERGENCE_MIN_ADMISSIBLE_ORDER_P: float = 0.5