From 14fdd90b49ed697cdefba5749f407a21dbadf4a7 Mon Sep 17 00:00:00 2001 From: Gocceri Date: Fri, 9 Oct 2026 22:24:53 +0300 Subject: [PATCH 01/12] test(v5): gate manuscript development evidence provenance Signed-off-by: Gocceri --- ...SCRIPT_SOURCE_EVIDENCE_AUDIT_2026-10-09.md | 28 +++ ...5_manuscript_development_evidence_audit.py | 179 ++++++++++++++++++ ...t_manuscript_development_evidence_audit.py | 71 +++++++ 3 files changed, 278 insertions(+) create mode 100644 docs/research/paper-rebuild-v2-2026-10-02/V5_MANUSCRIPT_SOURCE_EVIDENCE_AUDIT_2026-10-09.md create mode 100644 scripts/v5_manuscript_development_evidence_audit.py create mode 100644 tests/reliability_v5/test_manuscript_development_evidence_audit.py diff --git a/docs/research/paper-rebuild-v2-2026-10-02/V5_MANUSCRIPT_SOURCE_EVIDENCE_AUDIT_2026-10-09.md b/docs/research/paper-rebuild-v2-2026-10-02/V5_MANUSCRIPT_SOURCE_EVIDENCE_AUDIT_2026-10-09.md new file mode 100644 index 00000000..9b48c1fe --- /dev/null +++ b/docs/research/paper-rebuild-v2-2026-10-02/V5_MANUSCRIPT_SOURCE_EVIDENCE_AUDIT_2026-10-09.md @@ -0,0 +1,28 @@ +# V5 immutable manuscript development-evidence source audit — 2026-10-09 + +Status: `DEVELOPMENT_ONLY_INTEGRITY_GATE; NOT_CONFIRMATORY_OR_PUBLICATION_AUTHORITY`. + +## Purpose + +An earlier manuscript addendum accurately distinguished completed development/calibration measurements from not-yet-executed confirmatory study results. A textual crosswalk alone is vulnerable to subsequent evidence edits or provenance drift. The read-only, model-free `scripts/v5_manuscript_development_evidence_audit.py` turns the crosswalk's fixed inputs and restrictions into a fail-closed check without modifying prospectively frozen manuscript, claim-ledger, red-team or data-generation files. + +## Reproducibility + +Run from the repository checkout: + +```sh +python3 scripts/v5_manuscript_development_evidence_audit.py +PYTHONPATH=src python3 -m pytest -q tests/reliability_v5/test_manuscript_development_evidence_audit.py +``` + +The audit verifies SHA-256 of eight precisely named versioned inputs (independent R1/R2 verifier receipts, paired repeatability, prospectively frozen domain floors, computed benchmark margins, development source-task SD inventory, B1/C1/C2 seed synthesis, and the manuscript crosswalk) plus the original two R1/R2 Kaggle ZIPs. It rejects source drift, missing files, escaped paths, non-development scope, false clinical/publication approval, false power-family freeze, missing source-task cells, nonfinite SD, modified metric family, changed repeatability95 or post-hoc margin adjustment. + +The model-free frozen-entry manifest is checked on each run: all **307** original hash-bound entry files, including the original manuscript/claim ledger, must stay unchanged. The script also verifies that each original repeat has a distinct named Kaggle kernel, a valid independent archived export-verifier receipt, full 16,384-row coverage, and the exact pinned public RiskCalcs source identity. + +## Scope and limitations + +**PASS** means only that retained, independently verified development input files match this exact immutable report snapshot and satisfy the narrow admission checks. It is **not** a fresh independent Kaggle execution, an independent human or LLM peer review, proof of model performance, statistical power, scientific independence beyond the cited run provenance, clinical utility, medical safety, or permission to proceed to confirmatory/reserve materialization. A different source version requires a new reviewed evidence binding; the script is intentionally not a general-purpose permissive importer. + +The four research-scale margins are study-defined nonclinical effect scales; the three trained seeds' within-source-task paired SDs are **descriptive** and do not substitute for a reviewed source-and-training-seed variance model. The primary hard-gate non-target hypothesis family and its count remain unfrozen, so the fixed 4,096-source-cluster design cannot be declared to meet 90% power. No V5-C01–V5-C07 empirical claim is promoted by this guard. + +Repository branch/PR work is DCO-signed off only until GitHub independently verifies cryptographic signatures. Genuine zero-cost Alibaba OCR delegation eligibility and a host audit must not be represented as independent model or methodological review. No PHI, paid APIs/compute, new scientific inference or altered frozen source was used to build this offline qualification utility. diff --git a/scripts/v5_manuscript_development_evidence_audit.py b/scripts/v5_manuscript_development_evidence_audit.py new file mode 100644 index 00000000..dfbc4883 --- /dev/null +++ b/scripts/v5_manuscript_development_evidence_audit.py @@ -0,0 +1,179 @@ +#!/usr/bin/env python3 +"""Fail-closed, model-free provenance gate for a V5 development-only manuscript addendum. + +This is a read-only evidence audit, not a clinical, inferential, peer-review, or +publication qualification. Its SHA bindings are a dated snapshot: changing the +inputs requires a separately reviewed update rather than silent reinterpretation. +""" +from __future__ import annotations + +import hashlib +import json +import math +from pathlib import Path +from typing import Any + +ROOT = Path(__file__).resolve().parents[1] +DEV = "artifacts/v5/development/" +RUNS = DEV + "s1-kaggle-repeatability-runs/" +DOC = "docs/research/paper-rebuild-v2-2026-10-02/" +RISKCALCS_SHA256 = "00a7a0089afffb66f2f32903bad94a5a2ea842841defb2d78e0686b0a5eb9ab9" + +# The immutable receipts, scientific metrics, frozen floor and reporting text are +# locked at the exact evidence state qualified on 2026-10-09. +LOCKED_SOURCES: dict[str, tuple[str, str]] = { + "r1_receipt": (RUNS + "repeat-1-v1-2026-10-09/export-verification-receipt.json", "b445406380ea967ce8bb8bc7a61efe1cd48ade50e03f6c0eabba6e559d58eb53"), + "r2_receipt": (RUNS + "repeat-2-v1-2026-10-09/export-verification-receipt.json", "f55e1b0271918538c16d347a1e91b0aeeece47acb84aa4314f3cc3169e45b4a2"), + "paired": (RUNS + "paired-r1-r2-repeatability95-2026-10-09.json", "f6ace697d61de05c470c1260dafc7b54f13524b0dd2960e45c268c46bb7e64be"), + "margins": (RUNS + "final-development-benchmark-margins-2026-10-09.json", "361ad34e0c2deb0ca7646cfb9dd9346bb63471296a003e9ef12a858743f6917f"), + "floors": (DEV + "domain-floor-freeze-2026-10-09/domain-floors.json", "8c284a98f504c8529a4da5d9bb1e265465af66b10d0c3b0414505dcebc9c7ca7"), + "sd_inventory": (DEV + "s1-paired-sd-inventory-2026-10-09/development-paired-sd.json", "b1edf781b61d3f5ce227c08908ca43ad9864c0b398a7318c33895951af37bacd"), + "synthesis": (DEV + "s1-development-synthesis-2026-10-09/final-synthesis.json", "76b7f7503a743991fd81f4e1758d5710cc646a0a665c1e3e2128d1e533ea2e82"), + "crosswalk": (DOC + "V5_MANUSCRIPT_DEVELOPMENT_RESULTS_CROSSWALK_2026-10-09.md", "cc70f46824269712135678de7a182da45a459f10bfc1aa19e4d65e4c9b4665ae"), +} +ORIGINAL_ARCHIVES = { + 1: (RUNS + "repeat-1-v1-2026-10-09/original-export.zip", "dfb35b0216369bbb87bcec75c5715df974bb9f736c0db0af98148cea91d99dac"), + 2: (RUNS + "repeat-2-v1-2026-10-09/original-export.zip", "73f24c06f2d54e34cc20f2137f06b0728f02cccfc0d96c346f619d73184e4216"), +} +METRICS = ("canonical_accuracy", "canonical_nll", "canonical_brier", "semantic_js") +SECONDARY = ("transformed_accuracy", "transformed_nll", "transformed_brier") +SPLITS = ("S1_DEV_EVAL", "S1_CAL_EVAL") + + +class ManuscriptEvidenceAuditError(ValueError): + """Fail-closed when a source identity, result or reporting bound changes.""" + + +def _check(condition: bool, code: str) -> None: + if not condition: + raise ManuscriptEvidenceAuditError(code) + + +def _digest(path: Path) -> str: + digest = hashlib.sha256() + with path.open("rb") as stream: + for part in iter(lambda: stream.read(1024 * 1024), b""): + digest.update(part) + return digest.hexdigest() + + +def _locked_file(root: Path, relative: str, expected: str) -> Path: + path = root / relative + _check(path.resolve().is_relative_to(root.resolve()), "SOURCE_ESCAPES_REPOSITORY") + _check(path.is_file(), "MISSING_LOCKED_SOURCE:" + relative) + _check(_digest(path) == expected, "SOURCE_SHA256_MISMATCH:" + relative) + return path + + +def _finite_number(value: Any) -> bool: + return type(value) in (int, float) and math.isfinite(value) + + +def assert_development_semantics(records: dict[str, Any]) -> dict[str, Any]: + """Inspect already SHA-locked payloads; never infer clinical/power approval.""" + r1, r2 = records["r1_receipt"], records["r2_receipt"] + for index, receipt in ((1, r1), (2, r2)): + _check(receipt.get("repeat") == index and type(receipt.get("repeat")) is int, "WRONG_REPEAT_IDENTITY") + _check(receipt.get("status") == "PASS_MODEL_FREE_REPEATABILITY_EXPORT_VERIFICATION", "REPEAT_NOT_INDEPENDENTLY_VERIFIED") + _check(receipt.get("ordered_rows_verified") == 16384 and receipt.get("source_task_count_verified") == 8192, "INCOMPLETE_REPEAT_MATRIX") + _check(receipt.get("riskcalcs_sha256") == RISKCALCS_SHA256, "REPEAT_SOURCE_DRIFT") + _check(receipt.get("durable_export_verified") is True and receipt.get("model_weights_loaded") is False, "REPEAT_EVIDENCE_INVALID") + _check(receipt.get("confirmatory") is False and receipt.get("reserve") is False and receipt.get("clinical_validity") is False, "REPEAT_SCOPE_ESCALATION") + _check(receipt.get("scientific_replication") is False and receipt.get("spend_usd") == 0, "REPEAT_SCOPE_ESCALATION") + _check(receipt.get("kernel") == f"abdulazizshehri/commandmed-v5-base-repeatability-r{index}", "REPEAT_KERNEL_PROVENANCE_MISMATCH") + _check(receipt.get("kernel_version") == 1, "KERNEL_VERSION_MISMATCH") + + pair = records["paired"] + _check(pair.get("scope") == "DEVELOPMENT_CALIBRATION_ONLY", "PAIRED_SCOPE") + _check(pair.get("confirmatory") is False and pair.get("reserve") is False, "PAIRED_SCOPE") + _check(pair.get("repeat_count") == 2 and pair.get("eval_task_count") == 7680, "PAIRED_SAMPLE_MISMATCH") + _check(tuple(pair.get("primary_metrics", ())) == METRICS and tuple(pair.get("secondary_metrics", ())) == SECONDARY, "PAIRED_METRIC_DRIFT") + for name in METRICS + SECONDARY: + val = pair["metrics"][name]["repeatability95"] + _check(_finite_number(val) and val == 0.0, "PAIRED_REPEATABILITY_CHANGED:" + name) + + floors, margins = records["floors"], records["margins"] + _check(floors.get("status") == "FROZEN_PROSPECTIVELY_BEFORE_REPEATABILITY_OUTPUT", "FLOORS_NOT_PROSPECTIVE") + _check(floors.get("clinical_tolerance") is False and floors.get("derived_from_observed_intervention_effects") is False, "FLOOR_CLINICAL_OR_POSTHOC") + _check(margins.get("scope") == "DEVELOPMENT_ONLY" and margins.get("clinical_validity") is False, "MARGINS_CLINICAL_SCOPE") + _check(margins.get("confirmatory") is False and margins.get("reserve") is False and margins.get("publication_authorized") is False, "MARGINS_SCOPE_ESCALATION") + _check(margins.get("power_plan_status") == "PENDING_PAIRED_SD_AND_FROZEN_PRIMARY_NON_TARGET_FAMILY_SIZE", "POWER_CLAIM_UNQUALIFIED") + _check(set(margins["metrics"]) == set(METRICS) == set(floors["metrics"]), "MARGIN_FAMILY_DRIFT") + for name in METRICS: + floor = floors["metrics"][name]["domain_floor"] + m = margins["metrics"][name] + _check(_finite_number(floor) and floor > 0, "INVALID_FLOOR:" + name) + _check(m.get("frozen_benchmark_scale_domain_floor") == floor and m.get("meaningful_margin") == floor, "MARGIN_POSTHOC_DRIFT:" + name) + _check(m.get("verified_repeatability95") == 0 and m.get("clinical_tolerance") is False, "MARGIN_SCOPE_ESCALATION:" + name) + + inventory, synthesis = records["sd_inventory"], records["synthesis"] + _check(inventory.get("confirmatory") is False and inventory.get("reserve") is False and inventory.get("confirmatory_power_claim") is False, "SD_FALSE_CONFIRMATORY") + _check(inventory.get("primary_non_target_family_size") is None, "POSTHOC_FAMILY_SIZE") + _check(inventory.get("training_seed_uncertainty_not_included_in_paired_item_sd") is True, "SD_SEED_UNCERTAINTY_ERASED") + _check(tuple(inventory.get("primary_metrics", ())) == METRICS, "SD_METRIC_DRIFT") + interventions = inventory.get("intervention_results") + _check(isinstance(interventions, dict) and set(interventions) == {f"{prefix}_{seed}" for prefix in ("B1", "C1", "C2") for seed in (11,29,47)}, "SD_INTERVENTION_SET_DRIFT") + cells = 0 + for intervention in interventions.values(): + _check(set(intervention["splits"]) == set(SPLITS), "SD_SPLIT_DRIFT") + for split in SPLITS: + _check(set(intervention["splits"][split]) == set(METRICS), "SD_CELL_SET_DRIFT") + for name in METRICS: + cell = intervention["splits"][split][name] + _check(cell["task_count"] == 3840 and _finite_number(cell["paired_source_task_sample_sd"]) and cell["paired_source_task_sample_sd"] >= 0, "INVALID_SD_CELL") + cells += 1 + _check(cells == 72, "INCOMPLETE_72_CELL_INVENTORY") + _check(synthesis.get("confirmatory") is False and synthesis.get("reserve") is False, "SYNTHESIS_SCOPE_ESCALATION") + _check(synthesis.get("claim_promotion") in (False, "NONE"), "UNAUTHORIZED_CLAIM_PROMOTION") + return { + "status": "PASS_DEVELOPMENT_ONLY_EVIDENCE_ADMISSION", + "original_repeatability_runs_verified": 2, + "ordered_rows_per_run": 16384, + "paired_source_eval_tasks": 7680, + "descriptive_sd_cells": cells, + "frozen_primary_metrics": len(METRICS), + "repeatability95_all_seven_zero": True, + "clinical_validity": False, + "confirmatory": False, + "reserve": False, + "power_adequacy": "NOT_QUALIFIED", + "publication_authority": False, + "independent_peer_review": False, + } + + +def audit(root: Path = ROOT) -> dict[str, Any]: + root = root.resolve() + records: dict[str, Any] = {} + for name, (relative, digest) in LOCKED_SOURCES.items(): + path = _locked_file(root, relative, digest) + if name != "crosswalk": + try: + records[name] = json.loads(path.read_text(encoding="utf-8")) + except (UnicodeError, ValueError) as exc: + raise ManuscriptEvidenceAuditError("INVALID_JSON_SOURCE:" + name) from exc + for index, (relative, digest) in ORIGINAL_ARCHIVES.items(): + path = _locked_file(root, relative, digest) + _check(records[f"r{index}_receipt"].get("archive_sha256") == digest, "ARCHIVE_RECEIPT_MISMATCH") + result = assert_development_semantics(records) + + # Recheck each original frozen entry directly. Never silently edit the + # prospective paper/manuscript/claim ledger to match this addendum. + binding = root / DOC / "V5_S1_KAGGLE_RUNTIME_AMENDMENT_BINDINGS_2026-10-08.json" + b = json.loads(binding.read_text(encoding="utf-8")) + frozen = b["unchanged_entry_files"] + _check(len(frozen) == 307, "FROZEN_ENTRY_COUNT_CHANGED") + for row in frozen: + _locked_file(root, row["path"], row["sha256"]) + result.update(frozen_source_files_verified=307, locked_evidence_sources=len(LOCKED_SOURCES), + original_archives_verified=len(ORIGINAL_ARCHIVES)) + return result + + +def main() -> int: + print(json.dumps(audit(), indent=2, sort_keys=True)) + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/tests/reliability_v5/test_manuscript_development_evidence_audit.py b/tests/reliability_v5/test_manuscript_development_evidence_audit.py new file mode 100644 index 00000000..388b3b8f --- /dev/null +++ b/tests/reliability_v5/test_manuscript_development_evidence_audit.py @@ -0,0 +1,71 @@ +"""Regression controls for the immutable development-only manuscript claim gate.""" +from __future__ import annotations + +import copy +import json +import sys +from pathlib import Path + +import pytest + +sys.path.insert(0, str(Path(__file__).resolve().parents[2] / "scripts")) +import v5_manuscript_development_evidence_audit as audit + + +def _records() -> dict: + return { + name: json.loads((audit.ROOT / path).read_text(encoding="utf-8")) + for name, (path, _) in audit.LOCKED_SOURCES.items() + if name != "crosswalk" + } + + +def test_real_immutable_evidence_and_all_307_frozen_entries() -> None: + result = audit.audit() + assert result["status"] == "PASS_DEVELOPMENT_ONLY_EVIDENCE_ADMISSION" + assert result["descriptive_sd_cells"] == 72 + assert result["frozen_source_files_verified"] == 307 + assert result["confirmatory"] is False + assert result["independent_peer_review"] is False + + +def test_scope_escalation_rejected_for_repeat_and_margins() -> None: + for section, key in (("r1_receipt", "confirmatory"), ("r2_receipt", "reserve"), + ("margins", "publication_authorized"), ("sd_inventory", "confirmatory_power_claim")): + records = _records() + records[section][key] = True + with pytest.raises(audit.ManuscriptEvidenceAuditError): + audit.assert_development_semantics(records) + + +def test_fake_power_family_or_shrunk_margin_rejected() -> None: + records = _records() + records["sd_inventory"]["primary_non_target_family_size"] = 1 + with pytest.raises(audit.ManuscriptEvidenceAuditError, match="POSTHOC_FAMILY_SIZE"): + audit.assert_development_semantics(records) + records = _records() + records["margins"]["metrics"]["canonical_accuracy"]["meaningful_margin"] = 0.001 + with pytest.raises(audit.ManuscriptEvidenceAuditError, match="MARGIN_POSTHOC_DRIFT"): + audit.assert_development_semantics(records) + + +def test_missing_or_invalid_source_is_fail_closed(tmp_path: Path) -> None: + path, sha = audit.LOCKED_SOURCES["crosswalk"] + with pytest.raises(audit.ManuscriptEvidenceAuditError, match="MISSING_LOCKED_SOURCE"): + audit._locked_file(tmp_path, path, sha) + full = tmp_path / path + full.parent.mkdir(parents=True) + full.write_text("forged development outcome\n", encoding="utf-8") + with pytest.raises(audit.ManuscriptEvidenceAuditError, match="SOURCE_SHA256_MISMATCH"): + audit._locked_file(tmp_path, path, sha) + + +def test_nonfinite_sd_and_changed_repeatability_rejected() -> None: + records = _records() + records["sd_inventory"]["intervention_results"]["B1_11"]["splits"]["S1_DEV_EVAL"]["canonical_accuracy"]["paired_source_task_sample_sd"] = float("nan") + with pytest.raises(audit.ManuscriptEvidenceAuditError, match="INVALID_SD_CELL"): + audit.assert_development_semantics(records) + records = _records() + records["paired"]["metrics"]["canonical_accuracy"]["repeatability95"] = 0.001 + with pytest.raises(audit.ManuscriptEvidenceAuditError, match="PAIRED_REPEATABILITY_CHANGED"): + audit.assert_development_semantics(records) From 076f74cfa1e4ae7c0915a667a11af2b1a96a90d2 Mon Sep 17 00:00:00 2001 From: Gocceri Date: Fri, 9 Oct 2026 22:30:14 +0300 Subject: [PATCH 02/12] fix(v5): pin immutable evidence manifest itself Signed-off-by: Gocceri --- ...V5_MANUSCRIPT_SOURCE_EVIDENCE_AUDIT_2026-10-09.md | 2 +- scripts/v5_manuscript_development_evidence_audit.py | 7 ++++++- .../test_manuscript_development_evidence_audit.py | 12 ++++++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/docs/research/paper-rebuild-v2-2026-10-02/V5_MANUSCRIPT_SOURCE_EVIDENCE_AUDIT_2026-10-09.md b/docs/research/paper-rebuild-v2-2026-10-02/V5_MANUSCRIPT_SOURCE_EVIDENCE_AUDIT_2026-10-09.md index 9b48c1fe..253026a6 100644 --- a/docs/research/paper-rebuild-v2-2026-10-02/V5_MANUSCRIPT_SOURCE_EVIDENCE_AUDIT_2026-10-09.md +++ b/docs/research/paper-rebuild-v2-2026-10-02/V5_MANUSCRIPT_SOURCE_EVIDENCE_AUDIT_2026-10-09.md @@ -17,7 +17,7 @@ PYTHONPATH=src python3 -m pytest -q tests/reliability_v5/test_manuscript_develop The audit verifies SHA-256 of eight precisely named versioned inputs (independent R1/R2 verifier receipts, paired repeatability, prospectively frozen domain floors, computed benchmark margins, development source-task SD inventory, B1/C1/C2 seed synthesis, and the manuscript crosswalk) plus the original two R1/R2 Kaggle ZIPs. It rejects source drift, missing files, escaped paths, non-development scope, false clinical/publication approval, false power-family freeze, missing source-task cells, nonfinite SD, modified metric family, changed repeatability95 or post-hoc margin adjustment. -The model-free frozen-entry manifest is checked on each run: all **307** original hash-bound entry files, including the original manuscript/claim ledger, must stay unchanged. The script also verifies that each original repeat has a distinct named Kaggle kernel, a valid independent archived export-verifier receipt, full 16,384-row coverage, and the exact pinned public RiskCalcs source identity. +The model-free frozen-entry manifest is checked on each run: all **307** original hash-bound entry files, including the original manuscript/claim ledger, must stay unchanged. **The entry-file manifest itself is separately SHA-256 pinned** as `c33e603e531b5f3957a0fbe5fa63d45f070e21e2243b268af232516990dd428f`, because it is not one of the 307 self-described entries. Otherwise a coordinated rewrite of both the manifest and its referenced evidence could pass the entry loop. Duplicate manifest paths are rejected, too. The script also verifies that each original repeat has a distinct named Kaggle kernel, a valid independent archived export-verifier receipt, full 16,384-row coverage, and the exact pinned public RiskCalcs source identity. ## Scope and limitations diff --git a/scripts/v5_manuscript_development_evidence_audit.py b/scripts/v5_manuscript_development_evidence_audit.py index dfbc4883..c4c431d3 100644 --- a/scripts/v5_manuscript_development_evidence_audit.py +++ b/scripts/v5_manuscript_development_evidence_audit.py @@ -18,6 +18,8 @@ RUNS = DEV + "s1-kaggle-repeatability-runs/" DOC = "docs/research/paper-rebuild-v2-2026-10-02/" RISKCALCS_SHA256 = "00a7a0089afffb66f2f32903bad94a5a2ea842841defb2d78e0686b0a5eb9ab9" +FROZEN_BINDINGS_RELATIVE = DOC + "V5_S1_KAGGLE_RUNTIME_AMENDMENT_BINDINGS_2026-10-08.json" +FROZEN_BINDINGS_SHA256 = "c33e603e531b5f3957a0fbe5fa63d45f070e21e2243b268af232516990dd428f" # The immutable receipts, scientific metrics, frozen floor and reporting text are # locked at the exact evidence state qualified on 2026-10-09. @@ -159,10 +161,13 @@ def audit(root: Path = ROOT) -> dict[str, Any]: # Recheck each original frozen entry directly. Never silently edit the # prospective paper/manuscript/claim ledger to match this addendum. - binding = root / DOC / "V5_S1_KAGGLE_RUNTIME_AMENDMENT_BINDINGS_2026-10-08.json" + # The manifest is *not* among its own 307 entries. Pin its original SHA + # separately or a coordinated manifest+source rewrite could falsely pass. + binding = _locked_file(root, FROZEN_BINDINGS_RELATIVE, FROZEN_BINDINGS_SHA256) b = json.loads(binding.read_text(encoding="utf-8")) frozen = b["unchanged_entry_files"] _check(len(frozen) == 307, "FROZEN_ENTRY_COUNT_CHANGED") + _check(len({row["path"] for row in frozen}) == 307, "DUPLICATE_FROZEN_ENTRY_PATH") for row in frozen: _locked_file(root, row["path"], row["sha256"]) result.update(frozen_source_files_verified=307, locked_evidence_sources=len(LOCKED_SOURCES), diff --git a/tests/reliability_v5/test_manuscript_development_evidence_audit.py b/tests/reliability_v5/test_manuscript_development_evidence_audit.py index 388b3b8f..da8c8806 100644 --- a/tests/reliability_v5/test_manuscript_development_evidence_audit.py +++ b/tests/reliability_v5/test_manuscript_development_evidence_audit.py @@ -69,3 +69,15 @@ def test_nonfinite_sd_and_changed_repeatability_rejected() -> None: records["paired"]["metrics"]["canonical_accuracy"]["repeatability95"] = 0.001 with pytest.raises(audit.ManuscriptEvidenceAuditError, match="PAIRED_REPEATABILITY_CHANGED"): audit.assert_development_semantics(records) + + +def test_frozen_307_entry_manifest_is_itself_cryptographically_pinned(tmp_path: Path) -> None: + manifest = audit.ROOT / audit.FROZEN_BINDINGS_RELATIVE + assert audit._digest(manifest) == audit.FROZEN_BINDINGS_SHA256 + path = tmp_path / audit.FROZEN_BINDINGS_RELATIVE + path.parent.mkdir(parents=True) + original = json.loads(manifest.read_text(encoding="utf-8")) + assert len(original["unchanged_entry_files"]) == 307 + path.write_text(json.dumps(original) + "\n", encoding="utf-8") + with pytest.raises(audit.ManuscriptEvidenceAuditError, match="SOURCE_SHA256_MISMATCH"): + audit._locked_file(tmp_path, audit.FROZEN_BINDINGS_RELATIVE, audit.FROZEN_BINDINGS_SHA256) From eebeab9a89aa256534b5ef78e6d66fb820a0ab46 Mon Sep 17 00:00:00 2001 From: Gocceri Date: Fri, 9 Oct 2026 22:32:34 +0300 Subject: [PATCH 03/12] ci(v5): validate immutable development evidence on pull requests Signed-off-by: Gocceri --- ...uscript-development-evidence-integrity.yml | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 .github/workflows/v5-manuscript-development-evidence-integrity.yml diff --git a/.github/workflows/v5-manuscript-development-evidence-integrity.yml b/.github/workflows/v5-manuscript-development-evidence-integrity.yml new file mode 100644 index 00000000..df521bc3 --- /dev/null +++ b/.github/workflows/v5-manuscript-development-evidence-integrity.yml @@ -0,0 +1,77 @@ +# Offline, read-only V5 development evidence integrity CI. +# No model weights, GPU, Kaggle, PHI, confirmatory/reserve access or paid APIs. +name: V5 manuscript development evidence integrity + +on: + pull_request: + paths: + - ".github/workflows/v5-manuscript-development-evidence-integrity.yml" + - "scripts/v5_manuscript_development_evidence_audit.py" + - "tests/reliability_v5/test_manuscript_development_evidence_audit.py" + - "docs/research/paper-rebuild-v2-2026-10-02/V5_MANUSCRIPT_SOURCE_EVIDENCE_AUDIT_2026-10-09.md" + - "docs/research/paper-rebuild-v2-2026-10-02/V5_MANUSCRIPT_DEVELOPMENT_RESULTS_CROSSWALK_2026-10-09.md" + - "docs/research/paper-rebuild-v2-2026-10-02/V5_S1_KAGGLE_RUNTIME_AMENDMENT_BINDINGS_2026-10-08.json" + - "artifacts/v5/development/**" + +permissions: + contents: read + +concurrency: + group: v5-development-integrity-${{ github.event.pull_request.number }} + cancel-in-progress: false + +jobs: + source-bound-integrity: + name: Source-bound development evidence + runs-on: ubuntu-24.04 + timeout-minutes: 12 + + steps: + - name: Checkout exact pull-request head without persisting credentials + uses: actions/checkout@v4 + with: + persist-credentials: false + fetch-depth: 1 + ref: ${{ github.event.pull_request.head.sha }} + + - name: Verify exact-head checkout and no mutable external inputs + shell: bash + env: + EXPECTED_SHA: ${{ github.event.pull_request.head.sha }} + run: | + set -euo pipefail + test "$(git rev-parse HEAD)" = "$EXPECTED_SHA" + echo "QUALIFICATION_SCOPE=IMMUTABLE_DEVELOPMENT_INPUTS" + echo "MODEL_LOAD=NO" + echo "GPU=NO" + echo "CONFIRMATORY_OR_RESERVE_ACCESS=NO" + echo "PAID_API=NO" + python3 --version + + - name: Compile model-free verifier and regression fixture + shell: bash + run: | + set -euo pipefail + python3 -m compileall -q \ + scripts/v5_manuscript_development_evidence_audit.py \ + tests/reliability_v5/test_manuscript_development_evidence_audit.py + + - name: Reverify source hashes, R1 and R2 archives, and 307 frozen files + shell: bash + run: | + set -euo pipefail + python3 scripts/v5_manuscript_development_evidence_audit.py + + - name: Install focused pytest test runner + shell: bash + run: | + set -euo pipefail + python3 -m pip install --disable-pip-version-check --no-cache-dir pytest==8.4.2 + + - name: Fail-closed regression tests + shell: bash + env: + PYTHONPATH: src + run: | + set -euo pipefail + python3 -m pytest -q tests/reliability_v5/test_manuscript_development_evidence_audit.py From b5b4c3e2d068225c99ec5aa37df27a7318894e0d Mon Sep 17 00:00:00 2001 From: Gocceri Date: Sat, 10 Oct 2026 07:52:31 +0300 Subject: [PATCH 04/12] test(v5): verify source-case identity against frozen R1 and R2 Signed-off-by: Gocceri --- ...uscript-development-evidence-integrity.yml | 29 ++- ...SE_TASK_MAPPING_VERIFICATION_2026-10-10.md | 31 +++ scripts/v5_s1_source_case_pairing_audit.py | 182 ++++++++++++++++++ .../test_source_case_pairing_audit.py | 90 +++++++++ 4 files changed, 330 insertions(+), 2 deletions(-) create mode 100644 docs/research/paper-rebuild-v2-2026-10-02/V5_SOURCE_CASE_TASK_MAPPING_VERIFICATION_2026-10-10.md create mode 100644 scripts/v5_s1_source_case_pairing_audit.py create mode 100644 tests/reliability_v5/test_source_case_pairing_audit.py diff --git a/.github/workflows/v5-manuscript-development-evidence-integrity.yml b/.github/workflows/v5-manuscript-development-evidence-integrity.yml index df521bc3..5f12ab27 100644 --- a/.github/workflows/v5-manuscript-development-evidence-integrity.yml +++ b/.github/workflows/v5-manuscript-development-evidence-integrity.yml @@ -7,6 +7,8 @@ on: paths: - ".github/workflows/v5-manuscript-development-evidence-integrity.yml" - "scripts/v5_manuscript_development_evidence_audit.py" + - "scripts/v5_s1_source_case_pairing_audit.py" + - "tests/reliability_v5/test_source_case_pairing_audit.py" - "tests/reliability_v5/test_manuscript_development_evidence_audit.py" - "docs/research/paper-rebuild-v2-2026-10-02/V5_MANUSCRIPT_SOURCE_EVIDENCE_AUDIT_2026-10-09.md" - "docs/research/paper-rebuild-v2-2026-10-02/V5_MANUSCRIPT_DEVELOPMENT_RESULTS_CROSSWALK_2026-10-09.md" @@ -54,7 +56,9 @@ jobs: set -euo pipefail python3 -m compileall -q \ scripts/v5_manuscript_development_evidence_audit.py \ - tests/reliability_v5/test_manuscript_development_evidence_audit.py + scripts/v5_s1_source_case_pairing_audit.py \ + tests/reliability_v5/test_manuscript_development_evidence_audit.py \ + tests/reliability_v5/test_source_case_pairing_audit.py - name: Reverify source hashes, R1 and R2 archives, and 307 frozen files shell: bash @@ -62,6 +66,25 @@ jobs: set -euo pipefail python3 scripts/v5_manuscript_development_evidence_audit.py + - name: Retrieve SHA-pinned public RiskCalcs blob without credentials + shell: bash + run: | + set -euo pipefail + curl --proto '=https' --tlsv1.2 --fail --location --silent --show-error \ + --retry 2 --connect-timeout 15 --max-time 120 \ + --output "$RUNNER_TEMP/v5-riskcalcs-pinned.json" \ + "https://raw.githubusercontent.com/ncbi-nlp/Clinical-Tool-Learning/d474a95128e128623933c9be0d389ff7d82ef782/riskqa_evaluation/tools/riskcalcs.json" + printf '%s %s\n' \ + 00a7a0089afffb66f2f32903bad94a5a2ea842841defb2d78e0686b0a5eb9ab9 \ + "$RUNNER_TEMP/v5-riskcalcs-pinned.json" | sha256sum --check --status + + - name: Verify synthetic source-case IDs map one-to-one to tasks and both full runs + shell: bash + run: | + set -euo pipefail + python3 scripts/v5_s1_source_case_pairing_audit.py \ + --riskcalcs-source "$RUNNER_TEMP/v5-riskcalcs-pinned.json" + - name: Install focused pytest test runner shell: bash run: | @@ -74,4 +97,6 @@ jobs: PYTHONPATH: src run: | set -euo pipefail - python3 -m pytest -q tests/reliability_v5/test_manuscript_development_evidence_audit.py + python3 -m pytest -q \ + tests/reliability_v5/test_manuscript_development_evidence_audit.py \ + tests/reliability_v5/test_source_case_pairing_audit.py diff --git a/docs/research/paper-rebuild-v2-2026-10-02/V5_SOURCE_CASE_TASK_MAPPING_VERIFICATION_2026-10-10.md b/docs/research/paper-rebuild-v2-2026-10-02/V5_SOURCE_CASE_TASK_MAPPING_VERIFICATION_2026-10-10.md new file mode 100644 index 00000000..caadd684 --- /dev/null +++ b/docs/research/paper-rebuild-v2-2026-10-02/V5_SOURCE_CASE_TASK_MAPPING_VERIFICATION_2026-10-10.md @@ -0,0 +1,31 @@ +# V5 S1 development source-case to task-ID mapping verification — 2026-10-10 + +Status: `SOURCE_BOUND_MODEL_FREE_DEVELOPMENT_VERIFIED; POWER_GATE_NOT_QUALIFIED`. + +## Motivation and observed contract + +The frozen V5 statistics protocol requires the **source medical case** to be the inferential cluster, never the canonical/transformed prompt count. The development paired SD inventory currently indexes by `task_id`; without checking the original generator, a `task_id` could potentially be a prompt-derived identifier and introduce pseudoreplication. + +A **full** model-free replay of the prospectively frozen rule-oracle source generator confirms that for this *specific synthetic, static-risk-calculator* S1 development/calibration allocation, each intrinsic `case_id` corresponds to **exactly one** `task_id`, and each task generates **exactly two** ordered prompt variants. There are 64 bound public RiskCalcs calculators, 8,192 distinct original source cases and 16,384 rows; no case ID, task ID or calculator-state tuple is reused. The split counts are 256 TRAIN, 3,840 DEV_EVAL, 256 CAL_TUNE, 3,840 CAL_EVAL; each calculator contributes 4/60/4/60 source cases in that order. The 7,680 source cases across DEV_EVAL and CAL_EVAL therefore qualify as distinct *source-case* development units, not 15,360 independent prompts. + +The read-only `scripts/v5_s1_source_case_pairing_audit.py` rebuilds the original tasks from the **public, commit-pinned** RiskCalcs JSON source, the frozen 64-rule selected manifest, the byte-pinned original case generator and task renderer, and the frozen original task-preparation sequence. It replays **every original task, target, calculator ID, split, option semantics and both prompt hashes** against the 16,384-row R1 matrix and separately against all 16,384 rows of R2, with strict metadata types and distinct repeat labels. The verifier checks exact original R1 and R2 matrix bytes and rejects false one-to-one mappings, changed source state assignments, reused cases and altered prompt identities. + +## Auditable identity and command + +Source: `ncbi-nlp/Clinical-Tool-Learning@d474a95128e128623933c9be0d389ff7d82ef782`, `riskqa_evaluation/tools/riskcalcs.json`, SHA-256 `00a7a0089afffb66f2f32903bad94a5a2ea842841defb2d78e0686b0a5eb9ab9`. + +```sh +python3 scripts/v5_s1_source_case_pairing_audit.py \ + --riskcalcs-source /path/to/exact-public-riskcalcs.json +PYTHONPATH=src python3 -m pytest -q tests/reliability_v5/test_source_case_pairing_audit.py +``` + +The output contains the exact frozen ordered task sequence SHA `36c86610e2a762cb57ab61a8dff6a829e7196a638178dc612b5d1d3d5bdd5e0c` and a freshly derived case-to-task mapping SHA-256 `43ce4be40bb5c1749dbbe21f6d8788dfd5c33bf72cea78936ec47011e72cf700`. It does not persist cases, prompt text or source medical inputs. Both source/output matrices, generator and selected manifest are SHA-bound in the script. + +The existing minimal-permission GitHub Actions V5 provenance workflow now also retrieves **only this pinned public blob** using HTTPS and SHA-256-verifies the download before replaying both full response matrices, without using credentials, GPU or any model. This is deterministic integrity verification, not a new scientific model execution. + +## Interpretation boundary + +This audit establishes a **one-to-one structural identity mapping only for the prospectively fixed S1 synthetic rule-oracle development population**. It does not prove that the 64 calculators are clinically current/valid, that cases constitute independent real patient samples, that two model variants are independent, or that cross-calculator case distributions generalize to medical practice. + +More importantly, it does **not** close the final power gate. The 72 descriptive paired SD values are within-training-seed development observations; a qualified multi-seed conservative variance procedure, the exact prospective hard-gate non-target hypothesis family, a validated missingness policy, and required additional effect margins still remain. The planned 4,096 confirmatory case count has **not** been shown to meet 90% power. No confirmatory or reserve identity is generated, no clinical validity is asserted, and all publication/merging/review/signature gates stay open. diff --git a/scripts/v5_s1_source_case_pairing_audit.py b/scripts/v5_s1_source_case_pairing_audit.py new file mode 100644 index 00000000..c9c62290 --- /dev/null +++ b/scripts/v5_s1_source_case_pairing_audit.py @@ -0,0 +1,182 @@ +#!/usr/bin/env python3 +"""Rebuild frozen development source-case identities; reject pseudoreplication. + +Requires the separately verified pinned *public* RiskCalcs JSON source file. +No model, training, API, confirmatory/reserve identity, or GPU is used. +""" +from __future__ import annotations + +import argparse +from collections import Counter +import hashlib +import json +from pathlib import Path +import sys +from typing import Any, Sequence + +ROOT = Path(__file__).resolve().parents[1] +sys.path.insert(0, str(ROOT)) + +from src.commandmed.reliability_v5.rule_dataset import ( + RuleVerificationExample, + bind_selected_rules, + materialize_development_examples, +) + +SOURCE_SHA = "00a7a0089afffb66f2f32903bad94a5a2ea842841defb2d78e0686b0a5eb9ab9" +PACKET = Path("docs/research/paper-rebuild-v2-2026-10-02") +MANIFEST_PATH = PACKET / "riskcalcs-rule-oracle-final-candidate-v5.json" +MANIFEST_SHA = "445e37ee7b3a2bb56c21d04a6236e16a929f6207c74351c0143fe436c61abd9c" +RULE_DATASET_PATH = Path("src/commandmed/reliability_v5/rule_dataset.py") +RULE_DATASET_SHA = "bb062209196b045295a65403fd72e132ef01c6bc556a79048ba6284d905a3433" +CASE_GENERATOR_PATH = Path("src/commandmed/reliability_v5/case_generator.py") +CASE_GENERATOR_SHA = "1a79f6336a2f31440609b6d1af57984765b360cd09404bd7c817d61724cb73f0" +PREP_PATH = Path("artifacts/v5/development/s1_task_preparation/task-preparation-evidence.json") +RUN_PATHS = { + 1: ( + Path("artifacts/v5/development/s1-kaggle-repeatability-runs/repeat-1-v1-2026-10-09/evidence/repeatability-decision-matrix.json"), + "600dbd236098b967558e96d5ddf7d4144903fad96b172ad2871ec02fb0f30a44", + ), + 2: ( + Path("artifacts/v5/development/s1-kaggle-repeatability-runs/repeat-2-v1-2026-10-09/evidence/repeatability-decision-matrix.json"), + "37a78d4d067d00a486e2c63fc72662ecb2cee4d54c522ac8e05048e432eec902", + ), +} +SPLIT_COUNTS = {"S1_TRAIN": 256, "S1_DEV_EVAL": 3840, "S1_CAL_TUNE": 256, "S1_CAL_EVAL": 3840} +PER_CALCULATOR_COUNTS = {"S1_TRAIN": 4, "S1_DEV_EVAL": 60, "S1_CAL_TUNE": 4, "S1_CAL_EVAL": 60} +TASK_SEQUENCE_SHA = "36c86610e2a762cb57ab61a8dff6a829e7196a638178dc612b5d1d3d5bdd5e0c" + + +class SourceCaseAuditError(ValueError): + """Model-free case-to-task identity or hash mismatch.""" + + +def _require(ok: bool, reason: str) -> None: + if not ok: + raise SourceCaseAuditError(reason) + + +def _sha(raw: bytes) -> str: + return hashlib.sha256(raw).hexdigest() + + +def _locked_bytes(root: Path, rel: Path, expected_sha: str) -> bytes: + path = (root / rel).resolve() + _require(path.is_relative_to(root.resolve()), "SOURCE_PATH_ESCAPES_REPO") + _require(path.is_file(), "MISSING_LOCKED_FILE:" + str(rel)) + data = path.read_bytes() + _require(_sha(data) == expected_sha, "LOCKED_SOURCE_HASH_MISMATCH:" + str(rel)) + return data + + +def verify_unique_case_unit(examples: Sequence[RuleVerificationExample]) -> dict[str, Any]: + """One intrinsic generated medical case, one task_id, across both splits.""" + _require(len(examples) == 8192, "SOURCE_CASE_COUNT_INCORRECT") + case_ids = [x.case_id for x in examples] + task_ids = [x.task_id for x in examples] + state_keys = [(x.calculator_id, x.state_index) for x in examples] + _require(len(set(case_ids)) == len(examples), "SOURCE_CASE_ID_REUSED") + _require(len(set(task_ids)) == len(examples), "TASK_ID_REUSED") + _require(len(set(state_keys)) == len(examples), "CALCULATOR_STATE_REUSED") + _require(all(x.case_id and x.task_id and x.calculator_id for x in examples), "EMPTY_CASE_OR_TASK_ID") + split_counts = dict(Counter(x.split for x in examples)) + _require(split_counts == SPLIT_COUNTS, "SOURCE_CASE_SPLITS_CHANGED") + calculators = {x.calculator_id for x in examples} + _require(len(calculators) == 64, "CALCULATOR_COUNT_CHANGED") + per_calc = Counter((x.calculator_id, x.split) for x in examples) + for calc in calculators: + _require(all(per_calc[(calc, split)] == count for split, count in PER_CALCULATOR_COUNTS.items()), "CALCULATOR_SPLIT_DISTRIBUTION_CHANGED") + _require(_sha("".join(task_ids).encode("ascii")) == TASK_SEQUENCE_SHA, "FROZEN_TASK_SEQUENCE_CHANGED") + return { + "source_case_count": len(examples), + "unique_intrinsic_case_ids": len(set(case_ids)), + "unique_task_ids": len(set(task_ids)), + "unique_calculator_state_pairs": len(set(state_keys)), + "selected_calculators": len(calculators), + "split_counts": split_counts, + "frozen_task_sequence_sha256": TASK_SEQUENCE_SHA, + "case_to_task_binding_sha256": _sha( + "".join(f"{x.case_id}|{x.task_id}|{x.split}\n" for x in examples).encode("ascii") + ), + } + + +def verify_model_output_pairing( + examples: Sequence[RuleVerificationExample], + rows: Sequence[dict[str, Any]], +) -> None: + _require(len(rows) == 2 * len(examples), "PROMPT_VARIANT_COUNT_MISMATCH") + for index, case in enumerate(examples): + canonical, transformed = rows[2 * index:2 * index + 2] + for variant, row, prompt in ( + ("canonical", canonical, case.canonical_prompt), + ("transformed", transformed, case.transformed_prompt), + ): + expected = { + "task_id": case.task_id, + "calculator_id": case.calculator_id, + "split": case.split, + "variant": variant, + "target_index": 0 if case.target_label == "A" else 1, + "option_a_semantic": case.option_a_semantic, + "prompt_sha256": _sha(prompt.encode("utf-8")), + } + _require(all(row.get(key) == val and type(row.get(key)) == type(val) + for key, val in expected.items()), "SOURCE_TO_PROMPT_BINDING_MISMATCH") + + +def audit(source: Path, *, root: Path = ROOT) -> dict[str, Any]: + root = root.resolve() + _require(source.is_file(), "PINNED_PUBLIC_SOURCE_REQUIRED") + source_bytes = source.read_bytes() + _require(_sha(source_bytes) == SOURCE_SHA, "PINNED_SOURCE_SHA_MISMATCH") + _locked_bytes(root, RULE_DATASET_PATH, RULE_DATASET_SHA) + _locked_bytes(root, CASE_GENERATOR_PATH, CASE_GENERATOR_SHA) + manifest = json.loads(_locked_bytes(root, MANIFEST_PATH, MANIFEST_SHA)) + prep = json.loads((root / PREP_PATH).read_text(encoding="utf-8")) + _require(prep.get("status") == "PASS_PRE_MODEL_INTERFACE" and + prep.get("task_id_sequence_sha256") == TASK_SEQUENCE_SHA and + prep.get("prompt_identity_count") == 16384, "FROZEN_PREPARATION_IDENTITY_MISMATCH") + rules = bind_selected_rules(source_bytes=source_bytes, selection_manifest=manifest) + _require(len(rules) == 64, "SELECTED_RULES_CHANGED") + examples = materialize_development_examples(rules) + output = verify_unique_case_unit(examples) + for repeat, (rel, digest) in RUN_PATHS.items(): + payload = json.loads(_locked_bytes(root, rel, digest)) + _require(payload.get("complete") is True and payload.get("intervention") == "BASELINE_V1" + and type(payload.get("repeat")) is int and payload.get("repeat") == repeat, + "REPEAT_LABEL_OR_SCOPE_MISMATCH") + verify_model_output_pairing(examples, payload["rows"]) + return { + "schema": "commandmed.v5.s1.source-case-pseudoreplication-audit.v1", + "status": "PASS_SOURCE_CASE_TO_TASK_ONE_TO_ONE_DEVELOPMENT_ONLY", + "scope": "DEVELOPMENT_CALIBRATION_ONLY", + "riskcalcs_sha256": SOURCE_SHA, + "selected_manifest_sha256": MANIFEST_SHA, + "rule_dataset_sha256": RULE_DATASET_SHA, + "case_generator_sha256": CASE_GENERATOR_SHA, + "full_r1_r2_source_to_prompt_replay": True, + "repeatabilities": [1, 2], + "original_decision_matrix_shas": {str(k): digest for k, (_, digest) in RUN_PATHS.items()}, + "two_prompt_variants_independent": False, + "source_case_unit": "case_id, one-to-one with development task_id", + "confirmatory_materialized": False, + "reserve_materialized": False, + "training": False, + "clinical_validity": False, + "final_statistical_power_qualified": False, + **output, + } + + +def main() -> int: + parser = argparse.ArgumentParser() + parser.add_argument("--riskcalcs-source", type=Path, required=True, + help="Local copy of fixed public RiskCalcs blob, SHA-256 checked before use") + args = parser.parse_args() + print(json.dumps(audit(args.riskcalcs_source), indent=2, sort_keys=True)) + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/tests/reliability_v5/test_source_case_pairing_audit.py b/tests/reliability_v5/test_source_case_pairing_audit.py new file mode 100644 index 00000000..4df92aac --- /dev/null +++ b/tests/reliability_v5/test_source_case_pairing_audit.py @@ -0,0 +1,90 @@ +"""Synthetic regressions for original-source V5 case/task pairing audit.""" +from __future__ import annotations + +from pathlib import Path +import hashlib +import sys + +import pytest + +sys.path.insert(0, str(Path(__file__).resolve().parents[2])) +import scripts.v5_s1_source_case_pairing_audit as audit + + +class Example: + def __init__(self, task: str = "taskA", case_id: str = "caseA", state: int = 0, + split: str = "S1_DEV_EVAL") -> None: + self.task_id = task + self.case_id = case_id + self.state_index = state + self.calculator_id = "pmid:known" + self.split = split + self.target_label = "A" + self.option_a_semantic = "MATCH" + self.canonical_prompt = "Canonical A" + self.transformed_prompt = "Transformed A" + + +def _rows(ex: Example) -> list[dict]: + return [{ + "task_id": ex.task_id, + "calculator_id": ex.calculator_id, + "split": ex.split, + "variant": variant, + "target_index": 0, + "option_a_semantic": ex.option_a_semantic, + "prompt_sha256": hashlib.sha256(prompt.encode("utf-8")).hexdigest(), + "logits": [1.0, 0.0], + } for variant, prompt in (("canonical", ex.canonical_prompt), + ("transformed", ex.transformed_prompt))] + + +def test_synthetic_source_and_pairing_accept_original_identity() -> None: + ex = Example() + audit.verify_model_output_pairing([ex], _rows(ex)) + + +@pytest.mark.parametrize("field,wrong", [ + ("task_id", "wrong-task"), ("calculator_id", "pmid:other"), + ("split", "S1_CAL_EVAL"), ("target_index", 1), ("option_a_semantic", "MISMATCH"), + ("prompt_sha256", "0" * 64), ("variant", "incorrect") +]) +def test_reject_changed_task_or_prompt_identity(field: str, wrong: object) -> None: + ex = Example() + rows = _rows(ex) + rows[0][field] = wrong + with pytest.raises(audit.SourceCaseAuditError, match="SOURCE_TO_PROMPT_BINDING_MISMATCH"): + audit.verify_model_output_pairing([ex], rows) + + +def test_reject_duplicate_or_missing_prompt_pair() -> None: + ex = Example() + with pytest.raises(audit.SourceCaseAuditError, match="PROMPT_VARIANT_COUNT_MISMATCH"): + audit.verify_model_output_pairing([ex], _rows(ex)[:1]) + rows = _rows(ex) + rows[1] = rows[0].copy() + with pytest.raises(audit.SourceCaseAuditError, match="SOURCE_TO_PROMPT_BINDING_MISMATCH"): + audit.verify_model_output_pairing([ex], rows) + + +def test_fail_closed_source_file_identity(tmp_path: Path) -> None: + path = tmp_path / "source.json" + path.write_text("not-pinned-content", encoding="utf-8") + with pytest.raises(audit.SourceCaseAuditError, match="PINNED_SOURCE_SHA_MISMATCH"): + audit.audit(path) + with pytest.raises(audit.SourceCaseAuditError, match="PINNED_PUBLIC_SOURCE_REQUIRED"): + audit.audit(tmp_path / "not-there") + + +@pytest.mark.parametrize("mutation,reason", [ + ("case_id", "SOURCE_CASE_ID_REUSED"), + ("task_id", "TASK_ID_REUSED"), + ("state_index", "CALCULATOR_STATE_REUSED"), +]) +def test_source_case_pseudoreplication_is_rejected(mutation: str, reason: str) -> None: + # Fixed full-case cardinality is checked before collision detection. + cases = [Example(task=f"task-{i}", case_id=f"case-{i}", state=i) + for i in range(8192)] + setattr(cases[-1], mutation, getattr(cases[0], mutation)) + with pytest.raises(audit.SourceCaseAuditError, match=reason): + audit.verify_unique_case_unit(cases) From 2e12096a3f21bdee25b41c356fa9a93a87f21d28 Mon Sep 17 00:00:00 2001 From: Gocceri Date: Sat, 10 Oct 2026 07:54:09 +0300 Subject: [PATCH 05/12] ci(v5): pin NumPy dependency for rule-oracle replay Signed-off-by: Gocceri --- .../v5-manuscript-development-evidence-integrity.yml | 12 +++++++----- ...URCE_CASE_TASK_MAPPING_VERIFICATION_2026-10-10.md | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/v5-manuscript-development-evidence-integrity.yml b/.github/workflows/v5-manuscript-development-evidence-integrity.yml index 5f12ab27..c31b84f8 100644 --- a/.github/workflows/v5-manuscript-development-evidence-integrity.yml +++ b/.github/workflows/v5-manuscript-development-evidence-integrity.yml @@ -78,18 +78,20 @@ jobs: 00a7a0089afffb66f2f32903bad94a5a2ea842841defb2d78e0686b0a5eb9ab9 \ "$RUNNER_TEMP/v5-riskcalcs-pinned.json" | sha256sum --check --status - - name: Verify synthetic source-case IDs map one-to-one to tasks and both full runs + - name: Install pinned model-free audit dependencies shell: bash run: | set -euo pipefail - python3 scripts/v5_s1_source_case_pairing_audit.py \ - --riskcalcs-source "$RUNNER_TEMP/v5-riskcalcs-pinned.json" + # One frozen public calculator calls np.exp; match verified macOS NumPy. + python3 -m pip install --disable-pip-version-check --no-cache-dir \ + numpy==2.4.6 pytest==8.4.2 - - name: Install focused pytest test runner + - name: Verify synthetic source-case IDs map one-to-one to tasks and both full runs shell: bash run: | set -euo pipefail - python3 -m pip install --disable-pip-version-check --no-cache-dir pytest==8.4.2 + python3 scripts/v5_s1_source_case_pairing_audit.py \ + --riskcalcs-source "$RUNNER_TEMP/v5-riskcalcs-pinned.json" - name: Fail-closed regression tests shell: bash diff --git a/docs/research/paper-rebuild-v2-2026-10-02/V5_SOURCE_CASE_TASK_MAPPING_VERIFICATION_2026-10-10.md b/docs/research/paper-rebuild-v2-2026-10-02/V5_SOURCE_CASE_TASK_MAPPING_VERIFICATION_2026-10-10.md index caadd684..49b75dff 100644 --- a/docs/research/paper-rebuild-v2-2026-10-02/V5_SOURCE_CASE_TASK_MAPPING_VERIFICATION_2026-10-10.md +++ b/docs/research/paper-rebuild-v2-2026-10-02/V5_SOURCE_CASE_TASK_MAPPING_VERIFICATION_2026-10-10.md @@ -22,7 +22,7 @@ PYTHONPATH=src python3 -m pytest -q tests/reliability_v5/test_source_case_pairin The output contains the exact frozen ordered task sequence SHA `36c86610e2a762cb57ab61a8dff6a829e7196a638178dc612b5d1d3d5bdd5e0c` and a freshly derived case-to-task mapping SHA-256 `43ce4be40bb5c1749dbbe21f6d8788dfd5c33bf72cea78936ec47011e72cf700`. It does not persist cases, prompt text or source medical inputs. Both source/output matrices, generator and selected manifest are SHA-bound in the script. -The existing minimal-permission GitHub Actions V5 provenance workflow now also retrieves **only this pinned public blob** using HTTPS and SHA-256-verifies the download before replaying both full response matrices, without using credentials, GPU or any model. This is deterministic integrity verification, not a new scientific model execution. +The existing minimal-permission GitHub Actions V5 provenance workflow now also retrieves **only this pinned public blob** using HTTPS and SHA-256-verifies the download before replaying both full response matrices, without using credentials, GPU or any model. The frozen public-rule evaluator requires `numpy` for its verified `np.exp` calculator; the CI runner explicitly installs `numpy==2.4.6` and `pytest==8.4.2` before running this check. This is deterministic integrity verification, not a new scientific model execution. ## Interpretation boundary From c8006769a0460cabd3a2c4552db53cb8c0751b78 Mon Sep 17 00:00:00 2001 From: "Abdulaziz M. Shehri" Date: Sat, 10 Oct 2026 20:49:51 +0300 Subject: [PATCH 06/12] fix(v5): reconcile development crosswalk pin with ICC addendum Synchronize the downstream read-only evidence gate with the exact source-bound upstream development-only manuscript crosswalk. Preserve all 307 frozen original scientific bindings and no-go authority. Signed-off-by: Abdulaziz M. Shehri --- ...PT_DEVELOPMENT_RESULTS_CROSSWALK_2026-10-09.md | 15 ++++++++++++++- .../v5_manuscript_development_evidence_audit.py | 4 ++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/docs/research/paper-rebuild-v2-2026-10-02/V5_MANUSCRIPT_DEVELOPMENT_RESULTS_CROSSWALK_2026-10-09.md b/docs/research/paper-rebuild-v2-2026-10-02/V5_MANUSCRIPT_DEVELOPMENT_RESULTS_CROSSWALK_2026-10-09.md index ad272d62..cb83fd6b 100644 --- a/docs/research/paper-rebuild-v2-2026-10-02/V5_MANUSCRIPT_DEVELOPMENT_RESULTS_CROSSWALK_2026-10-09.md +++ b/docs/research/paper-rebuild-v2-2026-10-02/V5_MANUSCRIPT_DEVELOPMENT_RESULTS_CROSSWALK_2026-10-09.md @@ -19,6 +19,7 @@ The manuscript `Results.md`, `README.md`, `claim-ledger-v5.md`, `REVIEWER_RED_TE | Base-only same-seed repeatability | `artifacts/v5/development/s1-kaggle-repeatability-runs/paired-r1-r2-repeatability95-2026-10-09.json`; source-bound R1/R2 verification | Two private Kaggle executions, each with 16,384 complete ordered rows over 8,192 source tasks; every ordered decision/logit row matched. For all 4 primary and 3 secondary metrics `repeatability95=0` under the **pre-frozen** paired nearest-rank estimator. | No robustness across different random seeds, model families, hardware, prompts, patient populations or clinical decisions | | Research-scale meaningful margins | `artifacts/v5/development/s1-kaggle-repeatability-runs/final-development-benchmark-margins-2026-10-09.json` and pre-output `V5_DOMAIN_FLOOR_FREEZE_2026-10-09.md` | `m_accuracy=0.01`; `m_NLL=0.009950330853168092` nats; `m_Brier=0.02`; `m_semantic_JS=0.006931471805599453` nats. These equal the prospectively frozen **nonclinical** benchmark floors because the measured repeatability term is zero. | No clinician-adjudicated minimum important difference or medical deployment tolerance | | Descriptive paired source-task SDs | `artifacts/v5/development/s1-paired-sd-inventory-2026-10-09/development-paired-sd.json`; seed/source/prompt identity-bound analysis | 72 offline `ddof=1` within-seed source-task SD cells over 9 intervention/seed combinations, 2 evaluation splits and 4 primary metrics. Seed-to-seed variability is material; one favorable cell is not an admissible power input. | No prospective conservative seed-aware variance bound, precise Holm family size, power certificate or confirmatory effect | +| Development calculator-level paired-effect ICC | `V5_S1_DEVELOPMENT_CALCULATOR_EFFECT_ICC_INVENTORY_2026-10-10.md` and `artifacts/v5/development/s1-calculator-icc-inventory-2026-10-10/development-calculator-icc.json` on base draft #323 | 72 original-source descriptive one-way calculator ICC cells: median 0.023117, range −0.012645 to 0.238078; 12 negative finite-sample estimates retained. Each split has 64 fixed selected calculators × 60 source cases (3,840), not 4,096 confirmatory cases. | No qualified population ICC, calculator-generalized inference, crossed source/calculator/seed variance, 90% power certificate or confirmatory authorization | S1 source-task evaluation counts: DEV 3,840 and CAL 3,840 (7,680 source-task clusters across both splits). The canonical/transformed variants are **not** independent samples. The effect and nuisance estimates in the inventory are paired to the unchanged baseline for descriptive development only, with metric orientation preserved in raw units; no significance is claimed. @@ -33,6 +34,7 @@ The following are SHA-256 checks on files **retained in the draft evidence branc | Paired repeatability `repeatability95` | `f6ace697d61de05c470c1260dafc7b54f13524b0dd2960e45c268c46bb7e64be` | | Development-only research-scale margins | `361ad34e0c2deb0ca7646cfb9dd9346bb63471296a003e9ef12a858743f6917f` | | Descriptive 72-cell source-task SD inventory | `b1edf781b61d3f5ce227c08908ca43ad9864c0b398a7318c33895951af37bacd` | +| Development-only 72-cell calculator-effect ICC inventory | `37d64c0f6ac14d04cc6420a020e7bb7997fb333e50729f33798b2d403d292370` | | Cross-seed development synthesis | `76b7f7503a743991fd81f4e1758d5710cc646a0a665c1e3e2128d1e533ea2e82` | | Pre-output frozen domain-floor manifest | `8c284a98f504c8529a4da5d9bb1e265465af66b10d0c3b0414505dcebc9c7ca7` | @@ -43,10 +45,21 @@ Both original Kaggle exports have independently passing model-free source/row/an - **V5-C01** remains `PARTIAL_THEORY_ONLY`; theory examples are not a demonstrated clinically consequential empirical contrast. - **V5-C02–V5-C07** remain `UNPROVEN`; nothing here is a tested Holm-adjusted non-target effect, valid noninferiority claim, compensatory deployment reversal, replicated interaction, cross-backbone generalization or clinically qualified deterministic routing result. - **V5-C08** remains `CONDITIONALLY_SUPPORTED`, dependent on adequate current prior-art review and eventual valid result/positioning. -- **Final 90% power at 4,096 source clusters remains unqualified.** A prospectively justified exact primary hard-gate non-target hypothesis family and family size must be established, and intervention-paired development nuisance estimates must conservatively account for three training seeds and crossed source/seed dependence. The observed 72 descriptive SD cells must not be cherry-picked after observing their values. +- **Final 90% power at 4,096 planned source cases remains unqualified.** A prospectively justified complete primary hard-gate non-target Holm family and family size must be established. The inferential target for 64 selected calculators (fixed-collection effects versus broader calculator generalization), shared baseline, within-calculator source-case dependence, coupling, missingness, and stochastic uncertainty across just three training seeds must be independently specified and reviewed. Neither the 72 descriptive source-task SD cells nor the 72 development-only calculator ICC cells may be cherry-picked or promoted to conservative prospective nuisance bounds, final power or clinical evidence. - Any final confirmatory/reserve identity, intervention allocation, independent-family replication, manuscript claim promotion, public preprint or release requires its own legitimately recorded authority and all preconditions. Draft evidence PRs cannot be treated as a publication certificate. - Independent scientific/methodological review, original-source attribution and a valid cryptographic signing/governance route remain open. DCO sign-off does not substitute for a verified Git signature. + +## 2026-10-10 source-bound development calculator-dependence follow-up (not a statistical sign-off) + +Draft base PR [#323](https://github.com/TheHalfMoon/commandMed/pull/323) introduced a separate **original-source, development-only** calculator-level paired-effect ICC inventory after this crosswalk was first authored. Its checked-in analyzer `scripts/v5_s1_development_calculator_icc_inventory.py` pins the original unchanged baseline, independent R1 cross-check and nine existing B1/C1/C2 matrices for training seeds **11, 29, 47** (11 source input SHA-256 identities). GitHub Actions [run 38068989562](https://github.com/TheHalfMoon/commandMed/actions/runs/38068989562) succeeded at PR #323 head `4a3a86588fccd293792dd3c3ab9a648153c1eefc`. This is source-integrity and software evidence, **not** independent statistical or clinical validation. + +For each of nine intervention/seed combinations, two evaluation splits and four frozen metrics, the analyzer calculates a **raw, unclipped, descriptive one-way ANOVA method-of-moments ICC** on candidate-minus-unchanged-baseline *paired source-case effects* grouped by selected calculator. Each split has 64 fixed selected calculators × 60 distinct development source cases, with paired prompt variants already collapsed at source-case level. Across **72/72** cells the observed ICC median was **0.023117**, minimum **−0.012645**, maximum **0.238078**; 12 negative finite-sample estimates remain negative (not negative population variance claims). The highest observed development cell was C2 seed 47 / S1_DEV_EVAL / semantic JS. The analyzer reconstructed the original 72 saved whole-split source-task SD cells with maximum floating-point absolute discrepancy **3.552713678800501e-15**, under a separately pinned source SD SHA-256. + +This measured *development* dependence does **not** establish an independent sample of calculators, a confirmatory population ICC, a causal dependence structure, or a validated design effect. Its illustrative balanced-cluster arithmetic with **60** cases per calculator must **not** be substituted for prospective **64 × 64 = 4,096** source cases, treated as effective sample size for final power, or used to ignore three-run stochastic training-seed uncertainty. The reviewer must first decide whether the estimand is conditional on the 64 chosen calculators or generalizes beyond them, then justify dependence and missingness handling across calculators, source cases, shared baseline, training seeds and coupled non-target hypotheses. + +The complete primary non-target Holm family, native-unit effect margins, per-primary-effect **90%** power at **FWER alpha 0.05**, and feasibility at planned **4,096** prospective cases remain **NOT_REVIEWED / NOT_APPROVED** under [issue #326](https://github.com/TheHalfMoon/commandMed/issues/326). If the frozen power-failure rule is triggered, only a scientifically and founder-authorized underpowered stop or prospective redesign may proceed. No new case identities, GPU/model runs, manuscript claim promotion, merges of gated drafts, or public clinical/research claims are authorized by this addendum. The original **307** frozen scientific evidence bindings remain outside this change. + ## Suggested future manuscript placement (not an authorized manuscript edit) A future **Development and protocol-qualification observations** subsection can present the table above as developmental, with a visually separate **Confirmatory results** subsection initially stating `NOT_EXECUTED`. The paper's main conclusions must remain conditional on the unexecuted study. The negative B1/C1/C2 results and near-chance rule-conformance results must be retained, not reframed as V5 scientific success. diff --git a/scripts/v5_manuscript_development_evidence_audit.py b/scripts/v5_manuscript_development_evidence_audit.py index c4c431d3..1fbdaffa 100644 --- a/scripts/v5_manuscript_development_evidence_audit.py +++ b/scripts/v5_manuscript_development_evidence_audit.py @@ -22,7 +22,7 @@ FROZEN_BINDINGS_SHA256 = "c33e603e531b5f3957a0fbe5fa63d45f070e21e2243b268af232516990dd428f" # The immutable receipts, scientific metrics, frozen floor and reporting text are -# locked at the exact evidence state qualified on 2026-10-09. +# locked to the 2026-10-09 evidence state plus the 2026-10-10 dated ICC crosswalk update. LOCKED_SOURCES: dict[str, tuple[str, str]] = { "r1_receipt": (RUNS + "repeat-1-v1-2026-10-09/export-verification-receipt.json", "b445406380ea967ce8bb8bc7a61efe1cd48ade50e03f6c0eabba6e559d58eb53"), "r2_receipt": (RUNS + "repeat-2-v1-2026-10-09/export-verification-receipt.json", "f55e1b0271918538c16d347a1e91b0aeeece47acb84aa4314f3cc3169e45b4a2"), @@ -31,7 +31,7 @@ "floors": (DEV + "domain-floor-freeze-2026-10-09/domain-floors.json", "8c284a98f504c8529a4da5d9bb1e265465af66b10d0c3b0414505dcebc9c7ca7"), "sd_inventory": (DEV + "s1-paired-sd-inventory-2026-10-09/development-paired-sd.json", "b1edf781b61d3f5ce227c08908ca43ad9864c0b398a7318c33895951af37bacd"), "synthesis": (DEV + "s1-development-synthesis-2026-10-09/final-synthesis.json", "76b7f7503a743991fd81f4e1758d5710cc646a0a665c1e3e2128d1e533ea2e82"), - "crosswalk": (DOC + "V5_MANUSCRIPT_DEVELOPMENT_RESULTS_CROSSWALK_2026-10-09.md", "cc70f46824269712135678de7a182da45a459f10bfc1aa19e4d65e4c9b4665ae"), + "crosswalk": (DOC + "V5_MANUSCRIPT_DEVELOPMENT_RESULTS_CROSSWALK_2026-10-09.md", "7ff52c5b616543c7d85a44e6ecbf9b982a95b2a58531cc17a66e002367d04c41"), } ORIGINAL_ARCHIVES = { 1: (RUNS + "repeat-1-v1-2026-10-09/original-export.zip", "dfb35b0216369bbb87bcec75c5715df974bb9f736c0db0af98148cea91d99dac"), From 9e30bd5270aa2fedbf2b97628fa1a20571710449 Mon Sep 17 00:00:00 2001 From: Gocceri Date: Sat, 10 Oct 2026 21:10:56 +0300 Subject: [PATCH 07/12] ci(v5): replay calculator ICC sources in manuscript integrity gate Fail closed when the development ICC result cannot be reproduced from original pinned matrices. Keep immutable evidence, 307 frozen files, no scientific claim promotion, and draft merge restrictions. Signed-off-by: Gocceri --- ...uscript-development-evidence-integrity.yml | 41 ++++++++++++++++++- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/.github/workflows/v5-manuscript-development-evidence-integrity.yml b/.github/workflows/v5-manuscript-development-evidence-integrity.yml index c31b84f8..b24fb020 100644 --- a/.github/workflows/v5-manuscript-development-evidence-integrity.yml +++ b/.github/workflows/v5-manuscript-development-evidence-integrity.yml @@ -8,6 +8,9 @@ on: - ".github/workflows/v5-manuscript-development-evidence-integrity.yml" - "scripts/v5_manuscript_development_evidence_audit.py" - "scripts/v5_s1_source_case_pairing_audit.py" + - "scripts/v5_s1_development_calculator_icc_inventory.py" + - "tests/reliability_v5/test_development_calculator_icc_inventory.py" + - "docs/research/paper-rebuild-v2-2026-10-02/V5_S1_DEVELOPMENT_CALCULATOR_EFFECT_ICC_INVENTORY_2026-10-10.md" - "tests/reliability_v5/test_source_case_pairing_audit.py" - "tests/reliability_v5/test_manuscript_development_evidence_audit.py" - "docs/research/paper-rebuild-v2-2026-10-02/V5_MANUSCRIPT_SOURCE_EVIDENCE_AUDIT_2026-10-09.md" @@ -57,8 +60,10 @@ jobs: python3 -m compileall -q \ scripts/v5_manuscript_development_evidence_audit.py \ scripts/v5_s1_source_case_pairing_audit.py \ + scripts/v5_s1_development_calculator_icc_inventory.py \ tests/reliability_v5/test_manuscript_development_evidence_audit.py \ - tests/reliability_v5/test_source_case_pairing_audit.py + tests/reliability_v5/test_source_case_pairing_audit.py \ + tests/reliability_v5/test_development_calculator_icc_inventory.py - name: Reverify source hashes, R1 and R2 archives, and 307 frozen files shell: bash @@ -93,6 +98,37 @@ jobs: python3 scripts/v5_s1_source_case_pairing_audit.py \ --riskcalcs-source "$RUNNER_TEMP/v5-riskcalcs-pinned.json" + - name: Replay original development calculator ICC without replacing evidence + shell: bash + run: | + set -euo pipefail + python3 scripts/v5_s1_development_calculator_icc_inventory.py \ + --output "$RUNNER_TEMP/v5-original-icc-replay.json" + python3 - "$RUNNER_TEMP/v5-original-icc-replay.json" <<'PYCODE' + import json, math, sys + from pathlib import Path + saved = json.loads(Path('artifacts/v5/development/s1-calculator-icc-inventory-2026-10-10/development-calculator-icc.json').read_text()) + replay = json.loads(Path(sys.argv[1]).read_text()) + def same(a, b, label='$'): + if type(a) is dict: + assert type(b) is dict and a.keys() == b.keys(), label + for k in a: same(a[k], b[k], f'{label}.{k}') + elif type(a) is list: + assert type(b) is list and len(a) == len(b), label + for i, (x, y) in enumerate(zip(a, b)): same(x, y, f'{label}[{i}]') + elif type(a) is float: + assert type(b) is float and math.isfinite(b), label + assert math.isclose(a, b, rel_tol=1e-10, abs_tol=1e-10), label + else: + assert type(a) is type(b) and a == b, label + same(saved, replay) + assert replay['rows'] == replay['reference_sd_cells_reproduced'] == 72 + assert replay['n_negative_icc'] == 12 + assert replay['boundaries']['final_90_percent_power_qualified'] is False + assert replay['boundaries']['confirmatory_authorized'] is False + print('PASS_72_ORIGINAL_DEVELOPMENT_CALCULATOR_ICC_CELLS_NOT_POWER') + PYCODE + - name: Fail-closed regression tests shell: bash env: @@ -101,4 +137,5 @@ jobs: set -euo pipefail python3 -m pytest -q \ tests/reliability_v5/test_manuscript_development_evidence_audit.py \ - tests/reliability_v5/test_source_case_pairing_audit.py + tests/reliability_v5/test_source_case_pairing_audit.py \ + tests/reliability_v5/test_development_calculator_icc_inventory.py From 679fa728aadda2ec5e322f547b9dfe75fbd4f33a Mon Sep 17 00:00:00 2001 From: Gocceri Date: Sat, 10 Oct 2026 21:13:57 +0300 Subject: [PATCH 08/12] ci(v5): pin immutable checkout action in evidence gate Use the exact action revision already bound by the V5 calculator ICC workflow while retaining read-only checkout and source-bound offline verification. Signed-off-by: Gocceri --- .../workflows/v5-manuscript-development-evidence-integrity.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/v5-manuscript-development-evidence-integrity.yml b/.github/workflows/v5-manuscript-development-evidence-integrity.yml index b24fb020..3380e6ae 100644 --- a/.github/workflows/v5-manuscript-development-evidence-integrity.yml +++ b/.github/workflows/v5-manuscript-development-evidence-integrity.yml @@ -33,7 +33,7 @@ jobs: steps: - name: Checkout exact pull-request head without persisting credentials - uses: actions/checkout@v4 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2, immutable action revision with: persist-credentials: false fetch-depth: 1 From 44d892010b9477b4acfb2446282507d29a34bf99 Mon Sep 17 00:00:00 2001 From: Gocceri Date: Sat, 10 Oct 2026 22:34:35 +0300 Subject: [PATCH 09/12] research(v5): bind 72 nuisance diagnostics into reviewer packet Reconcile 72 original paired-SD and calculator-ICC development cells into 24 complete three-seed reviewer groups, retain all 12 negative ICC values and explicit unreviewed Holm/crossed-variance/power authority. Include immutable source replay, 307-entry audit, fail-closed mutation tests, CI and review documentation. No model inference, confirmatory access or scientific approval. Signed-off-by: Gocceri --- ...uscript-development-evidence-integrity.yml | 22 +- .../reviewer-packet.json | 853 ++++++++++++++++++ ...VE_STATISTICAL_REVIEW_PACKET_2026-10-10.md | 30 + scripts/v5_s1_statistical_review_packet.py | 188 ++++ .../test_statistical_review_packet.py | 97 ++ 5 files changed, 1188 insertions(+), 2 deletions(-) create mode 100644 artifacts/v5/development/s1-statistical-review-packet-2026-10-10/reviewer-packet.json create mode 100644 docs/research/paper-rebuild-v2-2026-10-02/V5_S1_DESCRIPTIVE_STATISTICAL_REVIEW_PACKET_2026-10-10.md create mode 100644 scripts/v5_s1_statistical_review_packet.py create mode 100644 tests/reliability_v5/test_statistical_review_packet.py diff --git a/.github/workflows/v5-manuscript-development-evidence-integrity.yml b/.github/workflows/v5-manuscript-development-evidence-integrity.yml index 3380e6ae..77cf7c9c 100644 --- a/.github/workflows/v5-manuscript-development-evidence-integrity.yml +++ b/.github/workflows/v5-manuscript-development-evidence-integrity.yml @@ -7,6 +7,9 @@ on: paths: - ".github/workflows/v5-manuscript-development-evidence-integrity.yml" - "scripts/v5_manuscript_development_evidence_audit.py" + - "scripts/v5_s1_statistical_review_packet.py" + - "tests/reliability_v5/test_statistical_review_packet.py" + - "docs/research/paper-rebuild-v2-2026-10-02/V5_S1_DESCRIPTIVE_STATISTICAL_REVIEW_PACKET_2026-10-10.md" - "scripts/v5_s1_source_case_pairing_audit.py" - "scripts/v5_s1_development_calculator_icc_inventory.py" - "tests/reliability_v5/test_development_calculator_icc_inventory.py" @@ -59,11 +62,14 @@ jobs: set -euo pipefail python3 -m compileall -q \ scripts/v5_manuscript_development_evidence_audit.py \ + scripts/v5_s1_statistical_review_packet.py \ + tests/reliability_v5/test_statistical_review_packet.py \ scripts/v5_s1_source_case_pairing_audit.py \ scripts/v5_s1_development_calculator_icc_inventory.py \ tests/reliability_v5/test_manuscript_development_evidence_audit.py \ tests/reliability_v5/test_source_case_pairing_audit.py \ - tests/reliability_v5/test_development_calculator_icc_inventory.py + tests/reliability_v5/test_development_calculator_icc_inventory.py \ + tests/reliability_v5/test_statistical_review_packet.py - name: Reverify source hashes, R1 and R2 archives, and 307 frozen files shell: bash @@ -129,6 +135,17 @@ jobs: print('PASS_72_ORIGINAL_DEVELOPMENT_CALCULATOR_ICC_CELLS_NOT_POWER') PYCODE + - name: Replay exact source-bound statistical review packet without modifying evidence + shell: bash + run: | + set -euo pipefail + python3 scripts/v5_s1_statistical_review_packet.py --verify \ + artifacts/v5/development/s1-statistical-review-packet-2026-10-10/reviewer-packet.json + python3 scripts/v5_s1_statistical_review_packet.py --output \ + "$RUNNER_TEMP/v5-statistical-review-packet-replay.json" + cmp artifacts/v5/development/s1-statistical-review-packet-2026-10-10/reviewer-packet.json \ + "$RUNNER_TEMP/v5-statistical-review-packet-replay.json" + - name: Fail-closed regression tests shell: bash env: @@ -138,4 +155,5 @@ jobs: python3 -m pytest -q \ tests/reliability_v5/test_manuscript_development_evidence_audit.py \ tests/reliability_v5/test_source_case_pairing_audit.py \ - tests/reliability_v5/test_development_calculator_icc_inventory.py + tests/reliability_v5/test_development_calculator_icc_inventory.py \ + tests/reliability_v5/test_statistical_review_packet.py diff --git a/artifacts/v5/development/s1-statistical-review-packet-2026-10-10/reviewer-packet.json b/artifacts/v5/development/s1-statistical-review-packet-2026-10-10/reviewer-packet.json new file mode 100644 index 00000000..b0680471 --- /dev/null +++ b/artifacts/v5/development/s1-statistical-review-packet-2026-10-10/reviewer-packet.json @@ -0,0 +1,853 @@ +{ + "calculators_per_development_split": 64, + "cases_per_calculator": 60, + "confirmatory_90_percent_power_qualified": false, + "confirmatory_authorized": false, + "descriptive_condition_seed_metric_split_cells": 72, + "descriptive_intervention_metric_split_groups": 24, + "groups": [ + { + "crossed_source_case_calculator_seed_nuisance_qualified": false, + "descriptive_sd_of_three_seed_effect_means": 0.007818284895276183, + "intervention": "B1_TYPED_V1", + "metric": "canonical_accuracy", + "negative_sample_icc_cells": 2, + "paired_sd_max_across_three_seed_snapshots": 0.9989960880748663, + "paired_sd_min_across_three_seed_snapshots": 0.04564949078990303, + "seed_level_development_evidence": [ + { + "calculator_anova_icc_unclipped": -0.012644890538357812, + "negative_icc_sample_estimate": true, + "paired_delta_mean_raw_metric_orientation": 0.0, + "paired_source_case_sample_sd": 0.04564949078990303, + "seed": 11 + }, + { + "calculator_anova_icc_unclipped": 0.0076320947874176, + "negative_icc_sample_estimate": false, + "paired_delta_mean_raw_metric_orientation": 0.013541666666666667, + "paired_source_case_sample_sd": 0.9989960880748663, + "seed": 29 + }, + { + "calculator_anova_icc_unclipped": -0.012644890538357812, + "negative_icc_sample_estimate": true, + "paired_delta_mean_raw_metric_orientation": 0.0, + "paired_source_case_sample_sd": 0.04564949078990303, + "seed": 47 + } + ], + "split": "S1_CAL_EVAL", + "training_seed_count": 3 + }, + { + "crossed_source_case_calculator_seed_nuisance_qualified": false, + "descriptive_sd_of_three_seed_effect_means": 0.015636569790552373, + "intervention": "B1_TYPED_V1", + "metric": "canonical_brier", + "negative_sample_icc_cells": 0, + "paired_sd_max_across_three_seed_snapshots": 1.3423680684845563, + "paired_sd_min_across_three_seed_snapshots": 0.6809635417332688, + "seed_level_development_evidence": [ + { + "calculator_anova_icc_unclipped": 0.008877809644405118, + "negative_icc_sample_estimate": false, + "paired_delta_mean_raw_metric_orientation": 0.44150742060646947, + "paired_source_case_sample_sd": 0.6809635417332688, + "seed": 11 + }, + { + "calculator_anova_icc_unclipped": 0.009861454513798107, + "negative_icc_sample_estimate": false, + "paired_delta_mean_raw_metric_orientation": 0.4144240872731361, + "paired_source_case_sample_sd": 1.3423680684845563, + "seed": 29 + }, + { + "calculator_anova_icc_unclipped": 0.008877809644405118, + "negative_icc_sample_estimate": false, + "paired_delta_mean_raw_metric_orientation": 0.44150742060646947, + "paired_source_case_sample_sd": 0.6809635417332688, + "seed": 47 + } + ], + "split": "S1_CAL_EVAL", + "training_seed_count": 3 + }, + { + "crossed_source_case_calculator_seed_nuisance_qualified": false, + "descriptive_sd_of_three_seed_effect_means": 0.27003399378965165, + "intervention": "B1_TYPED_V1", + "metric": "canonical_nll", + "negative_sample_icc_cells": 0, + "paired_sd_max_across_three_seed_snapshots": 17.628429762541145, + "paired_sd_min_across_three_seed_snapshots": 16.913526906811402, + "seed_level_development_evidence": [ + { + "calculator_anova_icc_unclipped": 0.00767537913327019, + "negative_icc_sample_estimate": false, + "paired_delta_mean_raw_metric_orientation": 16.728810833401017, + "paired_source_case_sample_sd": 16.913526906811402, + "seed": 11 + }, + { + "calculator_anova_icc_unclipped": 0.007843102805474664, + "negative_icc_sample_estimate": false, + "paired_delta_mean_raw_metric_orientation": 16.2610982363866, + "paired_source_case_sample_sd": 17.628429762541145, + "seed": 29 + }, + { + "calculator_anova_icc_unclipped": 0.00767537913327019, + "negative_icc_sample_estimate": false, + "paired_delta_mean_raw_metric_orientation": 16.728810833401017, + "paired_source_case_sample_sd": 16.913526906811402, + "seed": 47 + } + ], + "split": "S1_CAL_EVAL", + "training_seed_count": 3 + }, + { + "crossed_source_case_calculator_seed_nuisance_qualified": false, + "descriptive_sd_of_three_seed_effect_means": 0.0, + "intervention": "B1_TYPED_V1", + "metric": "semantic_js", + "negative_sample_icc_cells": 0, + "paired_sd_max_across_three_seed_snapshots": 0.001576085624924554, + "paired_sd_min_across_three_seed_snapshots": 0.001576085624924554, + "seed_level_development_evidence": [ + { + "calculator_anova_icc_unclipped": 0.20695905753657332, + "negative_icc_sample_estimate": false, + "paired_delta_mean_raw_metric_orientation": -0.0011929065899829092, + "paired_source_case_sample_sd": 0.001576085624924554, + "seed": 11 + }, + { + "calculator_anova_icc_unclipped": 0.20695905753657332, + "negative_icc_sample_estimate": false, + "paired_delta_mean_raw_metric_orientation": -0.0011929065899829092, + "paired_source_case_sample_sd": 0.001576085624924554, + "seed": 29 + }, + { + "calculator_anova_icc_unclipped": 0.20695905753657332, + "negative_icc_sample_estimate": false, + "paired_delta_mean_raw_metric_orientation": -0.0011929065899829092, + "paired_source_case_sample_sd": 0.001576085624924554, + "seed": 47 + } + ], + "split": "S1_CAL_EVAL", + "training_seed_count": 3 + }, + { + "crossed_source_case_calculator_seed_nuisance_qualified": false, + "descriptive_sd_of_three_seed_effect_means": 0.021650635094610966, + "intervention": "B1_TYPED_V1", + "metric": "canonical_accuracy", + "negative_sample_icc_cells": 2, + "paired_sd_max_across_three_seed_snapshots": 0.9981227495569474, + "paired_sd_min_across_three_seed_snapshots": 0.05103768227223688, + "seed_level_development_evidence": [ + { + "calculator_anova_icc_unclipped": -0.006619880083602553, + "negative_icc_sample_estimate": true, + "paired_delta_mean_raw_metric_orientation": 0.0, + "paired_source_case_sample_sd": 0.05103768227223688, + "seed": 11 + }, + { + "calculator_anova_icc_unclipped": 0.0012066779657875838, + "negative_icc_sample_estimate": false, + "paired_delta_mean_raw_metric_orientation": 0.0375, + "paired_source_case_sample_sd": 0.9981227495569474, + "seed": 29 + }, + { + "calculator_anova_icc_unclipped": -0.006619880083602553, + "negative_icc_sample_estimate": true, + "paired_delta_mean_raw_metric_orientation": 0.0, + "paired_source_case_sample_sd": 0.05103768227223688, + "seed": 47 + } + ], + "split": "S1_DEV_EVAL", + "training_seed_count": 3 + }, + { + "crossed_source_case_calculator_seed_nuisance_qualified": false, + "descriptive_sd_of_three_seed_effect_means": 0.04330127018922194, + "intervention": "B1_TYPED_V1", + "metric": "canonical_brier", + "negative_sample_icc_cells": 0, + "paired_sd_max_across_three_seed_snapshots": 1.3413716999350427, + "paired_sd_min_across_three_seed_snapshots": 0.6817620899869352, + "seed_level_development_evidence": [ + { + "calculator_anova_icc_unclipped": 0.004919014389611121, + "negative_icc_sample_estimate": false, + "paired_delta_mean_raw_metric_orientation": 0.45753694318235555, + "paired_source_case_sample_sd": 0.6817620899869352, + "seed": 11 + }, + { + "calculator_anova_icc_unclipped": 0.0029602274927274393, + "negative_icc_sample_estimate": false, + "paired_delta_mean_raw_metric_orientation": 0.38253694318235554, + "paired_source_case_sample_sd": 1.3413716999350427, + "seed": 29 + }, + { + "calculator_anova_icc_unclipped": 0.004919014389611121, + "negative_icc_sample_estimate": false, + "paired_delta_mean_raw_metric_orientation": 0.45753694318235555, + "paired_source_case_sample_sd": 0.6817620899869352, + "seed": 47 + } + ], + "split": "S1_DEV_EVAL", + "training_seed_count": 3 + }, + { + "crossed_source_case_calculator_seed_nuisance_qualified": false, + "descriptive_sd_of_three_seed_effect_means": 0.7477864443405731, + "intervention": "B1_TYPED_V1", + "metric": "canonical_nll", + "negative_sample_icc_cells": 0, + "paired_sd_max_across_three_seed_snapshots": 17.617371239287852, + "paired_sd_min_across_three_seed_snapshots": 16.90355404821849, + "seed_level_development_evidence": [ + { + "calculator_anova_icc_unclipped": 0.001242382313467346, + "negative_icc_sample_estimate": false, + "paired_delta_mean_raw_metric_orientation": 17.13381277305445, + "paired_source_case_sample_sd": 16.90355404821849, + "seed": 11 + }, + { + "calculator_anova_icc_unclipped": 0.0013354090048129865, + "negative_icc_sample_estimate": false, + "paired_delta_mean_raw_metric_orientation": 15.838608658245303, + "paired_source_case_sample_sd": 17.617371239287852, + "seed": 29 + }, + { + "calculator_anova_icc_unclipped": 0.001242382313467346, + "negative_icc_sample_estimate": false, + "paired_delta_mean_raw_metric_orientation": 17.13381277305445, + "paired_source_case_sample_sd": 16.90355404821849, + "seed": 47 + } + ], + "split": "S1_DEV_EVAL", + "training_seed_count": 3 + }, + { + "crossed_source_case_calculator_seed_nuisance_qualified": false, + "descriptive_sd_of_three_seed_effect_means": 0.0, + "intervention": "B1_TYPED_V1", + "metric": "semantic_js", + "negative_sample_icc_cells": 0, + "paired_sd_max_across_three_seed_snapshots": 0.0015590836876537464, + "paired_sd_min_across_three_seed_snapshots": 0.0015590836876537464, + "seed_level_development_evidence": [ + { + "calculator_anova_icc_unclipped": 0.1901262042968699, + "negative_icc_sample_estimate": false, + "paired_delta_mean_raw_metric_orientation": -0.0012071127534053192, + "paired_source_case_sample_sd": 0.0015590836876537464, + "seed": 11 + }, + { + "calculator_anova_icc_unclipped": 0.1901262042968699, + "negative_icc_sample_estimate": false, + "paired_delta_mean_raw_metric_orientation": -0.0012071127534053192, + "paired_source_case_sample_sd": 0.0015590836876537464, + "seed": 29 + }, + { + "calculator_anova_icc_unclipped": 0.1901262042968699, + "negative_icc_sample_estimate": false, + "paired_delta_mean_raw_metric_orientation": -0.0012071127534053192, + "paired_source_case_sample_sd": 0.0015590836876537464, + "seed": 47 + } + ], + "split": "S1_DEV_EVAL", + "training_seed_count": 3 + }, + { + "crossed_source_case_calculator_seed_nuisance_qualified": false, + "descriptive_sd_of_three_seed_effect_means": 0.0008371224618917495, + "intervention": "C1_CRDI_V1", + "metric": "canonical_accuracy", + "negative_sample_icc_cells": 2, + "paired_sd_max_across_three_seed_snapshots": 0.8066495524560556, + "paired_sd_min_across_three_seed_snapshots": 0.06653225275976475, + "seed_level_development_evidence": [ + { + "calculator_anova_icc_unclipped": -0.007508836616513272, + "negative_icc_sample_estimate": true, + "paired_delta_mean_raw_metric_orientation": 0.002864583333333333, + "paired_source_case_sample_sd": 0.13974308431098253, + "seed": 11 + }, + { + "calculator_anova_icc_unclipped": 0.0020174871665865238, + "negative_icc_sample_estimate": false, + "paired_delta_mean_raw_metric_orientation": 0.0026041666666666665, + "paired_source_case_sample_sd": 0.8066495524560556, + "seed": 29 + }, + { + "calculator_anova_icc_unclipped": -0.006201269801404243, + "negative_icc_sample_estimate": true, + "paired_delta_mean_raw_metric_orientation": 0.0013020833333333333, + "paired_source_case_sample_sd": 0.06653225275976475, + "seed": 47 + } + ], + "split": "S1_CAL_EVAL", + "training_seed_count": 3 + }, + { + "crossed_source_case_calculator_seed_nuisance_qualified": false, + "descriptive_sd_of_three_seed_effect_means": 0.018169777789641777, + "intervention": "C1_CRDI_V1", + "metric": "canonical_brier", + "negative_sample_icc_cells": 0, + "paired_sd_max_across_three_seed_snapshots": 0.40125591364192076, + "paired_sd_min_across_three_seed_snapshots": 0.0900057778073333, + "seed_level_development_evidence": [ + { + "calculator_anova_icc_unclipped": 0.026970868417359063, + "negative_icc_sample_estimate": false, + "paired_delta_mean_raw_metric_orientation": -0.03383745709027565, + "paired_source_case_sample_sd": 0.11907580629432579, + "seed": 11 + }, + { + "calculator_anova_icc_unclipped": 0.02145511657388405, + "negative_icc_sample_estimate": false, + "paired_delta_mean_raw_metric_orientation": -0.05847347656141426, + "paired_source_case_sample_sd": 0.40125591364192076, + "seed": 29 + }, + { + "calculator_anova_icc_unclipped": 0.05917101097715549, + "negative_icc_sample_estimate": false, + "paired_delta_mean_raw_metric_orientation": -0.02302059307995781, + "paired_source_case_sample_sd": 0.0900057778073333, + "seed": 47 + } + ], + "split": "S1_CAL_EVAL", + "training_seed_count": 3 + }, + { + "crossed_source_case_calculator_seed_nuisance_qualified": false, + "descriptive_sd_of_three_seed_effect_means": 0.019943745964850348, + "intervention": "C1_CRDI_V1", + "metric": "canonical_nll", + "negative_sample_icc_cells": 0, + "paired_sd_max_across_three_seed_snapshots": 0.42743677423265, + "paired_sd_min_across_three_seed_snapshots": 0.11169996417957474, + "seed_level_development_evidence": [ + { + "calculator_anova_icc_unclipped": 0.03696676680483291, + "negative_icc_sample_estimate": false, + "paired_delta_mean_raw_metric_orientation": -0.03997805953903574, + "paired_source_case_sample_sd": 0.13599166902715992, + "seed": 11 + }, + { + "calculator_anova_icc_unclipped": 0.027007424526614286, + "negative_icc_sample_estimate": false, + "paired_delta_mean_raw_metric_orientation": -0.06732335401979703, + "paired_source_case_sample_sd": 0.42743677423265, + "seed": 29 + }, + { + "calculator_anova_icc_unclipped": 0.07793258456763356, + "negative_icc_sample_estimate": false, + "paired_delta_mean_raw_metric_orientation": -0.02850244318823005, + "paired_source_case_sample_sd": 0.11169996417957474, + "seed": 47 + } + ], + "split": "S1_CAL_EVAL", + "training_seed_count": 3 + }, + { + "crossed_source_case_calculator_seed_nuisance_qualified": false, + "descriptive_sd_of_three_seed_effect_means": 0.00022088957073678627, + "intervention": "C1_CRDI_V1", + "metric": "semantic_js", + "negative_sample_icc_cells": 0, + "paired_sd_max_across_three_seed_snapshots": 0.0016096714091009096, + "paired_sd_min_across_three_seed_snapshots": 0.001160656989884033, + "seed_level_development_evidence": [ + { + "calculator_anova_icc_unclipped": 0.06497277352293351, + "negative_icc_sample_estimate": false, + "paired_delta_mean_raw_metric_orientation": -8.890612907443458e-05, + "paired_source_case_sample_sd": 0.001160656989884033, + "seed": 11 + }, + { + "calculator_anova_icc_unclipped": 0.19098753433471102, + "negative_icc_sample_estimate": false, + "paired_delta_mean_raw_metric_orientation": 1.9884117086192228e-05, + "paired_source_case_sample_sd": 0.0012734437900963269, + "seed": 29 + }, + { + "calculator_anova_icc_unclipped": 0.19233163153053537, + "negative_icc_sample_estimate": false, + "paired_delta_mean_raw_metric_orientation": 0.0003362990790036817, + "paired_source_case_sample_sd": 0.0016096714091009096, + "seed": 47 + } + ], + "split": "S1_CAL_EVAL", + "training_seed_count": 3 + }, + { + "crossed_source_case_calculator_seed_nuisance_qualified": false, + "descriptive_sd_of_three_seed_effect_means": 0.011201953406764144, + "intervention": "C1_CRDI_V1", + "metric": "canonical_accuracy", + "negative_sample_icc_cells": 2, + "paired_sd_max_across_three_seed_snapshots": 0.8077144905133814, + "paired_sd_min_across_three_seed_snapshots": 0.05819132822622998, + "seed_level_development_evidence": [ + { + "calculator_anova_icc_unclipped": -0.010732067939085023, + "negative_icc_sample_estimate": true, + "paired_delta_mean_raw_metric_orientation": 0.0, + "paired_source_case_sample_sd": 0.1369484723697091, + "seed": 11 + }, + { + "calculator_anova_icc_unclipped": 0.0038088170256413657, + "negative_icc_sample_estimate": false, + "paired_delta_mean_raw_metric_orientation": 0.019270833333333334, + "paired_source_case_sample_sd": 0.8077144905133814, + "seed": 29 + }, + { + "calculator_anova_icc_unclipped": -0.007699645539026918, + "negative_icc_sample_estimate": true, + "paired_delta_mean_raw_metric_orientation": -0.00026041666666666666, + "paired_source_case_sample_sd": 0.05819132822622998, + "seed": 47 + } + ], + "split": "S1_DEV_EVAL", + "training_seed_count": 3 + }, + { + "crossed_source_case_calculator_seed_nuisance_qualified": false, + "descriptive_sd_of_three_seed_effect_means": 0.02259421879029782, + "intervention": "C1_CRDI_V1", + "metric": "canonical_brier", + "negative_sample_icc_cells": 0, + "paired_sd_max_across_three_seed_snapshots": 0.4004160043512207, + "paired_sd_min_across_three_seed_snapshots": 0.0919869006526937, + "seed_level_development_evidence": [ + { + "calculator_anova_icc_unclipped": 0.018382131913562024, + "negative_icc_sample_estimate": false, + "paired_delta_mean_raw_metric_orientation": -0.03562428311822003, + "paired_source_case_sample_sd": 0.11839556239668464, + "seed": 11 + }, + { + "calculator_anova_icc_unclipped": 0.01630492393600092, + "negative_icc_sample_estimate": false, + "paired_delta_mean_raw_metric_orientation": -0.06846399753914564, + "paired_source_case_sample_sd": 0.4004160043512207, + "seed": 29 + }, + { + "calculator_anova_icc_unclipped": 0.0737006489988498, + "negative_icc_sample_estimate": false, + "paired_delta_mean_raw_metric_orientation": -0.025161784855332308, + "paired_source_case_sample_sd": 0.0919869006526937, + "seed": 47 + } + ], + "split": "S1_DEV_EVAL", + "training_seed_count": 3 + }, + { + "crossed_source_case_calculator_seed_nuisance_qualified": false, + "descriptive_sd_of_three_seed_effect_means": 0.024501961956116355, + "intervention": "C1_CRDI_V1", + "metric": "canonical_nll", + "negative_sample_icc_cells": 0, + "paired_sd_max_across_three_seed_snapshots": 0.42710344903741737, + "paired_sd_min_across_three_seed_snapshots": 0.11509845122444952, + "seed_level_development_evidence": [ + { + "calculator_anova_icc_unclipped": 0.03379467584206752, + "negative_icc_sample_estimate": false, + "paired_delta_mean_raw_metric_orientation": -0.042230409515244476, + "paired_source_case_sample_sd": 0.13562373979744197, + "seed": 11 + }, + { + "calculator_anova_icc_unclipped": 0.024071939417573813, + "negative_icc_sample_estimate": false, + "paired_delta_mean_raw_metric_orientation": -0.07816734636624217, + "paired_source_case_sample_sd": 0.42710344903741737, + "seed": 29 + }, + { + "calculator_anova_icc_unclipped": 0.11040721007220687, + "negative_icc_sample_estimate": false, + "paired_delta_mean_raw_metric_orientation": -0.031346826949133176, + "paired_source_case_sample_sd": 0.11509845122444952, + "seed": 47 + } + ], + "split": "S1_DEV_EVAL", + "training_seed_count": 3 + }, + { + "crossed_source_case_calculator_seed_nuisance_qualified": false, + "descriptive_sd_of_three_seed_effect_means": 0.0001943705693379185, + "intervention": "C1_CRDI_V1", + "metric": "semantic_js", + "negative_sample_icc_cells": 0, + "paired_sd_max_across_three_seed_snapshots": 0.0016013933167382222, + "paired_sd_min_across_three_seed_snapshots": 0.0011428278367251752, + "seed_level_development_evidence": [ + { + "calculator_anova_icc_unclipped": 0.05252639920674425, + "negative_icc_sample_estimate": false, + "paired_delta_mean_raw_metric_orientation": -6.481724229309947e-05, + "paired_source_case_sample_sd": 0.0011428278367251752, + "seed": 11 + }, + { + "calculator_anova_icc_unclipped": 0.17514342451876536, + "negative_icc_sample_estimate": false, + "paired_delta_mean_raw_metric_orientation": 2.540431657398543e-05, + "paired_source_case_sample_sd": 0.001265250139545107, + "seed": 29 + }, + { + "calculator_anova_icc_unclipped": 0.18727380415535164, + "negative_icc_sample_estimate": false, + "paired_delta_mean_raw_metric_orientation": 0.00030776079872690235, + "paired_source_case_sample_sd": 0.0016013933167382222, + "seed": 47 + } + ], + "split": "S1_DEV_EVAL", + "training_seed_count": 3 + }, + { + "crossed_source_case_calculator_seed_nuisance_qualified": false, + "descriptive_sd_of_three_seed_effect_means": 0.0014807918497597205, + "intervention": "C2_CRDI_RETAIN_V1", + "metric": "canonical_accuracy", + "negative_sample_icc_cells": 2, + "paired_sd_max_across_three_seed_snapshots": 0.741888304518861, + "paired_sd_min_across_three_seed_snapshots": 0.055906553068885485, + "seed_level_development_evidence": [ + { + "calculator_anova_icc_unclipped": 0.02054939963707965, + "negative_icc_sample_estimate": false, + "paired_delta_mean_raw_metric_orientation": 0.00026041666666666666, + "paired_source_case_sample_sd": 0.10079101007138244, + "seed": 11 + }, + { + "calculator_anova_icc_unclipped": -0.00021803822093286452, + "negative_icc_sample_estimate": true, + "paired_delta_mean_raw_metric_orientation": 0.00234375, + "paired_source_case_sample_sd": 0.741888304518861, + "seed": 29 + }, + { + "calculator_anova_icc_unclipped": -0.008430112862330077, + "negative_icc_sample_estimate": true, + "paired_delta_mean_raw_metric_orientation": -0.0005208333333333333, + "paired_source_case_sample_sd": 0.055906553068885485, + "seed": 47 + } + ], + "split": "S1_CAL_EVAL", + "training_seed_count": 3 + }, + { + "crossed_source_case_calculator_seed_nuisance_qualified": false, + "descriptive_sd_of_three_seed_effect_means": 0.024266005213578624, + "intervention": "C2_CRDI_RETAIN_V1", + "metric": "canonical_brier", + "negative_sample_icc_cells": 0, + "paired_sd_max_across_three_seed_snapshots": 0.3736266314498486, + "paired_sd_min_across_three_seed_snapshots": 0.07606321139112197, + "seed_level_development_evidence": [ + { + "calculator_anova_icc_unclipped": 0.030910955363216086, + "negative_icc_sample_estimate": false, + "paired_delta_mean_raw_metric_orientation": -0.018885842186717083, + "paired_source_case_sample_sd": 0.07606321139112197, + "seed": 11 + }, + { + "calculator_anova_icc_unclipped": 0.022162335045111645, + "negative_icc_sample_estimate": false, + "paired_delta_mean_raw_metric_orientation": -0.060045393276461884, + "paired_source_case_sample_sd": 0.3736266314498486, + "seed": 29 + }, + { + "calculator_anova_icc_unclipped": 0.06286739655526835, + "negative_icc_sample_estimate": false, + "paired_delta_mean_raw_metric_orientation": -0.017196007437642023, + "paired_source_case_sample_sd": 0.07992033107112116, + "seed": 47 + } + ], + "split": "S1_CAL_EVAL", + "training_seed_count": 3 + }, + { + "crossed_source_case_calculator_seed_nuisance_qualified": false, + "descriptive_sd_of_three_seed_effect_means": 0.027055881389745694, + "intervention": "C2_CRDI_RETAIN_V1", + "metric": "canonical_nll", + "negative_sample_icc_cells": 0, + "paired_sd_max_across_three_seed_snapshots": 0.39921650266444775, + "paired_sd_min_across_three_seed_snapshots": 0.08621870137686419, + "seed_level_development_evidence": [ + { + "calculator_anova_icc_unclipped": 0.03612168613884462, + "negative_icc_sample_estimate": false, + "paired_delta_mean_raw_metric_orientation": -0.022493430248402828, + "paired_source_case_sample_sd": 0.08621870137686419, + "seed": 11 + }, + { + "calculator_anova_icc_unclipped": 0.027995679193096586, + "negative_icc_sample_estimate": false, + "paired_delta_mean_raw_metric_orientation": -0.06892823893404372, + "paired_source_case_sample_sd": 0.39921650266444775, + "seed": 29 + }, + { + "calculator_anova_icc_unclipped": 0.08398742343060134, + "negative_icc_sample_estimate": false, + "paired_delta_mean_raw_metric_orientation": -0.021650108083615303, + "paired_source_case_sample_sd": 0.0975868204907611, + "seed": 47 + } + ], + "split": "S1_CAL_EVAL", + "training_seed_count": 3 + }, + { + "crossed_source_case_calculator_seed_nuisance_qualified": false, + "descriptive_sd_of_three_seed_effect_means": 0.00027076169962905717, + "intervention": "C2_CRDI_RETAIN_V1", + "metric": "semantic_js", + "negative_sample_icc_cells": 0, + "paired_sd_max_across_three_seed_snapshots": 0.0017319925871849859, + "paired_sd_min_across_three_seed_snapshots": 0.001207166053757415, + "seed_level_development_evidence": [ + { + "calculator_anova_icc_unclipped": 0.08505945505324444, + "negative_icc_sample_estimate": false, + "paired_delta_mean_raw_metric_orientation": -2.623242995836794e-05, + "paired_source_case_sample_sd": 0.001207166053757415, + "seed": 11 + }, + { + "calculator_anova_icc_unclipped": 0.1505159773376978, + "negative_icc_sample_estimate": false, + "paired_delta_mean_raw_metric_orientation": 5.545291349656339e-05, + "paired_source_case_sample_sd": 0.0012720997650370685, + "seed": 29 + }, + { + "calculator_anova_icc_unclipped": 0.23666775820168393, + "negative_icc_sample_estimate": false, + "paired_delta_mean_raw_metric_orientation": 0.0004782171037292447, + "paired_source_case_sample_sd": 0.0017319925871849859, + "seed": 47 + } + ], + "split": "S1_CAL_EVAL", + "training_seed_count": 3 + }, + { + "crossed_source_case_calculator_seed_nuisance_qualified": false, + "descriptive_sd_of_three_seed_effect_means": 0.007672354095133456, + "intervention": "C2_CRDI_RETAIN_V1", + "metric": "canonical_accuracy", + "negative_sample_icc_cells": 2, + "paired_sd_max_across_three_seed_snapshots": 0.74790669058188, + "paired_sd_min_across_three_seed_snapshots": 0.060386353411913105, + "seed_level_development_evidence": [ + { + "calculator_anova_icc_unclipped": -0.004376395498160103, + "negative_icc_sample_estimate": true, + "paired_delta_mean_raw_metric_orientation": -0.0010416666666666667, + "paired_source_case_sample_sd": 0.0994853039019062, + "seed": 11 + }, + { + "calculator_anova_icc_unclipped": 0.0024009197730366066, + "negative_icc_sample_estimate": false, + "paired_delta_mean_raw_metric_orientation": 0.0125, + "paired_source_case_sample_sd": 0.74790669058188, + "seed": 29 + }, + { + "calculator_anova_icc_unclipped": -0.004728700193490492, + "negative_icc_sample_estimate": true, + "paired_delta_mean_raw_metric_orientation": -0.0005208333333333333, + "paired_source_case_sample_sd": 0.060386353411913105, + "seed": 47 + } + ], + "split": "S1_DEV_EVAL", + "training_seed_count": 3 + }, + { + "crossed_source_case_calculator_seed_nuisance_qualified": false, + "descriptive_sd_of_three_seed_effect_means": 0.02857394960286652, + "intervention": "C2_CRDI_RETAIN_V1", + "metric": "canonical_brier", + "negative_sample_icc_cells": 0, + "paired_sd_max_across_three_seed_snapshots": 0.3723804676136071, + "paired_sd_min_across_three_seed_snapshots": 0.07577938693196312, + "seed_level_development_evidence": [ + { + "calculator_anova_icc_unclipped": 0.018227559363594686, + "negative_icc_sample_estimate": false, + "paired_delta_mean_raw_metric_orientation": -0.019839864164092672, + "paired_source_case_sample_sd": 0.07577938693196312, + "seed": 11 + }, + { + "calculator_anova_icc_unclipped": 0.016015850506059946, + "negative_icc_sample_estimate": false, + "paired_delta_mean_raw_metric_orientation": -0.06844128144483554, + "paired_source_case_sample_sd": 0.3723804676136071, + "seed": 29 + }, + { + "calculator_anova_icc_unclipped": 0.07206190911016588, + "negative_icc_sample_estimate": false, + "paired_delta_mean_raw_metric_orientation": -0.01810524168598592, + "paired_source_case_sample_sd": 0.07944530471976274, + "seed": 47 + } + ], + "split": "S1_DEV_EVAL", + "training_seed_count": 3 + }, + { + "crossed_source_case_calculator_seed_nuisance_qualified": false, + "descriptive_sd_of_three_seed_effect_means": 0.03165483254032413, + "intervention": "C2_CRDI_RETAIN_V1", + "metric": "canonical_nll", + "negative_sample_icc_cells": 0, + "paired_sd_max_across_three_seed_snapshots": 0.39854238263238106, + "paired_sd_min_across_three_seed_snapshots": 0.08604680373058383, + "seed_level_development_evidence": [ + { + "calculator_anova_icc_unclipped": 0.02536377849611033, + "negative_icc_sample_estimate": false, + "paired_delta_mean_raw_metric_orientation": -0.02374340880927646, + "paired_source_case_sample_sd": 0.08604680373058383, + "seed": 11 + }, + { + "calculator_anova_icc_unclipped": 0.024365718280244673, + "negative_icc_sample_estimate": false, + "paired_delta_mean_raw_metric_orientation": -0.07815683653241842, + "paired_source_case_sample_sd": 0.39854238263238106, + "seed": 29 + }, + { + "calculator_anova_icc_unclipped": 0.10560896521997758, + "negative_icc_sample_estimate": false, + "paired_delta_mean_raw_metric_orientation": -0.022923895096810733, + "paired_source_case_sample_sd": 0.09747790936694539, + "seed": 47 + } + ], + "split": "S1_DEV_EVAL", + "training_seed_count": 3 + }, + { + "crossed_source_case_calculator_seed_nuisance_qualified": false, + "descriptive_sd_of_three_seed_effect_means": 0.0002470052517121944, + "intervention": "C2_CRDI_RETAIN_V1", + "metric": "semantic_js", + "negative_sample_icc_cells": 0, + "paired_sd_max_across_three_seed_snapshots": 0.001751758616376404, + "paired_sd_min_across_three_seed_snapshots": 0.0011946247231131484, + "seed_level_development_evidence": [ + { + "calculator_anova_icc_unclipped": 0.06912872996326824, + "negative_icc_sample_estimate": false, + "paired_delta_mean_raw_metric_orientation": -1.4436824493398018e-05, + "paired_source_case_sample_sd": 0.0011946247231131484, + "seed": 11 + }, + { + "calculator_anova_icc_unclipped": 0.14218933077826645, + "negative_icc_sample_estimate": false, + "paired_delta_mean_raw_metric_orientation": 4.3942259301281294e-05, + "paired_source_case_sample_sd": 0.0012451153313204088, + "seed": 29 + }, + { + "calculator_anova_icc_unclipped": 0.23807769282776822, + "negative_icc_sample_estimate": false, + "paired_delta_mean_raw_metric_orientation": 0.000439580559066519, + "paired_source_case_sample_sd": 0.001751758616376404, + "seed": 47 + } + ], + "split": "S1_DEV_EVAL", + "training_seed_count": 3 + } + ], + "independent_statistical_review_completed": false, + "observed_negative_unclipped_icc_estimates": 12, + "planned_confirmatory_source_cases_unmaterialized": 4096, + "primary_non_target_family_size": null, + "prospective_primary_non_target_hypothesis_family": null, + "publication_or_clinical_authorized": false, + "review_decisions_required": [ + "Declare full non-target Holm family before estimating final power", + "Choose conditional-on-selected-calculators versus transport estimand", + "Prespecify crossed source-case/calculator/training-seed dependence and missingness", + "Prespecify per-cell orientation, native-unit margins, coupling and fixed-policy rules", + "Verify each-primary-effect 90% power at actual family size or apply power-failure rule", + "Obtain independent statistical/code/provenance review and founder execution authority" + ], + "schema": "commandmed.v5.descriptive-statistical-review-packet.v1", + "seed_ids": [ + 11, + 29, + 47 + ], + "source_case_calculator_seed_crossed_covariance_model": null, + "source_cases_per_development_split": 3840, + "source_sha256": { + "development_calculator_icc": "37d64c0f6ac14d04cc6420a020e7bb7997fb333e50729f33798b2d403d292370", + "development_paired_sd": "b1edf781b61d3f5ce227c08908ca43ad9864c0b398a7318c33895951af37bacd" + }, + "status": "SOURCE_BOUND_DESCRIPTIVE_REVIEW_PACKET_NOT_POWER" +} diff --git a/docs/research/paper-rebuild-v2-2026-10-02/V5_S1_DESCRIPTIVE_STATISTICAL_REVIEW_PACKET_2026-10-10.md b/docs/research/paper-rebuild-v2-2026-10-02/V5_S1_DESCRIPTIVE_STATISTICAL_REVIEW_PACKET_2026-10-10.md new file mode 100644 index 00000000..da2ee34e --- /dev/null +++ b/docs/research/paper-rebuild-v2-2026-10-02/V5_S1_DESCRIPTIVE_STATISTICAL_REVIEW_PACKET_2026-10-10.md @@ -0,0 +1,30 @@ +# V5 — Source-bound descriptive statistical reviewer packet (2026-10-10) + +**Status: `REVIEW_PACKET_ONLY / NO_PRIMARY_HOLM_FAMILY_FREEZE / NOT_90_PERCENT_POWER / NO_CONFIRMATORY_AUTHORITY`.** + +This is an audit-ready model-free bridge between the 72 original paired source-case SD descriptions and 72 original calculator ANOVA-method-of-moments ICC estimates. It **does not** select non-target hypotheses, treat three independent model-training seeds as 11,520 independent cases, estimate a scientifically adequate crossed source/calculator/seed covariance model, adjust significance thresholds, infer generalization to other calculators, or qualify any effect for confirmatory access. + +## Original immutable inputs and bounded reproduction + +- Development paired SD source: `artifacts/v5/development/s1-paired-sd-inventory-2026-10-09/development-paired-sd.json` (SHA-256 `b1edf781b61d3f5ce227c08908ca43ad9864c0b398a7318c33895951af37bacd`). +- Original development calculator ICC source: `artifacts/v5/development/s1-calculator-icc-inventory-2026-10-10/development-calculator-icc.json` (SHA-256 `37d64c0f6ac14d04cc6420a020e7bb7997fb333e50729f33798b2d403d292370`). +- Deterministic composite output: `artifacts/v5/development/s1-statistical-review-packet-2026-10-10/reviewer-packet.json` (new additive development-only file, not among the immutable 307). SHA-256: `86a275cb5cd7760f421538df34fea8b6dc452a19d095ddc4f4c6f0e69a87e348`. +- Generator: `scripts/v5_s1_statistical_review_packet.py`; no model weights, network, GPU, PHI, new source-case IDs, or external API calls. From the repository root, run `python3 scripts/v5_s1_statistical_review_packet.py --verify artifacts/v5/development/s1-statistical-review-packet-2026-10-10/reviewer-packet.json`. `--output` writes **only to a previously nonexistent path**; `--verify` never modifies it. +- The generator first executes the full source-bound audit: all 307 frozen entries and 9 locked development sources must have their original hashes. It rejects mismatched source mean effects across independently stored SD and ICC descriptions, missing/duplicate cells, changed seed membership, erased negative ICCs, forged review status, and mismatched three-seed descriptive sample SDs. GitHub CI reruns the audit, generator replay, and mutation tests on the exact PR head. + +## What reviewers can now inspect (not an inferential result) + +All **24 development groups** are enumerated without selecting favorable effects: three intervention paths `B1_TYPED_V1`, `C1_CRDI_V1`, `C2_CRDI_RETAIN_V1`; two splits `S1_DEV_EVAL`, `S1_CAL_EVAL`; and four measured metrics `canonical_accuracy`, `canonical_nll`, `canonical_brier`, `semantic_js`. Each group includes **three separate seed records** (`11`, `29`, `47`) with the observed raw-orientation paired effect mean, within-seed paired source-case SD, unchanged *unclipped* calculator-effect ICC, and a negative-ICC indicator; the group also includes a descriptive across-three-seed mean-effect sample SD and the minimum/maximum of the three separate within-seed SDs. In total 72 records are cross-checked, including the 12 negative ICC estimates. Every evaluation split retains its 64 selected calculators × 60 source cases = 3,840 source-case identities, distinct from the **unmaterialized** prospective 4,096 cases (64 × 64). + +These numbers cannot be combined by an unreviewed arithmetic pooling formula into final 90% power: the covariance of three model-training seeds, source cases nested under selected calculators, shared baselines, coupling across axes, missingness, native metric orientation, fixed-policy settings, and sampling/generalization population must be specified **before** that calculation. `semantic_js`, NLL and Brier are lower-is-better in their original measurement conventions; no signed effect is silently reoriented for hypothesis selection. Negative finite-sample ICC estimates must remain visible and are not negative population variance components. + +## Required independent methodological decisions (Issue #326) + +1. Enumerate the complete eligible **non-target** primary hard-gate cells, their exact intervention, target and non-target axis, metric orientation, fixed policy, split/inferential population and coupling; calculate the actual Holm family size from that reviewed list. Do not select cells based on this packet's rankings. +2. Decide whether the inference is conditional on the selected 64 calculators or generalizes beyond them. Document source-case clustering and calculator sampling assumptions. +3. Prespecify whether effects average over or condition on seeds; handle shared baselines, crossed case/seed dependence and covariance with only three training seeds. Acknowledge when evidence is insufficient. +4. Prespecify all native-unit noninferiority margins, invalid/missing output and abstention/retention/coupled-axis conventions, separately distinguishing benchmark scales from patient safety tolerances. +5. Re-evaluate 90% power **for every actual primary effect** using the full reviewed Holm family and conservative uncertainty bound at 4,096 source cases; if insufficient, apply the prospective power-failure rule without weakening margins or selecting fewer cells. +6. Obtain actual independent scientific/methodological and code/rights review, cryptographically verified signing and authorized founder compute/science decisions. These are not supplied by reproducible development evidence. + +**Non-claims:** No improvement in near-chance rule conformance, no qualified B1 NLL claim, no clinical validity, no independent replication, no completed reviewer certification, no accepted manuscript, no release, no unreviewed confirmatory/reserve access. All authority flags in the machine-readable packet remain `false`, and the exact family count and crossed covariance model remain `null`. diff --git a/scripts/v5_s1_statistical_review_packet.py b/scripts/v5_s1_statistical_review_packet.py new file mode 100644 index 00000000..480bb579 --- /dev/null +++ b/scripts/v5_s1_statistical_review_packet.py @@ -0,0 +1,188 @@ +#!/usr/bin/env python3 +"""Prepare a source-bound V5 development-only reviewer packet, never a power result.""" +from __future__ import annotations + +import argparse +import json +import math +import statistics +from pathlib import Path +from typing import Any + +import v5_manuscript_development_evidence_audit as bound + +INTERVENTIONS = {"B1_TYPED_V1": "B1", "C1_CRDI_V1": "C1", "C2_CRDI_RETAIN_V1": "C2"} +SEEDS = (11, 29, 47) +SPLITS = ("S1_DEV_EVAL", "S1_CAL_EVAL") +METRICS = ("canonical_accuracy", "canonical_nll", "canonical_brier", "semantic_js") + + +class ReviewerPacketError(ValueError): + """Source snapshots are incomplete, inconsistent or scientifically promoted.""" + + +def require(ok: bool, code: str) -> None: + if not ok: + raise ReviewerPacketError(code) + + +def exact_float(a: Any, b: Any) -> bool: + return (type(a) in (int, float) and type(b) in (int, float) + and math.isfinite(a) and math.isfinite(b) + and math.isclose(a, b, rel_tol=1e-12, abs_tol=1e-12)) + + +def create_packet(sd: dict[str, Any], icc: dict[str, Any]) -> dict[str, Any]: + """Connect separately frozen development diagnostics without fitting inference.""" + require(sd.get("primary_non_target_family_size") is None + and sd.get("training_seed_uncertainty_not_included_in_paired_item_sd") is True + and sd.get("confirmatory") is False and sd.get("reserve") is False, + "SOURCE_SD_SCIENCE_AUTHORITY_DRIFT") + bounds = icc.get("boundaries", {}) + for name in ("confirmatory_authorized", "final_90_percent_power_qualified", + "source_case_seed_crossed_variance_qualified", + "primary_holm_family_independently_reviewed"): + require(bounds.get(name) is False, "ICC_SCIENCE_AUTHORITY_DRIFT:" + name) + require(bounds.get("source_cases_per_split") == 3840 + and bounds.get("frozen_confirmatory_source_case_count") == 4096 + and icc.get("reference_sd_sha256") == bound.LOCKED_SOURCES["sd_inventory"][1], + "SOURCE_SCOPE_OR_HASH_DRIFT") + results = sd.get("intervention_results", {}) + expected_conditions = {f"{prefix}_{seed}" for prefix in INTERVENTIONS.values() for seed in SEEDS} + require(isinstance(results, dict) and set(results) == expected_conditions, + "MISSING_OR_EXTRA_SOURCE_CONDITIONS") + rows = icc.get("all_development_cells", []) + require(isinstance(rows, list) and len(rows) == 72, "ICC_CELL_SET_DRIFT") + indexed: dict[tuple[str, str, str, int], dict[str, Any]] = {} + for row in rows: + require(isinstance(row, dict), "INVALID_ICC_CELL") + key = (row.get("intervention"), row.get("split"), row.get("metric"), row.get("seed")) + require(key[0] in INTERVENTIONS and key[1] in SPLITS and key[2] in METRICS + and type(key[3]) is int and key[3] in SEEDS + and key not in indexed, "DUPLICATE_OR_UNKNOWN_ICC_CELL") + require(row.get("condition") == f"{INTERVENTIONS[key[0]]}_{key[3]}" + and row.get("calculator_count") == 64 + and row.get("source_cases_per_calculator") == 60, + "SOURCE_CASE_OR_CONDITION_DRIFT") + rho = row.get("anovamom_rho_unclipped") + require(type(rho) is float and math.isfinite(rho), "INVALID_ICC_VALUE") + require(row.get("rho_status") == ( + "NEGATIVE_FINITE_SAMPLE_ESTIMATE" if rho < 0 + else "DESCRIPTIVE_NONNEGATIVE_ESTIMATE"), "ICC_SIGN_STATUS_DRIFT") + indexed[key] = row + require(len(indexed) == 72, "INCOMPLETE_ICC_MAPPING") + spreads = icc.get("three_seed_between_effect_spreads", []) + require(isinstance(spreads, list) and len(spreads) == 24, "SEED_SPREAD_GROUP_COUNT_DRIFT") + groups: dict[tuple[str, str, str], dict[str, Any]] = {} + for spread in spreads: + require(isinstance(spread, dict), "INVALID_SEED_SPREAD") + key = (spread.get("intervention"), spread.get("split"), spread.get("metric")) + require(key[0] in INTERVENTIONS and key[1] in SPLITS and key[2] in METRICS + and key not in groups, "SEED_SPREAD_GROUP_DRIFT") + require(spread.get("training_seed_count") == 3 + and spread.get("uncertainty_qualified") is False, + "SEED_UNCERTAINTY_PROMOTED") + means = spread.get("seed_level_mean_delta_by_seed") + require(isinstance(means, dict) and set(means) == {str(x) for x in SEEDS}, + "SEED_MEMBERSHIP_DRIFT") + sample_sd = statistics.stdev(means.values()) + require(exact_float(sample_sd, spread.get("three_seed_sample_sd_of_overall_effects")), + "BETWEEN_SEED_SD_DRIFT") + examples = [] + for seed in SEEDS: + source = results[f"{INTERVENTIONS[key[0]]}_{seed}"] + require(source.get("intervention") == key[0] and source.get("seed") == seed, + "SOURCE_CONDITION_DRIFT") + cell = source["splits"][key[1]][key[2]] + icc_row = indexed[(key[0], key[1], key[2], seed)] + require(cell.get("task_count") == 3840 + and exact_float(cell.get("mean_delta_raw_orientation"), means[str(seed)]) + and exact_float(cell.get("mean_delta_raw_orientation"), icc_row.get("paired_delta_mean")), + "SEED_EFFECT_MISMATCH") + require(type(cell.get("paired_source_task_sample_sd")) is float + and math.isfinite(cell["paired_source_task_sample_sd"]) + and cell["paired_source_task_sample_sd"] >= 0, + "INVALID_PAIRED_SD") + examples.append({ + "seed": seed, + "paired_delta_mean_raw_metric_orientation": cell["mean_delta_raw_orientation"], + "paired_source_case_sample_sd": cell["paired_source_task_sample_sd"], + "calculator_anova_icc_unclipped": icc_row["anovamom_rho_unclipped"], + "negative_icc_sample_estimate": icc_row["anovamom_rho_unclipped"] < 0, + }) + require(exact_float(statistics.stdev([x["paired_delta_mean_raw_metric_orientation"] + for x in examples]), sample_sd), + "SEED_SPREAD_RECONSTRUCTION_MISMATCH") + groups[key] = { + "intervention": key[0], "split": key[1], "metric": key[2], + "training_seed_count": 3, + "seed_level_development_evidence": examples, + "descriptive_sd_of_three_seed_effect_means": sample_sd, + "paired_sd_min_across_three_seed_snapshots": min(x["paired_source_case_sample_sd"] for x in examples), + "paired_sd_max_across_three_seed_snapshots": max(x["paired_source_case_sample_sd"] for x in examples), + "negative_sample_icc_cells": sum(x["negative_icc_sample_estimate"] for x in examples), + "crossed_source_case_calculator_seed_nuisance_qualified": False, + } + require(len(groups) == 24, "GROUP_COVERAGE_DRIFT") + require(sum(x["negative_sample_icc_cells"] for x in groups.values()) == 12, + "NEGATIVE_ICC_ESTIMATES_ERASED") + return { + "schema": "commandmed.v5.descriptive-statistical-review-packet.v1", + "status": "SOURCE_BOUND_DESCRIPTIVE_REVIEW_PACKET_NOT_POWER", + "source_sha256": { + "development_paired_sd": bound.LOCKED_SOURCES["sd_inventory"][1], + "development_calculator_icc": bound.LOCKED_SOURCES["icc_inventory"][1], + }, + "source_cases_per_development_split": 3840, + "calculators_per_development_split": 64, + "cases_per_calculator": 60, + "planned_confirmatory_source_cases_unmaterialized": 4096, + "seed_ids": list(SEEDS), + "descriptive_condition_seed_metric_split_cells": 72, + "descriptive_intervention_metric_split_groups": 24, + "observed_negative_unclipped_icc_estimates": 12, + "groups": [groups[key] for key in sorted(groups)], + "prospective_primary_non_target_hypothesis_family": None, + "primary_non_target_family_size": None, + "source_case_calculator_seed_crossed_covariance_model": None, + "confirmatory_90_percent_power_qualified": False, + "confirmatory_authorized": False, + "independent_statistical_review_completed": False, + "publication_or_clinical_authorized": False, + "review_decisions_required": [ + "Declare full non-target Holm family before estimating final power", + "Choose conditional-on-selected-calculators versus transport estimand", + "Prespecify crossed source-case/calculator/training-seed dependence and missingness", + "Prespecify per-cell orientation, native-unit margins, coupling and fixed-policy rules", + "Verify each-primary-effect 90% power at actual family size or apply power-failure rule", + "Obtain independent statistical/code/provenance review and founder execution authority", + ], + } + + +def main() -> int: + parser = argparse.ArgumentParser() + group = parser.add_mutually_exclusive_group(required=True) + group.add_argument("--output", type=Path) + group.add_argument("--verify", type=Path) + args = parser.parse_args() + # Read immutable evidence and all 307 original scientific bindings first. + bound.audit() + source = json.loads((bound.ROOT / bound.LOCKED_SOURCES["sd_inventory"][0]).read_text()) + icc = json.loads((bound.ROOT / bound.LOCKED_SOURCES["icc_inventory"][0]).read_text()) + payload = json.dumps(create_packet(source, icc), sort_keys=True, indent=2, allow_nan=False) + "\n" + if args.verify is not None: + require(args.verify.is_file() and args.verify.read_bytes() == payload.encode("utf-8"), + "COMMITTED_REVIEW_PACKET_REPLAY_DRIFT") + else: + args.output.parent.mkdir(parents=True, exist_ok=True) + with args.output.open("x", encoding="utf-8", newline="\n") as f: + f.write(payload) + print(json.dumps({"status": "PASS_SOURCE_BOUND_DESCRIPTIVE_REVIEW_PACKET_REPLAY", + "groups": 24, "cells": 72, "statistical_power_qualified": False}, + sort_keys=True)) + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/tests/reliability_v5/test_statistical_review_packet.py b/tests/reliability_v5/test_statistical_review_packet.py new file mode 100644 index 00000000..eb577278 --- /dev/null +++ b/tests/reliability_v5/test_statistical_review_packet.py @@ -0,0 +1,97 @@ +"""Model-free, nonselective bridge across pinned descriptive nuisance diagnostics.""" +from __future__ import annotations + +import copy +import json +import subprocess +import sys +from pathlib import Path + +import pytest + +sys.path.insert(0, str(Path(__file__).resolve().parents[2] / "scripts")) +import v5_manuscript_development_evidence_audit as source_audit +import v5_s1_statistical_review_packet as packet + + +def originals(): + sd = json.loads((source_audit.ROOT / source_audit.LOCKED_SOURCES["sd_inventory"][0]).read_text()) + icc = json.loads((source_audit.ROOT / source_audit.LOCKED_SOURCES["icc_inventory"][0]).read_text()) + return sd, icc + + +def test_real_24_group_72_cell_unqualified_review_packet() -> None: + assert source_audit.audit()["frozen_source_files_verified"] == 307 + sd, icc = originals() + x = packet.create_packet(sd, icc) + assert x["descriptive_intervention_metric_split_groups"] == len(x["groups"]) == 24 + assert x["descriptive_condition_seed_metric_split_cells"] == 72 + assert sum(g["negative_sample_icc_cells"] for g in x["groups"]) == 12 + assert {tuple((g["intervention"],g["split"],g["metric"])) for g in x["groups"]} == { + (name, split, metric) for name in packet.INTERVENTIONS + for split in packet.SPLITS for metric in packet.METRICS + } + for g in x["groups"]: + assert [e["seed"] for e in g["seed_level_development_evidence"]] == [11,29,47] + assert g["crossed_source_case_calculator_seed_nuisance_qualified"] is False + assert x["primary_non_target_family_size"] is None + assert x["prospective_primary_non_target_hypothesis_family"] is None + assert x["source_case_calculator_seed_crossed_covariance_model"] is None + assert x["confirmatory_90_percent_power_qualified"] is False + assert x["confirmatory_authorized"] is False + assert x["independent_statistical_review_completed"] is False + assert x["publication_or_clinical_authorized"] is False + + +def test_saved_packet_is_exact_fresh_deterministic_replay(tmp_path: Path) -> None: + committed = source_audit.ROOT / ( + "artifacts/v5/development/s1-statistical-review-packet-2026-10-10/reviewer-packet.json" + ) + saved = committed.read_bytes() + assert saved == (json.dumps(packet.create_packet(*originals()), + sort_keys=True, indent=2, allow_nan=False) + "\n").encode() + cmd = [sys.executable, str(source_audit.ROOT / "scripts/v5_s1_statistical_review_packet.py")] + verified = subprocess.run(cmd + ["--verify", str(committed)], cwd=tmp_path, + capture_output=True, text=True) + assert verified.returncode == 0, verified.stderr + fresh = tmp_path / "fresh-review-packet.json" + created = subprocess.run(cmd + ["--output", str(fresh)], cwd=tmp_path, + capture_output=True, text=True) + assert created.returncode == 0, created.stderr + assert fresh.read_bytes() == saved + second = subprocess.run(cmd + ["--output", str(fresh)], cwd=tmp_path, + capture_output=True, text=True) + assert second.returncode != 0 + assert fresh.read_bytes() == saved + falsified = tmp_path / "falsified.json" + falsified.write_bytes(saved + b"\n") + mismatch = subprocess.run(cmd + ["--verify", str(falsified)], cwd=tmp_path, + capture_output=True, text=True) + assert mismatch.returncode != 0 + assert "COMMITTED_REVIEW_PACKET_REPLAY_DRIFT" in mismatch.stderr + assert falsified.read_bytes() == saved + b"\n" + + +@pytest.mark.parametrize("mutate,expected", [ + (lambda sd,icc: sd.update(primary_non_target_family_size=1), "SOURCE_SD_SCIENCE_AUTHORITY_DRIFT"), + (lambda sd,icc: icc["boundaries"].update(final_90_percent_power_qualified=True), + "ICC_SCIENCE_AUTHORITY_DRIFT"), + (lambda sd,icc: icc["all_development_cells"][0].update(seed=29,condition="B1_29"), "DUPLICATE_OR_UNKNOWN_ICC_CELL"), + (lambda sd,icc: icc["all_development_cells"][0].update(calculator_count=63), + "SOURCE_CASE_OR_CONDITION_DRIFT"), + (lambda sd,icc: icc["all_development_cells"][0].update(anovamom_rho_unclipped=0.2), + "ICC_SIGN_STATUS_DRIFT"), + (lambda sd,icc: icc["three_seed_between_effect_spreads"][0].update(uncertainty_qualified=True), + "SEED_UNCERTAINTY_PROMOTED"), + (lambda sd,icc: icc["three_seed_between_effect_spreads"][0]["seed_level_mean_delta_by_seed"].update({"29":0.0005}), + "BETWEEN_SEED_SD_DRIFT"), + (lambda sd,icc: sd["intervention_results"]["B1_11"]["splits"]["S1_CAL_EVAL"]["canonical_accuracy"].update(mean_delta_raw_orientation=0.03), + "SEED_EFFECT_MISMATCH"), + (lambda sd,icc: sd["intervention_results"]["B1_11"]["splits"]["S1_CAL_EVAL"]["canonical_accuracy"].update(paired_source_task_sample_sd=-0.1), + "INVALID_PAIRED_SD"), +]) +def test_fail_closed_on_missing_science_provenance_or_seed_alignment(mutate,expected) -> None: + sd,icc=originals() + mutate(sd,icc) + with pytest.raises(packet.ReviewerPacketError,match=expected): + packet.create_packet(sd,icc) From 534120efd04482c4bbd4f73d1add2fc0f624ed0b Mon Sep 17 00:00:00 2001 From: Gocceri Date: Sat, 10 Oct 2026 22:44:42 +0300 Subject: [PATCH 10/12] research(v5): independently reconstruct 72 ANOVA nuisance cells Cross-check all original ICC moments and paired source-case sample SDs algebraically, including the negative finite-sample ICC estimates. Add fail-closed corruption tests and documentation; preserve source-bound packet bytes, original 307 frozen sources and every unapproved statistical authority flag. Signed-off-by: Gocceri --- ...VE_STATISTICAL_REVIEW_PACKET_2026-10-10.md | 2 +- scripts/v5_s1_statistical_review_packet.py | 19 +++++++++++++++++++ .../test_statistical_review_packet.py | 12 +++++++++++- 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/docs/research/paper-rebuild-v2-2026-10-02/V5_S1_DESCRIPTIVE_STATISTICAL_REVIEW_PACKET_2026-10-10.md b/docs/research/paper-rebuild-v2-2026-10-02/V5_S1_DESCRIPTIVE_STATISTICAL_REVIEW_PACKET_2026-10-10.md index da2ee34e..28585346 100644 --- a/docs/research/paper-rebuild-v2-2026-10-02/V5_S1_DESCRIPTIVE_STATISTICAL_REVIEW_PACKET_2026-10-10.md +++ b/docs/research/paper-rebuild-v2-2026-10-02/V5_S1_DESCRIPTIVE_STATISTICAL_REVIEW_PACKET_2026-10-10.md @@ -10,7 +10,7 @@ This is an audit-ready model-free bridge between the 72 original paired source-c - Original development calculator ICC source: `artifacts/v5/development/s1-calculator-icc-inventory-2026-10-10/development-calculator-icc.json` (SHA-256 `37d64c0f6ac14d04cc6420a020e7bb7997fb333e50729f33798b2d403d292370`). - Deterministic composite output: `artifacts/v5/development/s1-statistical-review-packet-2026-10-10/reviewer-packet.json` (new additive development-only file, not among the immutable 307). SHA-256: `86a275cb5cd7760f421538df34fea8b6dc452a19d095ddc4f4c6f0e69a87e348`. - Generator: `scripts/v5_s1_statistical_review_packet.py`; no model weights, network, GPU, PHI, new source-case IDs, or external API calls. From the repository root, run `python3 scripts/v5_s1_statistical_review_packet.py --verify artifacts/v5/development/s1-statistical-review-packet-2026-10-10/reviewer-packet.json`. `--output` writes **only to a previously nonexistent path**; `--verify` never modifies it. -- The generator first executes the full source-bound audit: all 307 frozen entries and 9 locked development sources must have their original hashes. It rejects mismatched source mean effects across independently stored SD and ICC descriptions, missing/duplicate cells, changed seed membership, erased negative ICCs, forged review status, and mismatched three-seed descriptive sample SDs. GitHub CI reruns the audit, generator replay, and mutation tests on the exact PR head. +- The generator first executes the full source-bound audit: all 307 frozen entries and 9 locked development sources must have their original hashes. It rejects mismatched source mean effects across independently stored SD and ICC descriptions, missing/duplicate cells, changed seed membership, erased negative ICCs, forged review status, and mismatched three-seed descriptive sample SDs. In addition, it independently reconstructs each of 72 within-source-case sample SDs from its original calculator ANOVA mean-square components, using `sqrt(((K-1)*MS_B+K*(m-1)*MS_W)/(K*m-1))` with `K=64,m=60`; it recomputes the corresponding **unclipped** method-of-moments ICC before accepting the stored values. These are algebraic integrity checks, **not** proof of a statistically valid dependence model. GitHub CI reruns the audit, generator replay, and mutation tests on the exact PR head. ## What reviewers can now inspect (not an inferential result) diff --git a/scripts/v5_s1_statistical_review_packet.py b/scripts/v5_s1_statistical_review_packet.py index 480bb579..4ca07de3 100644 --- a/scripts/v5_s1_statistical_review_packet.py +++ b/scripts/v5_s1_statistical_review_packet.py @@ -64,8 +64,18 @@ def create_packet(sd: dict[str, Any], icc: dict[str, Any]) -> dict[str, Any]: and row.get("calculator_count") == 64 and row.get("source_cases_per_calculator") == 60, "SOURCE_CASE_OR_CONDITION_DRIFT") + # Recalculate the ANOVA moment ICC independently of the saved rho + # field; retaining negative sampling estimates is intentional. + between_ms, within_ms = row.get("between_calculator_ms"), row.get("within_calculator_ms") + require(type(between_ms) is float and math.isfinite(between_ms) and between_ms >= 0 + and type(within_ms) is float and math.isfinite(within_ms) and within_ms >= 0, + "INVALID_ANOVA_COMPONENTS") + denominator = between_ms + (60 - 1) * within_ms + require(math.isfinite(denominator) and denominator > 0, "INVALID_ANOVA_COMPONENTS") rho = row.get("anovamom_rho_unclipped") require(type(rho) is float and math.isfinite(rho), "INVALID_ICC_VALUE") + require(exact_float((between_ms - within_ms) / denominator, rho), + "ICC_MOMENT_RECONSTRUCTION_DRIFT") require(row.get("rho_status") == ( "NEGATIVE_FINITE_SAMPLE_ESTIMATE" if rho < 0 else "DESCRIPTIVE_NONNEGATIVE_ESTIMATE"), "ICC_SIGN_STATUS_DRIFT") @@ -103,6 +113,15 @@ def create_packet(sd: dict[str, Any], icc: dict[str, Any]) -> dict[str, Any]: and math.isfinite(cell["paired_source_task_sample_sd"]) and cell["paired_source_task_sample_sd"] >= 0, "INVALID_PAIRED_SD") + # Independent sample-SD reconstruction from the original K=64, + # m=60 ANOVA mean-square components; source cases remain the unit. + between_ms = icc_row["between_calculator_ms"] + within_ms = icc_row["within_calculator_ms"] + sample_variance = ((64 - 1) * between_ms + 64 * (60 - 1) * within_ms) / (3840 - 1) + require(math.isfinite(sample_variance) and sample_variance >= 0 + and exact_float(math.sqrt(sample_variance), + cell["paired_source_task_sample_sd"]), + "ANOVA_SOURCE_CASE_SD_RECONSTRUCTION_DRIFT") examples.append({ "seed": seed, "paired_delta_mean_raw_metric_orientation": cell["mean_delta_raw_orientation"], diff --git a/tests/reliability_v5/test_statistical_review_packet.py b/tests/reliability_v5/test_statistical_review_packet.py index eb577278..0dd3fe5a 100644 --- a/tests/reliability_v5/test_statistical_review_packet.py +++ b/tests/reliability_v5/test_statistical_review_packet.py @@ -79,7 +79,7 @@ def test_saved_packet_is_exact_fresh_deterministic_replay(tmp_path: Path) -> Non (lambda sd,icc: icc["all_development_cells"][0].update(seed=29,condition="B1_29"), "DUPLICATE_OR_UNKNOWN_ICC_CELL"), (lambda sd,icc: icc["all_development_cells"][0].update(calculator_count=63), "SOURCE_CASE_OR_CONDITION_DRIFT"), - (lambda sd,icc: icc["all_development_cells"][0].update(anovamom_rho_unclipped=0.2), + (lambda sd,icc: icc["all_development_cells"][0].update(rho_status="DESCRIPTIVE_NONNEGATIVE_ESTIMATE"), "ICC_SIGN_STATUS_DRIFT"), (lambda sd,icc: icc["three_seed_between_effect_spreads"][0].update(uncertainty_qualified=True), "SEED_UNCERTAINTY_PROMOTED"), @@ -89,6 +89,16 @@ def test_saved_packet_is_exact_fresh_deterministic_replay(tmp_path: Path) -> Non "SEED_EFFECT_MISMATCH"), (lambda sd,icc: sd["intervention_results"]["B1_11"]["splits"]["S1_CAL_EVAL"]["canonical_accuracy"].update(paired_source_task_sample_sd=-0.1), "INVALID_PAIRED_SD"), + (lambda sd,icc: icc["all_development_cells"][0].update(between_calculator_ms=float("nan")), + "INVALID_ANOVA_COMPONENTS"), + (lambda sd,icc: icc["all_development_cells"][0].update(within_calculator_ms=0.0), + "ICC_MOMENT_RECONSTRUCTION_DRIFT"), + (lambda sd,icc: icc["all_development_cells"][0].update( + between_calculator_ms=icc["all_development_cells"][0]["between_calculator_ms"] * 2, + within_calculator_ms=icc["all_development_cells"][0]["within_calculator_ms"] * 2), + "ANOVA_SOURCE_CASE_SD_RECONSTRUCTION_DRIFT"), + (lambda sd,icc: sd["intervention_results"]["B1_11"]["splits"]["S1_CAL_EVAL"]["canonical_accuracy"].update(paired_source_task_sample_sd=0.5), + "ANOVA_SOURCE_CASE_SD_RECONSTRUCTION_DRIFT"), ]) def test_fail_closed_on_missing_science_provenance_or_seed_alignment(mutate,expected) -> None: sd,icc=originals() From 6fdc33c77fa072e47efb056bf505a75dc005bd45 Mon Sep 17 00:00:00 2001 From: Gocceri Date: Sun, 11 Oct 2026 21:52:42 +0300 Subject: [PATCH 11/12] research(v5): enumerate undecided 56-slot reviewer candidate coverage Bind seven original preregistered intervention candidates to eight frozen draft assurance axes for exhaustive independent nomination review, explicitly without creating a 56-test Holm family or false power authority. Include 307-source audit, deterministic evidence, fail-closed tests and exact-head CI replay. Signed-off-by: Gocceri --- ...uscript-development-evidence-integrity.yml | 22 +- .../candidate-coverage.json | 1069 +++++++++++++++++ ...ON_TARGET_CANDIDATE_COVERAGE_2026-10-11.md | 15 + scripts/v5_holm_family_coverage_inventory.py | 136 +++ .../test_holm_candidate_coverage_inventory.py | 94 ++ 5 files changed, 1334 insertions(+), 2 deletions(-) create mode 100644 artifacts/v5/development/s1-holm-coverage-2026-10-11/candidate-coverage.json create mode 100644 docs/research/paper-rebuild-v2-2026-10-02/V5_PRIMARY_NON_TARGET_CANDIDATE_COVERAGE_2026-10-11.md create mode 100644 scripts/v5_holm_family_coverage_inventory.py create mode 100644 tests/reliability_v5/test_holm_candidate_coverage_inventory.py diff --git a/.github/workflows/v5-manuscript-development-evidence-integrity.yml b/.github/workflows/v5-manuscript-development-evidence-integrity.yml index 77cf7c9c..b6e9d660 100644 --- a/.github/workflows/v5-manuscript-development-evidence-integrity.yml +++ b/.github/workflows/v5-manuscript-development-evidence-integrity.yml @@ -8,6 +8,9 @@ on: - ".github/workflows/v5-manuscript-development-evidence-integrity.yml" - "scripts/v5_manuscript_development_evidence_audit.py" - "scripts/v5_s1_statistical_review_packet.py" + - "scripts/v5_holm_family_coverage_inventory.py" + - "tests/reliability_v5/test_holm_candidate_coverage_inventory.py" + - "docs/research/paper-rebuild-v2-2026-10-02/V5_PRIMARY_NON_TARGET_CANDIDATE_COVERAGE_2026-10-11.md" - "tests/reliability_v5/test_statistical_review_packet.py" - "docs/research/paper-rebuild-v2-2026-10-02/V5_S1_DESCRIPTIVE_STATISTICAL_REVIEW_PACKET_2026-10-10.md" - "scripts/v5_s1_source_case_pairing_audit.py" @@ -63,13 +66,16 @@ jobs: python3 -m compileall -q \ scripts/v5_manuscript_development_evidence_audit.py \ scripts/v5_s1_statistical_review_packet.py \ + scripts/v5_holm_family_coverage_inventory.py \ + tests/reliability_v5/test_holm_candidate_coverage_inventory.py \ tests/reliability_v5/test_statistical_review_packet.py \ scripts/v5_s1_source_case_pairing_audit.py \ scripts/v5_s1_development_calculator_icc_inventory.py \ tests/reliability_v5/test_manuscript_development_evidence_audit.py \ tests/reliability_v5/test_source_case_pairing_audit.py \ tests/reliability_v5/test_development_calculator_icc_inventory.py \ - tests/reliability_v5/test_statistical_review_packet.py + tests/reliability_v5/test_statistical_review_packet.py \ + tests/reliability_v5/test_holm_candidate_coverage_inventory.py - name: Reverify source hashes, R1 and R2 archives, and 307 frozen files shell: bash @@ -146,6 +152,17 @@ jobs: cmp artifacts/v5/development/s1-statistical-review-packet-2026-10-10/reviewer-packet.json \ "$RUNNER_TEMP/v5-statistical-review-packet-replay.json" + - name: Replay complete reviewer candidate coverage without claiming Holm family + shell: bash + run: | + set -euo pipefail + python3 scripts/v5_holm_family_coverage_inventory.py --verify \ + artifacts/v5/development/s1-holm-coverage-2026-10-11/candidate-coverage.json + python3 scripts/v5_holm_family_coverage_inventory.py --output \ + "$RUNNER_TEMP/v5-complete-candidate-coverage.json" + cmp artifacts/v5/development/s1-holm-coverage-2026-10-11/candidate-coverage.json \ + "$RUNNER_TEMP/v5-complete-candidate-coverage.json" + - name: Fail-closed regression tests shell: bash env: @@ -156,4 +173,5 @@ jobs: tests/reliability_v5/test_manuscript_development_evidence_audit.py \ tests/reliability_v5/test_source_case_pairing_audit.py \ tests/reliability_v5/test_development_calculator_icc_inventory.py \ - tests/reliability_v5/test_statistical_review_packet.py + tests/reliability_v5/test_statistical_review_packet.py \ + tests/reliability_v5/test_holm_candidate_coverage_inventory.py diff --git a/artifacts/v5/development/s1-holm-coverage-2026-10-11/candidate-coverage.json b/artifacts/v5/development/s1-holm-coverage-2026-10-11/candidate-coverage.json new file mode 100644 index 00000000..915b6d0d --- /dev/null +++ b/artifacts/v5/development/s1-holm-coverage-2026-10-11/candidate-coverage.json @@ -0,0 +1,1069 @@ +{ + "actual_primary_non_target_holm_family_size": null, + "candidate_assurance_axis_count": 8, + "candidate_intervention_count": 7, + "candidate_slots": [ + { + "applicability_to_this_task_family": null, + "candidate_assurance_axis": "P1_CANONICAL_DECISION", + "candidate_intervention": "A1_TS_V1", + "coupling_classification": null, + "development_records_prove_family_membership": false, + "development_training_seeds_with_descriptive_records": [], + "eligible_effect_margin_prospectively_qualified": null, + "exclusion_or_inclusion_rationale": null, + "fixed_policy_setting": null, + "hard_gate_measurement_metric_and_unit": null, + "intervention_target_axis_independently_reviewed": null, + "native_metric_better_direction": null, + "nomination_is_primary_non_target": null, + "review_disposition": "UNDETERMINED", + "source_population_and_split": null + }, + { + "applicability_to_this_task_family": null, + "candidate_assurance_axis": "P2_CALIBRATION", + "candidate_intervention": "A1_TS_V1", + "coupling_classification": null, + "development_records_prove_family_membership": false, + "development_training_seeds_with_descriptive_records": [], + "eligible_effect_margin_prospectively_qualified": null, + "exclusion_or_inclusion_rationale": null, + "fixed_policy_setting": null, + "hard_gate_measurement_metric_and_unit": null, + "intervention_target_axis_independently_reviewed": null, + "native_metric_better_direction": null, + "nomination_is_primary_non_target": null, + "review_disposition": "UNDETERMINED", + "source_population_and_split": null + }, + { + "applicability_to_this_task_family": null, + "candidate_assurance_axis": "P3_COHERENCE", + "candidate_intervention": "A1_TS_V1", + "coupling_classification": null, + "development_records_prove_family_membership": false, + "development_training_seeds_with_descriptive_records": [], + "eligible_effect_margin_prospectively_qualified": null, + "exclusion_or_inclusion_rationale": null, + "fixed_policy_setting": null, + "hard_gate_measurement_metric_and_unit": null, + "intervention_target_axis_independently_reviewed": null, + "native_metric_better_direction": null, + "nomination_is_primary_non_target": null, + "review_disposition": "UNDETERMINED", + "source_population_and_split": null + }, + { + "applicability_to_this_task_family": null, + "candidate_assurance_axis": "P4_SEMANTIC_STABILITY", + "candidate_intervention": "A1_TS_V1", + "coupling_classification": null, + "development_records_prove_family_membership": false, + "development_training_seeds_with_descriptive_records": [], + "eligible_effect_margin_prospectively_qualified": null, + "exclusion_or_inclusion_rationale": null, + "fixed_policy_setting": null, + "hard_gate_measurement_metric_and_unit": null, + "intervention_target_axis_independently_reviewed": null, + "native_metric_better_direction": null, + "nomination_is_primary_non_target": null, + "review_disposition": "UNDETERMINED", + "source_population_and_split": null + }, + { + "applicability_to_this_task_family": null, + "candidate_assurance_axis": "P5_EVIDENCE_RESPONSIVENESS", + "candidate_intervention": "A1_TS_V1", + "coupling_classification": null, + "development_records_prove_family_membership": false, + "development_training_seeds_with_descriptive_records": [], + "eligible_effect_margin_prospectively_qualified": null, + "exclusion_or_inclusion_rationale": null, + "fixed_policy_setting": null, + "hard_gate_measurement_metric_and_unit": null, + "intervention_target_axis_independently_reviewed": null, + "native_metric_better_direction": null, + "nomination_is_primary_non_target": null, + "review_disposition": "UNDETERMINED", + "source_population_and_split": null + }, + { + "applicability_to_this_task_family": null, + "candidate_assurance_axis": "P6_RULE_CONFORMANCE", + "candidate_intervention": "A1_TS_V1", + "coupling_classification": null, + "development_records_prove_family_membership": false, + "development_training_seeds_with_descriptive_records": [], + "eligible_effect_margin_prospectively_qualified": null, + "exclusion_or_inclusion_rationale": null, + "fixed_policy_setting": null, + "hard_gate_measurement_metric_and_unit": null, + "intervention_target_axis_independently_reviewed": null, + "native_metric_better_direction": null, + "nomination_is_primary_non_target": null, + "review_disposition": "UNDETERMINED", + "source_population_and_split": null + }, + { + "applicability_to_this_task_family": null, + "candidate_assurance_axis": "P7_SELECTIVE_CONTROL", + "candidate_intervention": "A1_TS_V1", + "coupling_classification": null, + "development_records_prove_family_membership": false, + "development_training_seeds_with_descriptive_records": [], + "eligible_effect_margin_prospectively_qualified": null, + "exclusion_or_inclusion_rationale": null, + "fixed_policy_setting": null, + "hard_gate_measurement_metric_and_unit": null, + "intervention_target_axis_independently_reviewed": null, + "native_metric_better_direction": null, + "nomination_is_primary_non_target": null, + "review_disposition": "UNDETERMINED", + "source_population_and_split": null + }, + { + "applicability_to_this_task_family": null, + "candidate_assurance_axis": "P8_CAPABILITY_RETENTION", + "candidate_intervention": "A1_TS_V1", + "coupling_classification": null, + "development_records_prove_family_membership": false, + "development_training_seeds_with_descriptive_records": [], + "eligible_effect_margin_prospectively_qualified": null, + "exclusion_or_inclusion_rationale": null, + "fixed_policy_setting": null, + "hard_gate_measurement_metric_and_unit": null, + "intervention_target_axis_independently_reviewed": null, + "native_metric_better_direction": null, + "nomination_is_primary_non_target": null, + "review_disposition": "UNDETERMINED", + "source_population_and_split": null + }, + { + "applicability_to_this_task_family": null, + "candidate_assurance_axis": "P1_CANONICAL_DECISION", + "candidate_intervention": "A2_SELBIAS_V1", + "coupling_classification": null, + "development_records_prove_family_membership": false, + "development_training_seeds_with_descriptive_records": [], + "eligible_effect_margin_prospectively_qualified": null, + "exclusion_or_inclusion_rationale": null, + "fixed_policy_setting": null, + "hard_gate_measurement_metric_and_unit": null, + "intervention_target_axis_independently_reviewed": null, + "native_metric_better_direction": null, + "nomination_is_primary_non_target": null, + "review_disposition": "UNDETERMINED", + "source_population_and_split": null + }, + { + "applicability_to_this_task_family": null, + "candidate_assurance_axis": "P2_CALIBRATION", + "candidate_intervention": "A2_SELBIAS_V1", + "coupling_classification": null, + "development_records_prove_family_membership": false, + "development_training_seeds_with_descriptive_records": [], + "eligible_effect_margin_prospectively_qualified": null, + "exclusion_or_inclusion_rationale": null, + "fixed_policy_setting": null, + "hard_gate_measurement_metric_and_unit": null, + "intervention_target_axis_independently_reviewed": null, + "native_metric_better_direction": null, + "nomination_is_primary_non_target": null, + "review_disposition": "UNDETERMINED", + "source_population_and_split": null + }, + { + "applicability_to_this_task_family": null, + "candidate_assurance_axis": "P3_COHERENCE", + "candidate_intervention": "A2_SELBIAS_V1", + "coupling_classification": null, + "development_records_prove_family_membership": false, + "development_training_seeds_with_descriptive_records": [], + "eligible_effect_margin_prospectively_qualified": null, + "exclusion_or_inclusion_rationale": null, + "fixed_policy_setting": null, + "hard_gate_measurement_metric_and_unit": null, + "intervention_target_axis_independently_reviewed": null, + "native_metric_better_direction": null, + "nomination_is_primary_non_target": null, + "review_disposition": "UNDETERMINED", + "source_population_and_split": null + }, + { + "applicability_to_this_task_family": null, + "candidate_assurance_axis": "P4_SEMANTIC_STABILITY", + "candidate_intervention": "A2_SELBIAS_V1", + "coupling_classification": null, + "development_records_prove_family_membership": false, + "development_training_seeds_with_descriptive_records": [], + "eligible_effect_margin_prospectively_qualified": null, + "exclusion_or_inclusion_rationale": null, + "fixed_policy_setting": null, + "hard_gate_measurement_metric_and_unit": null, + "intervention_target_axis_independently_reviewed": null, + "native_metric_better_direction": null, + "nomination_is_primary_non_target": null, + "review_disposition": "UNDETERMINED", + "source_population_and_split": null + }, + { + "applicability_to_this_task_family": null, + "candidate_assurance_axis": "P5_EVIDENCE_RESPONSIVENESS", + "candidate_intervention": "A2_SELBIAS_V1", + "coupling_classification": null, + "development_records_prove_family_membership": false, + "development_training_seeds_with_descriptive_records": [], + "eligible_effect_margin_prospectively_qualified": null, + "exclusion_or_inclusion_rationale": null, + "fixed_policy_setting": null, + "hard_gate_measurement_metric_and_unit": null, + "intervention_target_axis_independently_reviewed": null, + "native_metric_better_direction": null, + "nomination_is_primary_non_target": null, + "review_disposition": "UNDETERMINED", + "source_population_and_split": null + }, + { + "applicability_to_this_task_family": null, + "candidate_assurance_axis": "P6_RULE_CONFORMANCE", + "candidate_intervention": "A2_SELBIAS_V1", + "coupling_classification": null, + "development_records_prove_family_membership": false, + "development_training_seeds_with_descriptive_records": [], + "eligible_effect_margin_prospectively_qualified": null, + "exclusion_or_inclusion_rationale": null, + "fixed_policy_setting": null, + "hard_gate_measurement_metric_and_unit": null, + "intervention_target_axis_independently_reviewed": null, + "native_metric_better_direction": null, + "nomination_is_primary_non_target": null, + "review_disposition": "UNDETERMINED", + "source_population_and_split": null + }, + { + "applicability_to_this_task_family": null, + "candidate_assurance_axis": "P7_SELECTIVE_CONTROL", + "candidate_intervention": "A2_SELBIAS_V1", + "coupling_classification": null, + "development_records_prove_family_membership": false, + "development_training_seeds_with_descriptive_records": [], + "eligible_effect_margin_prospectively_qualified": null, + "exclusion_or_inclusion_rationale": null, + "fixed_policy_setting": null, + "hard_gate_measurement_metric_and_unit": null, + "intervention_target_axis_independently_reviewed": null, + "native_metric_better_direction": null, + "nomination_is_primary_non_target": null, + "review_disposition": "UNDETERMINED", + "source_population_and_split": null + }, + { + "applicability_to_this_task_family": null, + "candidate_assurance_axis": "P8_CAPABILITY_RETENTION", + "candidate_intervention": "A2_SELBIAS_V1", + "coupling_classification": null, + "development_records_prove_family_membership": false, + "development_training_seeds_with_descriptive_records": [], + "eligible_effect_margin_prospectively_qualified": null, + "exclusion_or_inclusion_rationale": null, + "fixed_policy_setting": null, + "hard_gate_measurement_metric_and_unit": null, + "intervention_target_axis_independently_reviewed": null, + "native_metric_better_direction": null, + "nomination_is_primary_non_target": null, + "review_disposition": "UNDETERMINED", + "source_population_and_split": null + }, + { + "applicability_to_this_task_family": null, + "candidate_assurance_axis": "P1_CANONICAL_DECISION", + "candidate_intervention": "B1_TYPED_V1", + "coupling_classification": null, + "development_records_prove_family_membership": false, + "development_training_seeds_with_descriptive_records": [ + 11, + 29, + 47 + ], + "eligible_effect_margin_prospectively_qualified": null, + "exclusion_or_inclusion_rationale": null, + "fixed_policy_setting": null, + "hard_gate_measurement_metric_and_unit": null, + "intervention_target_axis_independently_reviewed": null, + "native_metric_better_direction": null, + "nomination_is_primary_non_target": null, + "review_disposition": "UNDETERMINED", + "source_population_and_split": null + }, + { + "applicability_to_this_task_family": null, + "candidate_assurance_axis": "P2_CALIBRATION", + "candidate_intervention": "B1_TYPED_V1", + "coupling_classification": null, + "development_records_prove_family_membership": false, + "development_training_seeds_with_descriptive_records": [ + 11, + 29, + 47 + ], + "eligible_effect_margin_prospectively_qualified": null, + "exclusion_or_inclusion_rationale": null, + "fixed_policy_setting": null, + "hard_gate_measurement_metric_and_unit": null, + "intervention_target_axis_independently_reviewed": null, + "native_metric_better_direction": null, + "nomination_is_primary_non_target": null, + "review_disposition": "UNDETERMINED", + "source_population_and_split": null + }, + { + "applicability_to_this_task_family": null, + "candidate_assurance_axis": "P3_COHERENCE", + "candidate_intervention": "B1_TYPED_V1", + "coupling_classification": null, + "development_records_prove_family_membership": false, + "development_training_seeds_with_descriptive_records": [ + 11, + 29, + 47 + ], + "eligible_effect_margin_prospectively_qualified": null, + "exclusion_or_inclusion_rationale": null, + "fixed_policy_setting": null, + "hard_gate_measurement_metric_and_unit": null, + "intervention_target_axis_independently_reviewed": null, + "native_metric_better_direction": null, + "nomination_is_primary_non_target": null, + "review_disposition": "UNDETERMINED", + "source_population_and_split": null + }, + { + "applicability_to_this_task_family": null, + "candidate_assurance_axis": "P4_SEMANTIC_STABILITY", + "candidate_intervention": "B1_TYPED_V1", + "coupling_classification": null, + "development_records_prove_family_membership": false, + "development_training_seeds_with_descriptive_records": [ + 11, + 29, + 47 + ], + "eligible_effect_margin_prospectively_qualified": null, + "exclusion_or_inclusion_rationale": null, + "fixed_policy_setting": null, + "hard_gate_measurement_metric_and_unit": null, + "intervention_target_axis_independently_reviewed": null, + "native_metric_better_direction": null, + "nomination_is_primary_non_target": null, + "review_disposition": "UNDETERMINED", + "source_population_and_split": null + }, + { + "applicability_to_this_task_family": null, + "candidate_assurance_axis": "P5_EVIDENCE_RESPONSIVENESS", + "candidate_intervention": "B1_TYPED_V1", + "coupling_classification": null, + "development_records_prove_family_membership": false, + "development_training_seeds_with_descriptive_records": [ + 11, + 29, + 47 + ], + "eligible_effect_margin_prospectively_qualified": null, + "exclusion_or_inclusion_rationale": null, + "fixed_policy_setting": null, + "hard_gate_measurement_metric_and_unit": null, + "intervention_target_axis_independently_reviewed": null, + "native_metric_better_direction": null, + "nomination_is_primary_non_target": null, + "review_disposition": "UNDETERMINED", + "source_population_and_split": null + }, + { + "applicability_to_this_task_family": null, + "candidate_assurance_axis": "P6_RULE_CONFORMANCE", + "candidate_intervention": "B1_TYPED_V1", + "coupling_classification": null, + "development_records_prove_family_membership": false, + "development_training_seeds_with_descriptive_records": [ + 11, + 29, + 47 + ], + "eligible_effect_margin_prospectively_qualified": null, + "exclusion_or_inclusion_rationale": null, + "fixed_policy_setting": null, + "hard_gate_measurement_metric_and_unit": null, + "intervention_target_axis_independently_reviewed": null, + "native_metric_better_direction": null, + "nomination_is_primary_non_target": null, + "review_disposition": "UNDETERMINED", + "source_population_and_split": null + }, + { + "applicability_to_this_task_family": null, + "candidate_assurance_axis": "P7_SELECTIVE_CONTROL", + "candidate_intervention": "B1_TYPED_V1", + "coupling_classification": null, + "development_records_prove_family_membership": false, + "development_training_seeds_with_descriptive_records": [ + 11, + 29, + 47 + ], + "eligible_effect_margin_prospectively_qualified": null, + "exclusion_or_inclusion_rationale": null, + "fixed_policy_setting": null, + "hard_gate_measurement_metric_and_unit": null, + "intervention_target_axis_independently_reviewed": null, + "native_metric_better_direction": null, + "nomination_is_primary_non_target": null, + "review_disposition": "UNDETERMINED", + "source_population_and_split": null + }, + { + "applicability_to_this_task_family": null, + "candidate_assurance_axis": "P8_CAPABILITY_RETENTION", + "candidate_intervention": "B1_TYPED_V1", + "coupling_classification": null, + "development_records_prove_family_membership": false, + "development_training_seeds_with_descriptive_records": [ + 11, + 29, + 47 + ], + "eligible_effect_margin_prospectively_qualified": null, + "exclusion_or_inclusion_rationale": null, + "fixed_policy_setting": null, + "hard_gate_measurement_metric_and_unit": null, + "intervention_target_axis_independently_reviewed": null, + "native_metric_better_direction": null, + "nomination_is_primary_non_target": null, + "review_disposition": "UNDETERMINED", + "source_population_and_split": null + }, + { + "applicability_to_this_task_family": null, + "candidate_assurance_axis": "P1_CANONICAL_DECISION", + "candidate_intervention": "C1_CRDI_V1", + "coupling_classification": null, + "development_records_prove_family_membership": false, + "development_training_seeds_with_descriptive_records": [ + 11, + 29, + 47 + ], + "eligible_effect_margin_prospectively_qualified": null, + "exclusion_or_inclusion_rationale": null, + "fixed_policy_setting": null, + "hard_gate_measurement_metric_and_unit": null, + "intervention_target_axis_independently_reviewed": null, + "native_metric_better_direction": null, + "nomination_is_primary_non_target": null, + "review_disposition": "UNDETERMINED", + "source_population_and_split": null + }, + { + "applicability_to_this_task_family": null, + "candidate_assurance_axis": "P2_CALIBRATION", + "candidate_intervention": "C1_CRDI_V1", + "coupling_classification": null, + "development_records_prove_family_membership": false, + "development_training_seeds_with_descriptive_records": [ + 11, + 29, + 47 + ], + "eligible_effect_margin_prospectively_qualified": null, + "exclusion_or_inclusion_rationale": null, + "fixed_policy_setting": null, + "hard_gate_measurement_metric_and_unit": null, + "intervention_target_axis_independently_reviewed": null, + "native_metric_better_direction": null, + "nomination_is_primary_non_target": null, + "review_disposition": "UNDETERMINED", + "source_population_and_split": null + }, + { + "applicability_to_this_task_family": null, + "candidate_assurance_axis": "P3_COHERENCE", + "candidate_intervention": "C1_CRDI_V1", + "coupling_classification": null, + "development_records_prove_family_membership": false, + "development_training_seeds_with_descriptive_records": [ + 11, + 29, + 47 + ], + "eligible_effect_margin_prospectively_qualified": null, + "exclusion_or_inclusion_rationale": null, + "fixed_policy_setting": null, + "hard_gate_measurement_metric_and_unit": null, + "intervention_target_axis_independently_reviewed": null, + "native_metric_better_direction": null, + "nomination_is_primary_non_target": null, + "review_disposition": "UNDETERMINED", + "source_population_and_split": null + }, + { + "applicability_to_this_task_family": null, + "candidate_assurance_axis": "P4_SEMANTIC_STABILITY", + "candidate_intervention": "C1_CRDI_V1", + "coupling_classification": null, + "development_records_prove_family_membership": false, + "development_training_seeds_with_descriptive_records": [ + 11, + 29, + 47 + ], + "eligible_effect_margin_prospectively_qualified": null, + "exclusion_or_inclusion_rationale": null, + "fixed_policy_setting": null, + "hard_gate_measurement_metric_and_unit": null, + "intervention_target_axis_independently_reviewed": null, + "native_metric_better_direction": null, + "nomination_is_primary_non_target": null, + "review_disposition": "UNDETERMINED", + "source_population_and_split": null + }, + { + "applicability_to_this_task_family": null, + "candidate_assurance_axis": "P5_EVIDENCE_RESPONSIVENESS", + "candidate_intervention": "C1_CRDI_V1", + "coupling_classification": null, + "development_records_prove_family_membership": false, + "development_training_seeds_with_descriptive_records": [ + 11, + 29, + 47 + ], + "eligible_effect_margin_prospectively_qualified": null, + "exclusion_or_inclusion_rationale": null, + "fixed_policy_setting": null, + "hard_gate_measurement_metric_and_unit": null, + "intervention_target_axis_independently_reviewed": null, + "native_metric_better_direction": null, + "nomination_is_primary_non_target": null, + "review_disposition": "UNDETERMINED", + "source_population_and_split": null + }, + { + "applicability_to_this_task_family": null, + "candidate_assurance_axis": "P6_RULE_CONFORMANCE", + "candidate_intervention": "C1_CRDI_V1", + "coupling_classification": null, + "development_records_prove_family_membership": false, + "development_training_seeds_with_descriptive_records": [ + 11, + 29, + 47 + ], + "eligible_effect_margin_prospectively_qualified": null, + "exclusion_or_inclusion_rationale": null, + "fixed_policy_setting": null, + "hard_gate_measurement_metric_and_unit": null, + "intervention_target_axis_independently_reviewed": null, + "native_metric_better_direction": null, + "nomination_is_primary_non_target": null, + "review_disposition": "UNDETERMINED", + "source_population_and_split": null + }, + { + "applicability_to_this_task_family": null, + "candidate_assurance_axis": "P7_SELECTIVE_CONTROL", + "candidate_intervention": "C1_CRDI_V1", + "coupling_classification": null, + "development_records_prove_family_membership": false, + "development_training_seeds_with_descriptive_records": [ + 11, + 29, + 47 + ], + "eligible_effect_margin_prospectively_qualified": null, + "exclusion_or_inclusion_rationale": null, + "fixed_policy_setting": null, + "hard_gate_measurement_metric_and_unit": null, + "intervention_target_axis_independently_reviewed": null, + "native_metric_better_direction": null, + "nomination_is_primary_non_target": null, + "review_disposition": "UNDETERMINED", + "source_population_and_split": null + }, + { + "applicability_to_this_task_family": null, + "candidate_assurance_axis": "P8_CAPABILITY_RETENTION", + "candidate_intervention": "C1_CRDI_V1", + "coupling_classification": null, + "development_records_prove_family_membership": false, + "development_training_seeds_with_descriptive_records": [ + 11, + 29, + 47 + ], + "eligible_effect_margin_prospectively_qualified": null, + "exclusion_or_inclusion_rationale": null, + "fixed_policy_setting": null, + "hard_gate_measurement_metric_and_unit": null, + "intervention_target_axis_independently_reviewed": null, + "native_metric_better_direction": null, + "nomination_is_primary_non_target": null, + "review_disposition": "UNDETERMINED", + "source_population_and_split": null + }, + { + "applicability_to_this_task_family": null, + "candidate_assurance_axis": "P1_CANONICAL_DECISION", + "candidate_intervention": "C2_CRDI_RETAIN_V1", + "coupling_classification": null, + "development_records_prove_family_membership": false, + "development_training_seeds_with_descriptive_records": [ + 11, + 29, + 47 + ], + "eligible_effect_margin_prospectively_qualified": null, + "exclusion_or_inclusion_rationale": null, + "fixed_policy_setting": null, + "hard_gate_measurement_metric_and_unit": null, + "intervention_target_axis_independently_reviewed": null, + "native_metric_better_direction": null, + "nomination_is_primary_non_target": null, + "review_disposition": "UNDETERMINED", + "source_population_and_split": null + }, + { + "applicability_to_this_task_family": null, + "candidate_assurance_axis": "P2_CALIBRATION", + "candidate_intervention": "C2_CRDI_RETAIN_V1", + "coupling_classification": null, + "development_records_prove_family_membership": false, + "development_training_seeds_with_descriptive_records": [ + 11, + 29, + 47 + ], + "eligible_effect_margin_prospectively_qualified": null, + "exclusion_or_inclusion_rationale": null, + "fixed_policy_setting": null, + "hard_gate_measurement_metric_and_unit": null, + "intervention_target_axis_independently_reviewed": null, + "native_metric_better_direction": null, + "nomination_is_primary_non_target": null, + "review_disposition": "UNDETERMINED", + "source_population_and_split": null + }, + { + "applicability_to_this_task_family": null, + "candidate_assurance_axis": "P3_COHERENCE", + "candidate_intervention": "C2_CRDI_RETAIN_V1", + "coupling_classification": null, + "development_records_prove_family_membership": false, + "development_training_seeds_with_descriptive_records": [ + 11, + 29, + 47 + ], + "eligible_effect_margin_prospectively_qualified": null, + "exclusion_or_inclusion_rationale": null, + "fixed_policy_setting": null, + "hard_gate_measurement_metric_and_unit": null, + "intervention_target_axis_independently_reviewed": null, + "native_metric_better_direction": null, + "nomination_is_primary_non_target": null, + "review_disposition": "UNDETERMINED", + "source_population_and_split": null + }, + { + "applicability_to_this_task_family": null, + "candidate_assurance_axis": "P4_SEMANTIC_STABILITY", + "candidate_intervention": "C2_CRDI_RETAIN_V1", + "coupling_classification": null, + "development_records_prove_family_membership": false, + "development_training_seeds_with_descriptive_records": [ + 11, + 29, + 47 + ], + "eligible_effect_margin_prospectively_qualified": null, + "exclusion_or_inclusion_rationale": null, + "fixed_policy_setting": null, + "hard_gate_measurement_metric_and_unit": null, + "intervention_target_axis_independently_reviewed": null, + "native_metric_better_direction": null, + "nomination_is_primary_non_target": null, + "review_disposition": "UNDETERMINED", + "source_population_and_split": null + }, + { + "applicability_to_this_task_family": null, + "candidate_assurance_axis": "P5_EVIDENCE_RESPONSIVENESS", + "candidate_intervention": "C2_CRDI_RETAIN_V1", + "coupling_classification": null, + "development_records_prove_family_membership": false, + "development_training_seeds_with_descriptive_records": [ + 11, + 29, + 47 + ], + "eligible_effect_margin_prospectively_qualified": null, + "exclusion_or_inclusion_rationale": null, + "fixed_policy_setting": null, + "hard_gate_measurement_metric_and_unit": null, + "intervention_target_axis_independently_reviewed": null, + "native_metric_better_direction": null, + "nomination_is_primary_non_target": null, + "review_disposition": "UNDETERMINED", + "source_population_and_split": null + }, + { + "applicability_to_this_task_family": null, + "candidate_assurance_axis": "P6_RULE_CONFORMANCE", + "candidate_intervention": "C2_CRDI_RETAIN_V1", + "coupling_classification": null, + "development_records_prove_family_membership": false, + "development_training_seeds_with_descriptive_records": [ + 11, + 29, + 47 + ], + "eligible_effect_margin_prospectively_qualified": null, + "exclusion_or_inclusion_rationale": null, + "fixed_policy_setting": null, + "hard_gate_measurement_metric_and_unit": null, + "intervention_target_axis_independently_reviewed": null, + "native_metric_better_direction": null, + "nomination_is_primary_non_target": null, + "review_disposition": "UNDETERMINED", + "source_population_and_split": null + }, + { + "applicability_to_this_task_family": null, + "candidate_assurance_axis": "P7_SELECTIVE_CONTROL", + "candidate_intervention": "C2_CRDI_RETAIN_V1", + "coupling_classification": null, + "development_records_prove_family_membership": false, + "development_training_seeds_with_descriptive_records": [ + 11, + 29, + 47 + ], + "eligible_effect_margin_prospectively_qualified": null, + "exclusion_or_inclusion_rationale": null, + "fixed_policy_setting": null, + "hard_gate_measurement_metric_and_unit": null, + "intervention_target_axis_independently_reviewed": null, + "native_metric_better_direction": null, + "nomination_is_primary_non_target": null, + "review_disposition": "UNDETERMINED", + "source_population_and_split": null + }, + { + "applicability_to_this_task_family": null, + "candidate_assurance_axis": "P8_CAPABILITY_RETENTION", + "candidate_intervention": "C2_CRDI_RETAIN_V1", + "coupling_classification": null, + "development_records_prove_family_membership": false, + "development_training_seeds_with_descriptive_records": [ + 11, + 29, + 47 + ], + "eligible_effect_margin_prospectively_qualified": null, + "exclusion_or_inclusion_rationale": null, + "fixed_policy_setting": null, + "hard_gate_measurement_metric_and_unit": null, + "intervention_target_axis_independently_reviewed": null, + "native_metric_better_direction": null, + "nomination_is_primary_non_target": null, + "review_disposition": "UNDETERMINED", + "source_population_and_split": null + }, + { + "applicability_to_this_task_family": null, + "candidate_assurance_axis": "P1_CANONICAL_DECISION", + "candidate_intervention": "D1_DEFER_V1", + "coupling_classification": null, + "development_records_prove_family_membership": false, + "development_training_seeds_with_descriptive_records": [], + "eligible_effect_margin_prospectively_qualified": null, + "exclusion_or_inclusion_rationale": null, + "fixed_policy_setting": null, + "hard_gate_measurement_metric_and_unit": null, + "intervention_target_axis_independently_reviewed": null, + "native_metric_better_direction": null, + "nomination_is_primary_non_target": null, + "review_disposition": "UNDETERMINED", + "source_population_and_split": null + }, + { + "applicability_to_this_task_family": null, + "candidate_assurance_axis": "P2_CALIBRATION", + "candidate_intervention": "D1_DEFER_V1", + "coupling_classification": null, + "development_records_prove_family_membership": false, + "development_training_seeds_with_descriptive_records": [], + "eligible_effect_margin_prospectively_qualified": null, + "exclusion_or_inclusion_rationale": null, + "fixed_policy_setting": null, + "hard_gate_measurement_metric_and_unit": null, + "intervention_target_axis_independently_reviewed": null, + "native_metric_better_direction": null, + "nomination_is_primary_non_target": null, + "review_disposition": "UNDETERMINED", + "source_population_and_split": null + }, + { + "applicability_to_this_task_family": null, + "candidate_assurance_axis": "P3_COHERENCE", + "candidate_intervention": "D1_DEFER_V1", + "coupling_classification": null, + "development_records_prove_family_membership": false, + "development_training_seeds_with_descriptive_records": [], + "eligible_effect_margin_prospectively_qualified": null, + "exclusion_or_inclusion_rationale": null, + "fixed_policy_setting": null, + "hard_gate_measurement_metric_and_unit": null, + "intervention_target_axis_independently_reviewed": null, + "native_metric_better_direction": null, + "nomination_is_primary_non_target": null, + "review_disposition": "UNDETERMINED", + "source_population_and_split": null + }, + { + "applicability_to_this_task_family": null, + "candidate_assurance_axis": "P4_SEMANTIC_STABILITY", + "candidate_intervention": "D1_DEFER_V1", + "coupling_classification": null, + "development_records_prove_family_membership": false, + "development_training_seeds_with_descriptive_records": [], + "eligible_effect_margin_prospectively_qualified": null, + "exclusion_or_inclusion_rationale": null, + "fixed_policy_setting": null, + "hard_gate_measurement_metric_and_unit": null, + "intervention_target_axis_independently_reviewed": null, + "native_metric_better_direction": null, + "nomination_is_primary_non_target": null, + "review_disposition": "UNDETERMINED", + "source_population_and_split": null + }, + { + "applicability_to_this_task_family": null, + "candidate_assurance_axis": "P5_EVIDENCE_RESPONSIVENESS", + "candidate_intervention": "D1_DEFER_V1", + "coupling_classification": null, + "development_records_prove_family_membership": false, + "development_training_seeds_with_descriptive_records": [], + "eligible_effect_margin_prospectively_qualified": null, + "exclusion_or_inclusion_rationale": null, + "fixed_policy_setting": null, + "hard_gate_measurement_metric_and_unit": null, + "intervention_target_axis_independently_reviewed": null, + "native_metric_better_direction": null, + "nomination_is_primary_non_target": null, + "review_disposition": "UNDETERMINED", + "source_population_and_split": null + }, + { + "applicability_to_this_task_family": null, + "candidate_assurance_axis": "P6_RULE_CONFORMANCE", + "candidate_intervention": "D1_DEFER_V1", + "coupling_classification": null, + "development_records_prove_family_membership": false, + "development_training_seeds_with_descriptive_records": [], + "eligible_effect_margin_prospectively_qualified": null, + "exclusion_or_inclusion_rationale": null, + "fixed_policy_setting": null, + "hard_gate_measurement_metric_and_unit": null, + "intervention_target_axis_independently_reviewed": null, + "native_metric_better_direction": null, + "nomination_is_primary_non_target": null, + "review_disposition": "UNDETERMINED", + "source_population_and_split": null + }, + { + "applicability_to_this_task_family": null, + "candidate_assurance_axis": "P7_SELECTIVE_CONTROL", + "candidate_intervention": "D1_DEFER_V1", + "coupling_classification": null, + "development_records_prove_family_membership": false, + "development_training_seeds_with_descriptive_records": [], + "eligible_effect_margin_prospectively_qualified": null, + "exclusion_or_inclusion_rationale": null, + "fixed_policy_setting": null, + "hard_gate_measurement_metric_and_unit": null, + "intervention_target_axis_independently_reviewed": null, + "native_metric_better_direction": null, + "nomination_is_primary_non_target": null, + "review_disposition": "UNDETERMINED", + "source_population_and_split": null + }, + { + "applicability_to_this_task_family": null, + "candidate_assurance_axis": "P8_CAPABILITY_RETENTION", + "candidate_intervention": "D1_DEFER_V1", + "coupling_classification": null, + "development_records_prove_family_membership": false, + "development_training_seeds_with_descriptive_records": [], + "eligible_effect_margin_prospectively_qualified": null, + "exclusion_or_inclusion_rationale": null, + "fixed_policy_setting": null, + "hard_gate_measurement_metric_and_unit": null, + "intervention_target_axis_independently_reviewed": null, + "native_metric_better_direction": null, + "nomination_is_primary_non_target": null, + "review_disposition": "UNDETERMINED", + "source_population_and_split": null + }, + { + "applicability_to_this_task_family": null, + "candidate_assurance_axis": "P1_CANONICAL_DECISION", + "candidate_intervention": "D2_RULETOOL_V1", + "coupling_classification": null, + "development_records_prove_family_membership": false, + "development_training_seeds_with_descriptive_records": [], + "eligible_effect_margin_prospectively_qualified": null, + "exclusion_or_inclusion_rationale": null, + "fixed_policy_setting": null, + "hard_gate_measurement_metric_and_unit": null, + "intervention_target_axis_independently_reviewed": null, + "native_metric_better_direction": null, + "nomination_is_primary_non_target": null, + "review_disposition": "UNDETERMINED", + "source_population_and_split": null + }, + { + "applicability_to_this_task_family": null, + "candidate_assurance_axis": "P2_CALIBRATION", + "candidate_intervention": "D2_RULETOOL_V1", + "coupling_classification": null, + "development_records_prove_family_membership": false, + "development_training_seeds_with_descriptive_records": [], + "eligible_effect_margin_prospectively_qualified": null, + "exclusion_or_inclusion_rationale": null, + "fixed_policy_setting": null, + "hard_gate_measurement_metric_and_unit": null, + "intervention_target_axis_independently_reviewed": null, + "native_metric_better_direction": null, + "nomination_is_primary_non_target": null, + "review_disposition": "UNDETERMINED", + "source_population_and_split": null + }, + { + "applicability_to_this_task_family": null, + "candidate_assurance_axis": "P3_COHERENCE", + "candidate_intervention": "D2_RULETOOL_V1", + "coupling_classification": null, + "development_records_prove_family_membership": false, + "development_training_seeds_with_descriptive_records": [], + "eligible_effect_margin_prospectively_qualified": null, + "exclusion_or_inclusion_rationale": null, + "fixed_policy_setting": null, + "hard_gate_measurement_metric_and_unit": null, + "intervention_target_axis_independently_reviewed": null, + "native_metric_better_direction": null, + "nomination_is_primary_non_target": null, + "review_disposition": "UNDETERMINED", + "source_population_and_split": null + }, + { + "applicability_to_this_task_family": null, + "candidate_assurance_axis": "P4_SEMANTIC_STABILITY", + "candidate_intervention": "D2_RULETOOL_V1", + "coupling_classification": null, + "development_records_prove_family_membership": false, + "development_training_seeds_with_descriptive_records": [], + "eligible_effect_margin_prospectively_qualified": null, + "exclusion_or_inclusion_rationale": null, + "fixed_policy_setting": null, + "hard_gate_measurement_metric_and_unit": null, + "intervention_target_axis_independently_reviewed": null, + "native_metric_better_direction": null, + "nomination_is_primary_non_target": null, + "review_disposition": "UNDETERMINED", + "source_population_and_split": null + }, + { + "applicability_to_this_task_family": null, + "candidate_assurance_axis": "P5_EVIDENCE_RESPONSIVENESS", + "candidate_intervention": "D2_RULETOOL_V1", + "coupling_classification": null, + "development_records_prove_family_membership": false, + "development_training_seeds_with_descriptive_records": [], + "eligible_effect_margin_prospectively_qualified": null, + "exclusion_or_inclusion_rationale": null, + "fixed_policy_setting": null, + "hard_gate_measurement_metric_and_unit": null, + "intervention_target_axis_independently_reviewed": null, + "native_metric_better_direction": null, + "nomination_is_primary_non_target": null, + "review_disposition": "UNDETERMINED", + "source_population_and_split": null + }, + { + "applicability_to_this_task_family": null, + "candidate_assurance_axis": "P6_RULE_CONFORMANCE", + "candidate_intervention": "D2_RULETOOL_V1", + "coupling_classification": null, + "development_records_prove_family_membership": false, + "development_training_seeds_with_descriptive_records": [], + "eligible_effect_margin_prospectively_qualified": null, + "exclusion_or_inclusion_rationale": null, + "fixed_policy_setting": null, + "hard_gate_measurement_metric_and_unit": null, + "intervention_target_axis_independently_reviewed": null, + "native_metric_better_direction": null, + "nomination_is_primary_non_target": null, + "review_disposition": "UNDETERMINED", + "source_population_and_split": null + }, + { + "applicability_to_this_task_family": null, + "candidate_assurance_axis": "P7_SELECTIVE_CONTROL", + "candidate_intervention": "D2_RULETOOL_V1", + "coupling_classification": null, + "development_records_prove_family_membership": false, + "development_training_seeds_with_descriptive_records": [], + "eligible_effect_margin_prospectively_qualified": null, + "exclusion_or_inclusion_rationale": null, + "fixed_policy_setting": null, + "hard_gate_measurement_metric_and_unit": null, + "intervention_target_axis_independently_reviewed": null, + "native_metric_better_direction": null, + "nomination_is_primary_non_target": null, + "review_disposition": "UNDETERMINED", + "source_population_and_split": null + }, + { + "applicability_to_this_task_family": null, + "candidate_assurance_axis": "P8_CAPABILITY_RETENTION", + "candidate_intervention": "D2_RULETOOL_V1", + "coupling_classification": null, + "development_records_prove_family_membership": false, + "development_training_seeds_with_descriptive_records": [], + "eligible_effect_margin_prospectively_qualified": null, + "exclusion_or_inclusion_rationale": null, + "fixed_policy_setting": null, + "hard_gate_measurement_metric_and_unit": null, + "intervention_target_axis_independently_reviewed": null, + "native_metric_better_direction": null, + "nomination_is_primary_non_target": null, + "review_disposition": "UNDETERMINED", + "source_population_and_split": null + } + ], + "clinical_claim_or_publication_authorized": false, + "confirmatory_access_authorized": false, + "crossed_source_case_calculator_seed_variance_qualified": false, + "decision_required": "Qualified external reviewer must individually disposition all 56 candidate pairs as primary, exploratory, out-of-scope or inapplicable with source-bound rationale, after separately nominating target properties and hard-gate metrics. No slot is automatically a hypothesis and none may be silently omitted.", + "each_primary_effect_90_percent_power_qualified": false, + "independently_reviewed_holm_membership": false, + "potential_intervention_axis_slots_not_hypothesis_tests": 56, + "prospectively_reviewed_primary_non_target_hypotheses": null, + "schema": "commandmed.v5.non-target-holm-candidate-coverage.v1", + "source_sha256": { + "docs/research/paper-rebuild-v2-2026-10-02/intervention-matrix-protocol.md": "1641bb0d6cb5ecc75ff5430d43aacf5fd24c991fb6ec10e49a5f3a344781a76f", + "docs/research/paper-rebuild-v2-2026-10-02/preregistration-v5.md": "cd8cec1821fc63042a3a0ac872a82697e401b447004f98ac02d84f61408352bf" + }, + "status": "REVIEW_COVERAGE_INVENTORY_ONLY_NOT_HOLM_FAMILY" +} diff --git a/docs/research/paper-rebuild-v2-2026-10-02/V5_PRIMARY_NON_TARGET_CANDIDATE_COVERAGE_2026-10-11.md b/docs/research/paper-rebuild-v2-2026-10-02/V5_PRIMARY_NON_TARGET_CANDIDATE_COVERAGE_2026-10-11.md new file mode 100644 index 00000000..a4dc190e --- /dev/null +++ b/docs/research/paper-rebuild-v2-2026-10-02/V5_PRIMARY_NON_TARGET_CANDIDATE_COVERAGE_2026-10-11.md @@ -0,0 +1,15 @@ +# V5 — Complete candidate intervention × assurance-axis reviewer coverage (2026-10-11) + +**Status: `REVIEW_COVERAGE_INVENTORY_ONLY / NOT_A_HOLM_FAMILY / NO_FAMILY_FREEZE / NO_CONFIRMATORY_AUTHORITY`.** + +This artifact addresses only the danger of **silent omission from a future independent statistical nomination review**. It does not determine which cells are eligible, primary, hard-gate non-target comparisons, exploratory, or inapplicable. **The 56 candidate pairs are NOT 56 hypothesis tests.** They are eight possible property-axis review slots for each of seven pre-existing *prospective draft* intervention IDs. + +The seven intervention IDs were read from the SHA-bound `preregistration-v5.md`, original file SHA-256 `cd8cec1821fc63042a3a0ac872a82697e401b447004f98ac02d84f61408352bf`. The eight matrix axes were read from the SHA-bound `intervention-matrix-protocol.md`, original file SHA-256 `1641bb0d6cb5ecc75ff5430d43aacf5fd24c991fb6ec10e49a5f3a344781a76f`. These **original scientific source documents were not changed**; both remain part of the independently rechecked 307 frozen originals. The original preregistration remains `PARTIALLY_BOUND_NOT_FROZEN` and the intervention matrix remains a `PROSPECTIVE DRAFT`. + +Deterministic record file: `artifacts/v5/development/s1-holm-coverage-2026-10-11/candidate-coverage.json`, SHA-256 `bbd1c687b7336ddc3fcf0f501c066591c8ab99b77b61f9be2e101ac2f19dde84`. Rebuild/reverify it without model weights, GPU, inference, paid API, PHI or held-out data using `python3 scripts/v5_holm_family_coverage_inventory.py --verify artifacts/v5/development/s1-holm-coverage-2026-10-11/candidate-coverage.json`. Both source text SHA-256 fingerprints and all 307 frozen entries are checked before any output can be produced. `--output` can only create a new file, never overwrite an existing record. + +Every candidate pair has an explicit undecided disposition. The reviewer must choose the relevant intervention target property, source task applicability, non-target hard gate, native metric and orientation, fixed decision/abstention policy, split/population, shared-input/structural/mathematical coupling, margin provenance and eligibility; then explicitly justify primary/exploratory/inapplicable disposition for **every applicable candidate pair**, including unfavorable development evidence. Not every assurance axis defines a test on every intervention/task family, and an axis may contain more than one native metric, so neither this matrix nor its count is the actual Holm multiple-testing family. + +Development seed records `11, 29, 47` are present for the B1/C1/C2 paths only and are labeled **availability of descriptive records**, not inferential coverage, positive outcomes or three additional independent hypotheses. The four A1/A2/D1/D2 paths have empty descriptive seed lists in this packet; absence is not evidence of good performance or automatic inapplicability. Any final family must be nominated and signed **prospectively**, before confirmatory identity generation or valid final power calculation, by qualified independent statistical review as specified in Issue #326. + +Machine-readable safeguards explicitly leave `actual_primary_non_target_holm_family_size=null`, `prospectively_reviewed_primary_non_target_hypotheses=null`, and *all* reviewed-family/crossed-nuisance/90%-power/confirmatory/publication authority flags `false`. The 4096 planned source cases, each-effect 90% target, Holm FWER 0.05, immutable negative pilot results, seed/medical-source/calculator dependence and fixed margin rules remain unchanged. This packet is a review aid, not clinical evidence, peer review, a final statistical power result or authorization to run any model. diff --git a/scripts/v5_holm_family_coverage_inventory.py b/scripts/v5_holm_family_coverage_inventory.py new file mode 100644 index 00000000..c2a5bb04 --- /dev/null +++ b/scripts/v5_holm_family_coverage_inventory.py @@ -0,0 +1,136 @@ +#!/usr/bin/env python3 +"""Source-bound review-nomination coverage, never a declared V5 Holm family.""" +from __future__ import annotations + +import argparse +import json +from pathlib import Path +import re + +import v5_manuscript_development_evidence_audit as audit + +PRE = 'docs/research/paper-rebuild-v2-2026-10-02/preregistration-v5.md' +MATRIX = 'docs/research/paper-rebuild-v2-2026-10-02/intervention-matrix-protocol.md' +HASHES = { + PRE: 'cd8cec1821fc63042a3a0ac872a82697e401b447004f98ac02d84f61408352bf', + MATRIX: '1641bb0d6cb5ecc75ff5430d43aacf5fd24c991fb6ec10e49a5f3a344781a76f', +} +INTERVENTIONS = ( + 'A1_TS_V1', 'A2_SELBIAS_V1', 'B1_TYPED_V1', 'C1_CRDI_V1', + 'C2_CRDI_RETAIN_V1', 'D1_DEFER_V1', 'D2_RULETOOL_V1', +) +AXES = ( + 'P1_CANONICAL_DECISION', 'P2_CALIBRATION', 'P3_COHERENCE', + 'P4_SEMANTIC_STABILITY', 'P5_EVIDENCE_RESPONSIVENESS', + 'P6_RULE_CONFORMANCE', 'P7_SELECTIVE_CONTROL', 'P8_CAPABILITY_RETENTION', +) +DEVELOPMENT_PATHS_WITH_THREE_SEED_RECORDS = frozenset( + ('B1_TYPED_V1', 'C1_CRDI_V1', 'C2_CRDI_RETAIN_V1') +) + + +class CoverageContractError(ValueError): + """A prospective source, candidate identity or review boundary drifted.""" + + +def require(valid: bool, error: str) -> None: + if not valid: + raise CoverageContractError(error) + + +def extract_source_candidates(prereg: str, matrix: str) -> tuple[tuple[str, ...], tuple[str, ...]]: + """Read only the explicitly named prospective source sections, never outcomes.""" + require('## Bound intervention specification IDs' in prereg, 'MISSING_INTERVENTION_SECTION') + part = prereg.split('## Bound intervention specification IDs', 1)[1].split('\n## ', 1)[0] + interventions = tuple(re.findall(r'`([A-D][12]_[A-Z0-9_]+_V1)`', part)) + require(len(interventions) == len(set(interventions)), 'DUPLICATED_INTERVENTION_IDS') + require(interventions == INTERVENTIONS, 'FROZEN_INTERVENTION_IDS_DRIFT') + + require('Primary matrix columns:' in matrix, 'MISSING_ASSURANCE_AXES') + part = matrix.split('Primary matrix columns:', 1)[1].split('\n## ', 1)[0] + axes = tuple(re.findall(r'^- `([P][1-8]_[A-Z_]+)`:', part, flags=re.MULTILINE)) + require(len(axes) == len(set(axes)), 'DUPLICATED_AXIS_IDS') + require(axes == AXES, 'FROZEN_ASSURANCE_AXES_DRIFT') + return interventions, axes + + +def build_inventory(interventions: tuple[str, ...], axes: tuple[str, ...]) -> dict: + require(interventions == INTERVENTIONS and axes == AXES, 'CANDIDATE_GRID_DRIFT') + cells = [] + for intervention in interventions: + for axis in axes: + cells.append({ + 'candidate_intervention': intervention, + 'candidate_assurance_axis': axis, + 'review_disposition': 'UNDETERMINED', + 'nomination_is_primary_non_target': None, + 'intervention_target_axis_independently_reviewed': None, + 'applicability_to_this_task_family': None, + 'hard_gate_measurement_metric_and_unit': None, + 'native_metric_better_direction': None, + 'fixed_policy_setting': None, + 'source_population_and_split': None, + 'coupling_classification': None, + 'eligible_effect_margin_prospectively_qualified': None, + 'exclusion_or_inclusion_rationale': None, + 'development_training_seeds_with_descriptive_records': ( + [11, 29, 47] if intervention in DEVELOPMENT_PATHS_WITH_THREE_SEED_RECORDS else [] + ), + 'development_records_prove_family_membership': False, + }) + require(len(cells) == 56 and len({(x['candidate_intervention'], x['candidate_assurance_axis']) for x in cells}) == 56, + 'INCOMPLETE_CANDIDATE_COVERAGE') + return { + 'schema': 'commandmed.v5.non-target-holm-candidate-coverage.v1', + 'status': 'REVIEW_COVERAGE_INVENTORY_ONLY_NOT_HOLM_FAMILY', + 'source_sha256': HASHES, + 'candidate_intervention_count': len(interventions), + 'candidate_assurance_axis_count': len(axes), + 'potential_intervention_axis_slots_not_hypothesis_tests': len(cells), + 'candidate_slots': cells, + 'prospectively_reviewed_primary_non_target_hypotheses': None, + 'actual_primary_non_target_holm_family_size': None, + 'independently_reviewed_holm_membership': False, + 'crossed_source_case_calculator_seed_variance_qualified': False, + 'each_primary_effect_90_percent_power_qualified': False, + 'confirmatory_access_authorized': False, + 'clinical_claim_or_publication_authorized': False, + 'decision_required': ( + 'Qualified external reviewer must individually disposition all 56 candidate pairs as ' + 'primary, exploratory, out-of-scope or inapplicable with source-bound rationale, ' + 'after separately nominating target properties and hard-gate metrics. ' + 'No slot is automatically a hypothesis and none may be silently omitted.' + ), + } + + +def source_bound_inventory(root: Path = audit.ROOT) -> dict: + require(audit.audit(root)['frozen_source_files_verified'] == 307, 'ORIGINAL_FROZEN_FILES_DRIFT') + loaded = {} + for relative, digest in HASHES.items(): + p = audit._locked_file(root.resolve(), relative, digest) + loaded[relative] = p.read_text(encoding='utf-8') + return build_inventory(*extract_source_candidates(loaded[PRE], loaded[MATRIX])) + + +def main() -> int: + parser = argparse.ArgumentParser() + cmd = parser.add_mutually_exclusive_group(required=True) + cmd.add_argument('--verify', type=Path) + cmd.add_argument('--output', type=Path) + args = parser.parse_args() + result = source_bound_inventory() + payload = (json.dumps(result, sort_keys=True, indent=2, allow_nan=False) + '\n').encode('utf-8') + if args.verify is not None: + require(args.verify.is_file() and args.verify.read_bytes() == payload, 'CANDIDATE_COVERAGE_REPLAY_DRIFT') + else: + args.output.parent.mkdir(parents=True, exist_ok=True) + with args.output.open('xb') as stream: + stream.write(payload) + print(json.dumps({'status': result['status'], 'coverage_slots': 56, 'holm_family_size': None, + 'confirmatory_authorized': False}, sort_keys=True)) + return 0 + + +if __name__ == '__main__': + raise SystemExit(main()) diff --git a/tests/reliability_v5/test_holm_candidate_coverage_inventory.py b/tests/reliability_v5/test_holm_candidate_coverage_inventory.py new file mode 100644 index 00000000..a1ff5a15 --- /dev/null +++ b/tests/reliability_v5/test_holm_candidate_coverage_inventory.py @@ -0,0 +1,94 @@ +"""No statistical decisions may be manufactured by exhaustive candidate listing.""" +from __future__ import annotations + +import copy +import json +import subprocess +import sys +from pathlib import Path + +import pytest + +sys.path.insert(0, str(Path(__file__).resolve().parents[2] / 'scripts')) +import v5_holm_family_coverage_inventory as grid + + +def test_source_bound_complete_56_candidate_grid_without_any_family_claim() -> None: + result = grid.source_bound_inventory() + assert result['potential_intervention_axis_slots_not_hypothesis_tests'] == 56 + assert len(result['candidate_slots']) == 56 + assert {(c['candidate_intervention'], c['candidate_assurance_axis']) for c in result['candidate_slots']} == { + (i, a) for i in grid.INTERVENTIONS for a in grid.AXES + } + assert all(c['review_disposition'] == 'UNDETERMINED' + and c['nomination_is_primary_non_target'] is None + and c['hard_gate_measurement_metric_and_unit'] is None + and c['development_records_prove_family_membership'] is False + for c in result['candidate_slots']) + assert result['actual_primary_non_target_holm_family_size'] is None + assert result['prospectively_reviewed_primary_non_target_hypotheses'] is None + for flag in ('independently_reviewed_holm_membership', + 'crossed_source_case_calculator_seed_variance_qualified', + 'each_primary_effect_90_percent_power_qualified', + 'confirmatory_access_authorized', 'clinical_claim_or_publication_authorized'): + assert result[flag] is False + by_intervention = {i: [c for c in result['candidate_slots'] if c['candidate_intervention'] == i] + for i in grid.INTERVENTIONS} + for intervention, cells in by_intervention.items(): + expected_seeds = [11, 29, 47] if intervention in grid.DEVELOPMENT_PATHS_WITH_THREE_SEED_RECORDS else [] + assert len(cells) == 8 + assert all(c['development_training_seeds_with_descriptive_records'] == expected_seeds for c in cells) + + +def test_exact_saved_bytes_and_no_clobber_replay(tmp_path: Path) -> None: + saved = grid.audit.ROOT / 'artifacts/v5/development/s1-holm-coverage-2026-10-11/candidate-coverage.json' + payload = (json.dumps(grid.source_bound_inventory(), sort_keys=True, + indent=2, allow_nan=False) + '\n').encode() + assert saved.read_bytes() == payload + cmd = [sys.executable, str(grid.audit.ROOT / 'scripts/v5_holm_family_coverage_inventory.py')] + v = subprocess.run(cmd + ['--verify', str(saved)], cwd=tmp_path, capture_output=True, text=True) + assert v.returncode == 0, v.stderr + out = tmp_path / 'candidate-coverage.json' + a = subprocess.run(cmd + ['--output', str(out)], cwd=tmp_path, capture_output=True, text=True) + assert a.returncode == 0, a.stderr + assert out.read_bytes() == payload + b = subprocess.run(cmd + ['--output', str(out)], cwd=tmp_path, capture_output=True, text=True) + assert b.returncode != 0 + assert out.read_bytes() == payload + altered = tmp_path / 'altered.json' + altered.write_bytes(payload + b'\n') + c = subprocess.run(cmd + ['--verify', str(altered)], cwd=tmp_path, capture_output=True, text=True) + assert c.returncode != 0 + assert 'CANDIDATE_COVERAGE_REPLAY_DRIFT' in c.stderr + + +@pytest.mark.parametrize('mutator,reason', [ + (lambda interventions, axes: (interventions[:-1], axes), 'CANDIDATE_GRID_DRIFT'), + (lambda interventions, axes: (interventions, axes[:-1]), 'CANDIDATE_GRID_DRIFT'), + (lambda interventions, axes: (interventions + (interventions[0],), axes), 'CANDIDATE_GRID_DRIFT'), + (lambda interventions, axes: (interventions, axes + (axes[0],)), 'CANDIDATE_GRID_DRIFT'), +]) +def test_missing_and_duplicate_candidates_fail_closed(mutator, reason: str) -> None: + i, a = mutator(grid.INTERVENTIONS, grid.AXES) + with pytest.raises(grid.CoverageContractError, match=reason): + grid.build_inventory(i, a) + + +def test_frozen_sections_cannot_silently_change() -> None: + a = (grid.audit.ROOT / grid.PRE).read_text() + b = (grid.audit.ROOT / grid.MATRIX).read_text() + assert grid.extract_source_candidates(a, b) == (grid.INTERVENTIONS, grid.AXES) + with pytest.raises(grid.CoverageContractError, match='FROZEN_INTERVENTION_IDS_DRIFT'): + grid.extract_source_candidates(a.replace('C2_CRDI_RETAIN_V1', 'C2_ALT_V1', 1), b) + with pytest.raises(grid.CoverageContractError, match='FROZEN_ASSURANCE_AXES_DRIFT'): + grid.extract_source_candidates(a, b.replace('P6_RULE_CONFORMANCE', 'P6_NEW_AXIS', 1)) + with pytest.raises(grid.CoverageContractError, match='DUPLICATED_AXIS_IDS'): + grid.extract_source_candidates(a, b.replace('Primary matrix columns:', + 'Primary matrix columns:\n- `P1_CANONICAL_DECISION`: duplicate\n', 1)) + + +def test_source_hashes_are_byte_pinned_and_307_original_entries_preserved() -> None: + result = grid.audit.audit() + assert result['frozen_source_files_verified'] == 307 + for path, digest in grid.HASHES.items(): + assert grid.audit._digest(grid.audit.ROOT / path) == digest From d1a805f769536e7892b4ad2336f4907596ee6ce7 Mon Sep 17 00:00:00 2001 From: Gocceri Date: Sun, 11 Oct 2026 22:44:48 +0300 Subject: [PATCH 12/12] fix(v5): no-clobber atomic visibility for development evidence artifacts Use same-directory synced temporary files and no-clobber hardlink publication in reviewer packet and candidate coverage generators; cover short writes, disk failures, fsync failures, destination collisions and symlink preservation with synthetic regressions. Preserve source hashes, 307 frozen originals and all unapproved Holm, power and confirmatory flags. Signed-off-by: Gocceri --- ...uscript-development-evidence-integrity.yml | 10 ++- ...ON_TARGET_CANDIDATE_COVERAGE_2026-10-11.md | 2 +- ...VE_STATISTICAL_REVIEW_PACKET_2026-10-10.md | 2 +- scripts/v5_development_evidence_writer.py | 38 ++++++++ scripts/v5_holm_family_coverage_inventory.py | 5 +- scripts/v5_s1_statistical_review_packet.py | 5 +- .../test_development_evidence_writer.py | 89 +++++++++++++++++++ 7 files changed, 141 insertions(+), 10 deletions(-) create mode 100644 scripts/v5_development_evidence_writer.py create mode 100644 tests/reliability_v5/test_development_evidence_writer.py diff --git a/.github/workflows/v5-manuscript-development-evidence-integrity.yml b/.github/workflows/v5-manuscript-development-evidence-integrity.yml index b6e9d660..f977d087 100644 --- a/.github/workflows/v5-manuscript-development-evidence-integrity.yml +++ b/.github/workflows/v5-manuscript-development-evidence-integrity.yml @@ -9,6 +9,8 @@ on: - "scripts/v5_manuscript_development_evidence_audit.py" - "scripts/v5_s1_statistical_review_packet.py" - "scripts/v5_holm_family_coverage_inventory.py" + - "scripts/v5_development_evidence_writer.py" + - "tests/reliability_v5/test_development_evidence_writer.py" - "tests/reliability_v5/test_holm_candidate_coverage_inventory.py" - "docs/research/paper-rebuild-v2-2026-10-02/V5_PRIMARY_NON_TARGET_CANDIDATE_COVERAGE_2026-10-11.md" - "tests/reliability_v5/test_statistical_review_packet.py" @@ -67,6 +69,8 @@ jobs: scripts/v5_manuscript_development_evidence_audit.py \ scripts/v5_s1_statistical_review_packet.py \ scripts/v5_holm_family_coverage_inventory.py \ + scripts/v5_development_evidence_writer.py \ + tests/reliability_v5/test_development_evidence_writer.py \ tests/reliability_v5/test_holm_candidate_coverage_inventory.py \ tests/reliability_v5/test_statistical_review_packet.py \ scripts/v5_s1_source_case_pairing_audit.py \ @@ -75,7 +79,8 @@ jobs: tests/reliability_v5/test_source_case_pairing_audit.py \ tests/reliability_v5/test_development_calculator_icc_inventory.py \ tests/reliability_v5/test_statistical_review_packet.py \ - tests/reliability_v5/test_holm_candidate_coverage_inventory.py + tests/reliability_v5/test_holm_candidate_coverage_inventory.py \ + tests/reliability_v5/test_development_evidence_writer.py - name: Reverify source hashes, R1 and R2 archives, and 307 frozen files shell: bash @@ -174,4 +179,5 @@ jobs: tests/reliability_v5/test_source_case_pairing_audit.py \ tests/reliability_v5/test_development_calculator_icc_inventory.py \ tests/reliability_v5/test_statistical_review_packet.py \ - tests/reliability_v5/test_holm_candidate_coverage_inventory.py + tests/reliability_v5/test_holm_candidate_coverage_inventory.py \ + tests/reliability_v5/test_development_evidence_writer.py diff --git a/docs/research/paper-rebuild-v2-2026-10-02/V5_PRIMARY_NON_TARGET_CANDIDATE_COVERAGE_2026-10-11.md b/docs/research/paper-rebuild-v2-2026-10-02/V5_PRIMARY_NON_TARGET_CANDIDATE_COVERAGE_2026-10-11.md index a4dc190e..f5afb57a 100644 --- a/docs/research/paper-rebuild-v2-2026-10-02/V5_PRIMARY_NON_TARGET_CANDIDATE_COVERAGE_2026-10-11.md +++ b/docs/research/paper-rebuild-v2-2026-10-02/V5_PRIMARY_NON_TARGET_CANDIDATE_COVERAGE_2026-10-11.md @@ -6,7 +6,7 @@ This artifact addresses only the danger of **silent omission from a future indep The seven intervention IDs were read from the SHA-bound `preregistration-v5.md`, original file SHA-256 `cd8cec1821fc63042a3a0ac872a82697e401b447004f98ac02d84f61408352bf`. The eight matrix axes were read from the SHA-bound `intervention-matrix-protocol.md`, original file SHA-256 `1641bb0d6cb5ecc75ff5430d43aacf5fd24c991fb6ec10e49a5f3a344781a76f`. These **original scientific source documents were not changed**; both remain part of the independently rechecked 307 frozen originals. The original preregistration remains `PARTIALLY_BOUND_NOT_FROZEN` and the intervention matrix remains a `PROSPECTIVE DRAFT`. -Deterministic record file: `artifacts/v5/development/s1-holm-coverage-2026-10-11/candidate-coverage.json`, SHA-256 `bbd1c687b7336ddc3fcf0f501c066591c8ab99b77b61f9be2e101ac2f19dde84`. Rebuild/reverify it without model weights, GPU, inference, paid API, PHI or held-out data using `python3 scripts/v5_holm_family_coverage_inventory.py --verify artifacts/v5/development/s1-holm-coverage-2026-10-11/candidate-coverage.json`. Both source text SHA-256 fingerprints and all 307 frozen entries are checked before any output can be produced. `--output` can only create a new file, never overwrite an existing record. +Deterministic record file: `artifacts/v5/development/s1-holm-coverage-2026-10-11/candidate-coverage.json`, SHA-256 `bbd1c687b7336ddc3fcf0f501c066591c8ab99b77b61f9be2e101ac2f19dde84`. Rebuild/reverify it without model weights, GPU, inference, paid API, PHI or held-out data using `python3 scripts/v5_holm_family_coverage_inventory.py --verify artifacts/v5/development/s1-holm-coverage-2026-10-11/candidate-coverage.json`. Both source text SHA-256 fingerprints and all 307 frozen entries are checked before any output can be produced. `--output` writes and syncs a same-directory temporary file before publishing complete bytes with an atomic no-clobber hard link; it never overwrites an existing record, and it removes temporary files after failed writes. Unsupported hard links fail closed; parent-directory power-loss durability is not claimed. Every candidate pair has an explicit undecided disposition. The reviewer must choose the relevant intervention target property, source task applicability, non-target hard gate, native metric and orientation, fixed decision/abstention policy, split/population, shared-input/structural/mathematical coupling, margin provenance and eligibility; then explicitly justify primary/exploratory/inapplicable disposition for **every applicable candidate pair**, including unfavorable development evidence. Not every assurance axis defines a test on every intervention/task family, and an axis may contain more than one native metric, so neither this matrix nor its count is the actual Holm multiple-testing family. diff --git a/docs/research/paper-rebuild-v2-2026-10-02/V5_S1_DESCRIPTIVE_STATISTICAL_REVIEW_PACKET_2026-10-10.md b/docs/research/paper-rebuild-v2-2026-10-02/V5_S1_DESCRIPTIVE_STATISTICAL_REVIEW_PACKET_2026-10-10.md index 28585346..67c9d646 100644 --- a/docs/research/paper-rebuild-v2-2026-10-02/V5_S1_DESCRIPTIVE_STATISTICAL_REVIEW_PACKET_2026-10-10.md +++ b/docs/research/paper-rebuild-v2-2026-10-02/V5_S1_DESCRIPTIVE_STATISTICAL_REVIEW_PACKET_2026-10-10.md @@ -9,7 +9,7 @@ This is an audit-ready model-free bridge between the 72 original paired source-c - Development paired SD source: `artifacts/v5/development/s1-paired-sd-inventory-2026-10-09/development-paired-sd.json` (SHA-256 `b1edf781b61d3f5ce227c08908ca43ad9864c0b398a7318c33895951af37bacd`). - Original development calculator ICC source: `artifacts/v5/development/s1-calculator-icc-inventory-2026-10-10/development-calculator-icc.json` (SHA-256 `37d64c0f6ac14d04cc6420a020e7bb7997fb333e50729f33798b2d403d292370`). - Deterministic composite output: `artifacts/v5/development/s1-statistical-review-packet-2026-10-10/reviewer-packet.json` (new additive development-only file, not among the immutable 307). SHA-256: `86a275cb5cd7760f421538df34fea8b6dc452a19d095ddc4f4c6f0e69a87e348`. -- Generator: `scripts/v5_s1_statistical_review_packet.py`; no model weights, network, GPU, PHI, new source-case IDs, or external API calls. From the repository root, run `python3 scripts/v5_s1_statistical_review_packet.py --verify artifacts/v5/development/s1-statistical-review-packet-2026-10-10/reviewer-packet.json`. `--output` writes **only to a previously nonexistent path**; `--verify` never modifies it. +- Generator: `scripts/v5_s1_statistical_review_packet.py`; no model weights, network, GPU, PHI, new source-case IDs, or external API calls. From the repository root, run `python3 scripts/v5_s1_statistical_review_packet.py --verify artifacts/v5/development/s1-statistical-review-packet-2026-10-10/reviewer-packet.json`. `--output` writes and syncs a same-directory temporary file before atomically publishing complete bytes to a **previously nonexistent path** with a no-clobber hard link (unsupported hard links fail closed); `--verify` never modifies it. No blanket directory-fsync or power-loss durability claim is made. - The generator first executes the full source-bound audit: all 307 frozen entries and 9 locked development sources must have their original hashes. It rejects mismatched source mean effects across independently stored SD and ICC descriptions, missing/duplicate cells, changed seed membership, erased negative ICCs, forged review status, and mismatched three-seed descriptive sample SDs. In addition, it independently reconstructs each of 72 within-source-case sample SDs from its original calculator ANOVA mean-square components, using `sqrt(((K-1)*MS_B+K*(m-1)*MS_W)/(K*m-1))` with `K=64,m=60`; it recomputes the corresponding **unclipped** method-of-moments ICC before accepting the stored values. These are algebraic integrity checks, **not** proof of a statistically valid dependence model. GitHub CI reruns the audit, generator replay, and mutation tests on the exact PR head. ## What reviewers can now inspect (not an inferential result) diff --git a/scripts/v5_development_evidence_writer.py b/scripts/v5_development_evidence_writer.py new file mode 100644 index 00000000..756c0274 --- /dev/null +++ b/scripts/v5_development_evidence_writer.py @@ -0,0 +1,38 @@ +"""Publish completed *development-only* evidence bytes without partial filenames. + +This helper never rewrites existing research evidence or makes scientific claims. +""" +from __future__ import annotations + +import os +from pathlib import Path +import tempfile + + +def publish_no_clobber(path: Path, contents: bytes) -> None: + """Write+sync privately, then atomically add the completed destination name. + + The temporary file and destination must reside on the same filesystem. + A hard link refuses an existing file or symlink, even if another writer + races publication. No replace/rename fallback is allowed. Directory fsync + and total power-loss durability are explicitly not guaranteed. + """ + path.parent.mkdir(parents=True, exist_ok=True) + fd, name = tempfile.mkstemp(prefix=f".{path.name}.", suffix=".tmp", dir=path.parent) + temp = Path(name) + try: + try: + remainder = memoryview(contents) + while remainder: + size = os.write(fd, remainder) + if size <= 0: + raise OSError("incomplete evidence write") + remainder = remainder[size:] + os.fsync(fd) + finally: + os.close(fd) + # Link rather than rename/replace so a concurrently created destination + # cannot be clobbered after the first existence check. + os.link(temp, path) + finally: + temp.unlink(missing_ok=True) diff --git a/scripts/v5_holm_family_coverage_inventory.py b/scripts/v5_holm_family_coverage_inventory.py index c2a5bb04..5859e7cc 100644 --- a/scripts/v5_holm_family_coverage_inventory.py +++ b/scripts/v5_holm_family_coverage_inventory.py @@ -8,6 +8,7 @@ import re import v5_manuscript_development_evidence_audit as audit +from v5_development_evidence_writer import publish_no_clobber PRE = 'docs/research/paper-rebuild-v2-2026-10-02/preregistration-v5.md' MATRIX = 'docs/research/paper-rebuild-v2-2026-10-02/intervention-matrix-protocol.md' @@ -124,9 +125,7 @@ def main() -> int: if args.verify is not None: require(args.verify.is_file() and args.verify.read_bytes() == payload, 'CANDIDATE_COVERAGE_REPLAY_DRIFT') else: - args.output.parent.mkdir(parents=True, exist_ok=True) - with args.output.open('xb') as stream: - stream.write(payload) + publish_no_clobber(args.output, payload) print(json.dumps({'status': result['status'], 'coverage_slots': 56, 'holm_family_size': None, 'confirmatory_authorized': False}, sort_keys=True)) return 0 diff --git a/scripts/v5_s1_statistical_review_packet.py b/scripts/v5_s1_statistical_review_packet.py index 4ca07de3..5f9a37fb 100644 --- a/scripts/v5_s1_statistical_review_packet.py +++ b/scripts/v5_s1_statistical_review_packet.py @@ -10,6 +10,7 @@ from typing import Any import v5_manuscript_development_evidence_audit as bound +from v5_development_evidence_writer import publish_no_clobber INTERVENTIONS = {"B1_TYPED_V1": "B1", "C1_CRDI_V1": "C1", "C2_CRDI_RETAIN_V1": "C2"} SEEDS = (11, 29, 47) @@ -194,9 +195,7 @@ def main() -> int: require(args.verify.is_file() and args.verify.read_bytes() == payload.encode("utf-8"), "COMMITTED_REVIEW_PACKET_REPLAY_DRIFT") else: - args.output.parent.mkdir(parents=True, exist_ok=True) - with args.output.open("x", encoding="utf-8", newline="\n") as f: - f.write(payload) + publish_no_clobber(args.output, payload.encode("utf-8")) print(json.dumps({"status": "PASS_SOURCE_BOUND_DESCRIPTIVE_REVIEW_PACKET_REPLAY", "groups": 24, "cells": 72, "statistical_power_qualified": False}, sort_keys=True)) diff --git a/tests/reliability_v5/test_development_evidence_writer.py b/tests/reliability_v5/test_development_evidence_writer.py new file mode 100644 index 00000000..c734bc87 --- /dev/null +++ b/tests/reliability_v5/test_development_evidence_writer.py @@ -0,0 +1,89 @@ +"""Synthetic failure injection: never publish partial V5 development evidence.""" +from __future__ import annotations + +import sys +from pathlib import Path + +import pytest + +sys.path.insert(0, str(Path(__file__).resolve().parents[2] / 'scripts')) +import v5_development_evidence_writer as writer + + +def test_publish_exact_data_then_collision_fails_without_clobber(tmp_path: Path) -> None: + out = tmp_path / 'folder' / 'source-bound.json' + original = b'{"status":"DEVELOPMENT_ONLY","confirmatory":false}\n' + writer.publish_no_clobber(out, original) + assert out.read_bytes() == original + with pytest.raises(FileExistsError): + writer.publish_no_clobber(out, b'FORGED') + assert out.read_bytes() == original + assert list(out.parent.iterdir()) == [out] + + +def test_existing_symlink_or_input_cannot_be_clobbered(tmp_path: Path) -> None: + original = tmp_path / 'original.json' + original.write_bytes(b'ORIGINAL_RESEARCH_EVIDENCE') + alias = tmp_path / 'output.json' + alias.symlink_to(original) + for destination in (original, alias): + with pytest.raises(FileExistsError): + writer.publish_no_clobber(destination, b'FORGED') + assert original.read_bytes() == b'ORIGINAL_RESEARCH_EVIDENCE' + assert alias.is_symlink() + assert set(tmp_path.iterdir()) == {original, alias} + + +@pytest.mark.parametrize('stage', ('partial', 'zero_byte', 'sync', 'publish')) +def test_write_failure_leaves_no_visible_evidence_or_temp_file( + tmp_path: Path, monkeypatch: pytest.MonkeyPatch, stage: str, +) -> None: + destination = tmp_path / 'evidence.json' + actual_write = writer.os.write + attempts = 0 + + def half_then_io_error(fd: int, contents: bytes | memoryview) -> int: + nonlocal attempts + attempts += 1 + if attempts == 1: + return actual_write(fd, contents[: max(1, len(contents) // 2)]) + raise OSError('injected disk full after partial write') + + def zero_byte(_fd: int, _contents: bytes | memoryview) -> int: + return 0 + + def inject(*_args: object) -> None: + raise OSError('injected sync or publication failure') + + with monkeypatch.context() as patcher: + if stage == 'partial': + patcher.setattr(writer.os, 'write', half_then_io_error) + elif stage == 'zero_byte': + patcher.setattr(writer.os, 'write', zero_byte) + elif stage == 'sync': + patcher.setattr(writer.os, 'fsync', inject) + else: + patcher.setattr(writer.os, 'link', inject) + with pytest.raises(OSError): + writer.publish_no_clobber(destination, b'{"incomplete":false}' * 10) + assert not destination.exists() + assert list(tmp_path.iterdir()) == [] + + +def test_short_write_retries_correctly(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None: + target = tmp_path / 'full.json' + data = b'case-first no power authority\n' * 11 + real_write = writer.os.write + calls = 0 + + def write_at_most_seven(fd: int, buf: bytes | memoryview) -> int: + nonlocal calls + calls += 1 + return real_write(fd, buf[:7]) + + with monkeypatch.context() as patcher: + patcher.setattr(writer.os, 'write', write_at_most_seven) + writer.publish_no_clobber(target, data) + assert calls > 2 + assert target.read_bytes() == data + assert list(tmp_path.iterdir()) == [target]