Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: help demo test lint ci clean bench-leakage bench-multi-negatives bench-baseline bench-hidden-active bench-cluster-split bench-expert-ablation bench-expert-ablation-500 bench-selectivity bench-feature-decomp bench-gate bench-easy-baseline bench-charge-matched bench-order-dependent bench-precision-at-k bench-per-family bench-simulation-ablation bench-simulation-ablation-within-amp simulation-gate bench-strategy-compare regenerate-all generate phase3 pilot validate-scoring validate-scoring-phase3 validate-scoring-strict external-pilot pilot-confident presynth-qc gold-standard diversity synthesis-order novelty-broad external-consensus questionnaire gate-check ip-report benchmark-card wave0-5-gate-check wave0-5-novelty-audit wave0-5-novelty-audit-v2 wave0-5-panel wave0-5-evidence wave0-5-fill-external wave0-5b-generate wave0-5b-filter recalibration-engine recalibration-engine-dry-run validate-policy-version generate-synthetic-lab-results bump-policy-version generate-review-packet failed-candidate-report safe-publication-filter classify-negative-informativeness validate-rejection-events negative-result-dashboard calibration-audit calibration-audit-example calibration-overfit-check result-quality-filter synthetic-result-policy-check calibration-decision-checklist calibration-rollback-plan simulation-registry validate-simulation-result-schema simulation-baseline-check adapter-gate-check simulation-provenance simulation-ensemble-check simulation-ci-report simulation-deprecation-check simulation-scope-check simulation-evidence-packet artifact-version candidate-manifest artifact-changelog integration-check adapter-author-check license-check artifact-compat-check contribution-check adoption-scorecard release-gate-check decision-log release-request-check coi-check rotation-plan-check security-report-check citation-check roadmap-sync-check advisory-review-check annual-review-check
.PHONY: help demo test lint ci clean bench-leakage bench-multi-negatives bench-baseline bench-hidden-active bench-cluster-split bench-expert-ablation bench-expert-ablation-500 bench-selectivity bench-feature-decomp bench-gate bench-easy-baseline bench-charge-matched bench-order-dependent bench-precision-at-k bench-per-family bench-simulation-ablation bench-simulation-ablation-within-amp simulation-gate bench-strategy-compare regenerate-all generate phase3 pilot validate-scoring validate-scoring-phase3 validate-scoring-strict external-pilot pilot-confident presynth-qc gold-standard diversity synthesis-order novelty-broad external-consensus questionnaire gate-check ip-report benchmark-card wave0-5-gate-check wave0-5-novelty-audit wave0-5-novelty-audit-v2 wave0-5-panel wave0-5-evidence wave0-5-fill-external wave0-5b-generate wave0-5b-filter recalibration-engine recalibration-engine-dry-run validate-policy-version generate-synthetic-lab-results bump-policy-version generate-review-packet failed-candidate-report safe-publication-filter classify-negative-informativeness validate-rejection-events negative-result-dashboard calibration-audit calibration-audit-example calibration-overfit-check result-quality-filter synthetic-result-policy-check calibration-decision-checklist calibration-rollback-plan simulation-registry validate-simulation-result-schema simulation-baseline-check adapter-gate-check simulation-provenance simulation-ensemble-check simulation-ci-report simulation-deprecation-check simulation-scope-check simulation-evidence-packet artifact-version candidate-manifest artifact-changelog integration-check adapter-author-check license-check artifact-compat-check contribution-check adoption-scorecard release-gate-check decision-log release-request-check coi-check rotation-plan-check security-report-check citation-check roadmap-sync-check advisory-review-check annual-review-check selection-rationale-check

PYTHON := $(shell [ -f .venv/bin/python ] && echo .venv/bin/python || echo python3)
PYTEST := $(shell [ -f .venv/bin/pytest ] && echo .venv/bin/pytest || echo pytest)
Expand Down Expand Up @@ -885,3 +885,8 @@ annual-review-check:
.venv/bin/openamp-foundry annual-review-check \
--entry-json '{"review_id":"ANN-2026-001","year":"2026","section":"safety_policy","reviewer":"maintainer-1","finding_count":0,"action_items_count":0,"status":"completed","notes":"All safety checks passed.","completion_date":"2026-07-09"}'
@echo "Annual review check complete."

selection-rationale-check:
.venv/bin/openamp-foundry selection-rationale-check \
--entry-json '{"selection_id":"SEL-2026-001","batch_id":"batch-2026-001","candidate_id":"OAMP-001","pipeline_version":"v0.7.9","selection_date":"2026-07-09","evidence_level":3,"baseline_comparison":"Scored above random baseline (AUROC 0.83) and charge-matched baseline (AUROC 0.71).","primary_criterion":"Top ensemble score with selectivity index > 2.","safety_flags_checked":["hemolysis_checked","toxicity_checked"],"reviewer":"maintainer-1"}'
@echo "Selection rationale check complete."
4 changes: 3 additions & 1 deletion docs/evidence/METRICS_CURRENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ Machine-readable snapshot: `outputs/metrics_snapshot.json` regenerated with `mak
> **Purpose:** One authoritative table of current pipeline metrics. If any doc disagrees
> with this file, this file wins. Updated whenever benchmark/benchmark config changes.
>
> **Last updated:** 2026-07-09 (Phase J J10 — annual safety and benchmark review checklist — v0.7.8)
> **Last updated:** 2026-07-09 (Phase K K1 — selection rationale schema — v0.7.9)
> **New in v0.7.9:** Candidate selection rationale schema (K1 — Loop 119) — docs/evidence/SELECTION_RATIONALE_GUIDE.md with purpose, required field table (11 fields), evidence level table (6 levels from PROOF_LADDER.md), validation workflow. src/openamp_foundry/evidence/selection_rationale.py with SelectionRationaleEntry dataclass (11 fields: selection_id, batch_id, candidate_id, pipeline_version, selection_date, evidence_level, baseline_comparison, primary_criterion, safety_flags_checked, reviewer, dry_lab_only), SelectionRationaleResult dataclass (5 fields, dry_lab_only=True), VALID_EVIDENCE_LEVELS (6: 1-6), MINIMUM_SAFETY_FLAGS (1), validate_selection_rationale() (11 checks: SEL- prefix, non-empty batch_id/candidate_id/pipeline_version, YYYY-MM-DD date, valid evidence_level 1-6, non-empty baseline_comparison/primary_criterion, safety_flags_checked list with >=1 entry, non-empty reviewer, dry_lab_only must be True; evidence_level<=2 warns with synthesis caution), validate_selection_rationale_dict() (10 required fields guard). CLI (openamp-foundry selection-rationale-check) with --entry-json, --format text|json. make selection-rationale-check target. Phase K K1: every selection decision now has a machine-validated evidence trail.
>
> **New in v0.7.8:** Annual safety and benchmark review checklist (J10 — Loop 118) — docs/governance/ANNUAL_REVIEW_CHECKLIST.md with 5-section structured checklist (safety_policy: 6 checks including dual-use safeguards, dry_lab_only enforcement, toxicity filters; benchmark_thresholds: 6 checks including threshold loosening guard, easy-baseline requirement, deprecation check; calibration_status: 4 checks including recalibration gate and rollback plan; governance_decisions: 4 checks including COI disclosures and rotation plan; data_governance: 3 checks including proprietary data flag). src/openamp_foundry/governance/annual_review.py with AnnualReviewEntry dataclass (10 fields: review_id, year, section, reviewer, finding_count, action_items_count, status, notes, completion_date, dry_lab_only), AnnualReviewResult dataclass (6 fields: review_id, year, section, passed, errors, warnings, dry_lab_only=True), VALID_REVIEW_SECTIONS (5: benchmark_thresholds, calibration_status, data_governance, governance_decisions, safety_policy), VALID_ENTRY_STATUSES (5: completed, deferred, in_progress, not_applicable, pending), validate_annual_review_entry() (9 checks: ANN- prefix, 4-digit year, valid section, non-empty reviewer, non-negative finding_count, non-negative action_items_count, valid status, completed requires YYYY-MM-DD completion_date, dry_lab_only must be True; completed+no-notes warns, deferred warns, findings+no-action-items warns), validate_annual_review_dict() (7 required fields guard). CLI (openamp-foundry annual-review-check) with --entry-json, --format text|json. make annual-review-check target. Long-term trust: annual review entries are now machine-validated.
>
> **New in v0.7.7:** External advisory review process (J9 — Loop 117) — docs/governance/EXTERNAL_ADVISORY_REVIEW_PROCESS.md with reviewer eligibility criteria, review scope table (5 review types with minimum reviewer counts), 5-step review process (prepare packet, assign+disclose, receive+log, respond to findings, close), finding severity classification (critical/major/minor/informational), limitations. src/openamp_foundry/governance/advisory_review.py with AdvisoryReview dataclass (11 fields: review_id, review_type, artifact_id, reviewer_handle, assigned_date, deadline_date, status, finding_severity, finding_summary, resolved, dry_lab_only), AdvisoryReviewResult dataclass (5 fields: review_id, review_type, passed, errors, warnings, dry_lab_only=True), VALID_REVIEW_TYPES (5: benchmark_audit, candidate_review, evidence_review, governance_review, safety_policy_review), VALID_REVIEW_STATUSES (5: assigned, completed, deferred, in_progress, pending), VALID_FINDING_SEVERITIES (4: critical, informational, major, minor), MINIMUM_REVIEWER_COUNTS (5 entries: candidate_review and safety_policy_review require 2, others 1), validate_advisory_review() (9 checks: ADV- prefix, valid review_type, non-empty artifact_id, non-empty reviewer_handle, YYYY-MM-DD dates, valid status, valid finding_severity, dry_lab_only must be True; critical+unresolved warns, completed+no-summary warns, deferred warns), validate_advisory_review_dict() (7 required fields guard). CLI (openamp-foundry advisory-review-check) with --review-json, --format text|json. make advisory-review-check target. 29 tests. Credibility: external advisory reviews now have a validated structure and documented process.
Expand Down
63 changes: 63 additions & 0 deletions docs/evidence/SELECTION_RATIONALE_GUIDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Selection Rationale Guide

> **Scope:** Dry-lab only. No wet-lab or in-vivo claims.
> **Purpose:** Record WHY each candidate was selected for synthesis or further testing.
> External reviewers and future calibration runs need this to audit and challenge decisions.

---

## What Is a Selection Rationale?

A selection rationale (`SelectionRationaleEntry`) is a machine-validated record that
documents, for each selected candidate:

1. The evidence level (1–6 from `PROOF_LADDER.md`) supporting the selection.
2. What the pipeline's score was compared to (baseline comparison).
3. Which safety and quality flags were checked before selection.
4. Who made the selection decision and when.

## Required Fields

| Field | Description |
|---|---|
| `selection_id` | Unique ID, must start with `SEL-` |
| `batch_id` | The batch this selection belongs to |
| `candidate_id` | The specific candidate being selected |
| `pipeline_version` | Pipeline version used for scoring |
| `selection_date` | Date of selection (YYYY-MM-DD) |
| `evidence_level` | 1–6, must match `PROOF_LADDER.md` levels |
| `baseline_comparison` | Description of what the score was compared to |
| `primary_criterion` | Main reason this candidate was selected |
| `safety_flags_checked` | List of safety/quality flags that were verified |
| `reviewer` | Handle of the person or agent making the selection |
| `dry_lab_only` | Must be True — no wet-lab claims |

## Evidence Levels

| Level | Meaning |
|---|---|
| 1 | Sequence-only computational nomination |
| 2 | Multi-property computational nomination |
| 3 | Computational nomination with novelty filter |
| 4 | Computational nomination with calibration evidence |
| 5 | Computational + simulation evidence (experimental still required) |
| 6 | Experimental validation (requires human review before claim) |

Levels 5 and 6 require `dry_lab_only=True` to avoid overclaiming.

## How to Validate

```bash
make selection-rationale-check
```

or:

```bash
openamp-foundry selection-rationale-check \
--entry-json '{"selection_id": "SEL-2026-001", ...}'
```

---

*This guide is machine-validated. See `src/openamp_foundry/evidence/selection_rationale.py`.*
13 changes: 13 additions & 0 deletions docs/research/NEXT_100_PR_MAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,19 @@ Make success survivable.
| J9 | Add external advisory review process. | Credibility. | D |
| J10 | Add annual safety and benchmark review checklist. | Long-term trust. | D |

## Phase K — External Pilot Readiness

Build the evidence and accountability artifacts needed for credible external validation.

| PR | Task | Why it matters | Review class |
|---:|---|---|---|
| K1 | Add candidate selection rationale schema. | Auditable selection decisions. | B |
| K2 | Add batch experiment priority ranker. | Rank candidates for next synthesis wave. | B |
| K3 | Add pilot package completeness checker. | All components present before submission. | B |
| K4 | Add post-experiment calibration intake schema. | Structured result-to-prediction comparison. | B/D |
| K5 | Add uncertainty quantification report schema. | Honest prediction intervals for reviewers. | B |


## Prioritization rule

When choosing between tasks, prefer the one that:
Expand Down
15 changes: 15 additions & 0 deletions docs/research/ROADMAP.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Roadmap

## v0.7.9 — Loop 119: Phase K K1 — Selection Rationale Schema ✓ (2026-07-09)

`docs/evidence/SELECTION_RATIONALE_GUIDE.md` documenting what selection rationale
entries must contain, why they are needed for external review, and how evidence
levels map to `PROOF_LADDER.md`.

`src/openamp_foundry/evidence/selection_rationale.py` with `SelectionRationaleEntry`
dataclass (11 fields, dry_lab_only=True enforced), `SelectionRationaleResult`
dataclass (5 fields), `VALID_EVIDENCE_LEVELS` (1–6), `MINIMUM_SAFETY_FLAGS` (1),
`validate_selection_rationale()` (11 checks, 1 warning condition for low evidence
levels), `validate_selection_rationale_dict()` (10 required fields guard).
CLI: `openamp-foundry selection-rationale-check`. `make selection-rationale-check` target.
**Phase K milestone: v0.7.9** — every candidate selection now requires a
machine-validated rationale with evidence level and baseline comparison.

## v0.7.8 — Loop 118: Phase J J10 — Annual Safety and Benchmark Review Checklist ✓ (2026-07-09)

`docs/governance/ANNUAL_REVIEW_CHECKLIST.md` with 5-section structured annual
Expand Down
34 changes: 34 additions & 0 deletions src/openamp_foundry/cli/commands/reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -2817,3 +2817,37 @@ def _run_annual_review_check(args: argparse.Namespace) -> int:
print(" Annual review entry validated. Long-term trust maintained.")

return 0 if result.passed else 3


def _run_selection_rationale_check(args: argparse.Namespace) -> int:
"""Validate a candidate selection rationale entry."""
import json as _json
from openamp_foundry.evidence.selection_rationale import validate_selection_rationale_dict

try:
d = _json.loads(args.entry_json)
except _json.JSONDecodeError as exc:
print(_json.dumps({"status": "error", "error": f"Invalid JSON: {exc}"}))
return 2

if not isinstance(d, dict):
print(_json.dumps({"status": "error", "error": "--entry-json must be a JSON object"}))
return 2

result = validate_selection_rationale_dict(d)
output_format = getattr(args, "format", "text")

if output_format == "json":
import dataclasses
print(_json.dumps(dataclasses.asdict(result), indent=2))
else:
status = "PASS" if result.passed else "FAIL"
print(f"Selection rationale {result.selection_id} (candidate {result.candidate_id}): {status}")
for e in result.errors:
print(f" ERROR: {e}")
for w in result.warnings:
print(f" WARN: {w}")
if result.passed:
print(" Selection rationale validated. Decision is auditable.")

return 0 if result.passed else 3
24 changes: 23 additions & 1 deletion src/openamp_foundry/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from openamp_foundry.cli.commands.reports import _run_security_report_check
from openamp_foundry.cli.commands.reports import _run_citation_check
from openamp_foundry.cli.commands.reports import _run_roadmap_sync_check
from openamp_foundry.cli.commands.reports import _run_advisory_review_check, _run_annual_review_check
from openamp_foundry.cli.commands.reports import _run_advisory_review_check, _run_annual_review_check, _run_selection_rationale_check

import argparse
import json
Expand Down Expand Up @@ -1999,6 +1999,25 @@ def build_parser() -> argparse.ArgumentParser:
help="Output format (default: text).",
)

# ── Selection rationale check (Phase K K1) ───────────────────────
src2 = sub.add_parser(
"selection-rationale-check",
help=(
"Validate a candidate selection rationale. Ensures every selected "
"candidate has a documented evidence level and baseline comparison. "
"Dry-lab only."
),
)
src2.add_argument(
"--entry-json", type=str, required=True,
help="JSON string of a SelectionRationaleEntry dict (required).",
)
src2.add_argument(
"--format", type=str, default="text",
choices=["text", "json"],
help="Output format (default: text).",
)

# ── Annual review check (Phase J J10) ───────────────────────────
anrc = sub.add_parser(
"annual-review-check",
Expand Down Expand Up @@ -2285,6 +2304,9 @@ def main(argv: list[str] | None = None) -> int:
if args.command == "annual-review-check":
return _run_annual_review_check(args)

if args.command == "selection-rationale-check":
return _run_selection_rationale_check(args)

parser.error("unknown command")
return 2

Expand Down
Loading
Loading