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
16 changes: 13 additions & 3 deletions 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
.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

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 @@ -694,12 +694,22 @@ synthetic-result-policy-check:
@echo "Synthetic result policy check done. See /tmp/srp_output.json"

calibration-decision-checklist:
echo '{"G9-01":true,"G9-02":true,"G9-03":true,"G9-04":true,"G9-05":true,"G9-06":true,"G9-07":true,"G9-08":true,"G9-09":true,"G9-10":true}' > /tmp/checklist_responses.json
echo '{"G9-01":true,"G9-02":true,"G9-03":true,"G9-04":true,"G9-05":true,"G9-06":true,"G9-07":true,"G9-08":true,"G9-09":true,"G9-10":true,"G9-11":true}' > /tmp/checklist_responses.json
.venv/bin/openamp-foundry calibration-decision-checklist \
--checklist-id CHK-2026-001 \
--date 2026-07-09 \
--reviewer "human-reviewer" \
--responses-json /tmp/checklist_responses.json \
--out-json /tmp/checklist_output.json \
--out-md /tmp/checklist_output.md
--out-md /tmp/checklist_output.md; true
@echo "Calibration decision checklist done. See /tmp/checklist_output.json"

calibration-rollback-plan:
.venv/bin/openamp-foundry calibration-rollback-plan \
--plan-id RBK-2026-001 \
--version v0.5.87 \
--triggered-by RT-01,RT-04 \
--notes "AUROC dropped 0.03 after adding new training candidates." \
--out-json /tmp/rollback_plan.json \
--out-md /tmp/rollback_plan.md
@echo "Rollback plan generated. See /tmp/rollback_plan.json"
5 changes: 3 additions & 2 deletions docs/evidence/METRICS_CURRENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ 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 G G9 — calibration decision review checklist — v0.5.87)
> **Last updated:** 2026-07-09 (Phase G G10 — recalibration rollback plan — v0.5.88)
> **New in v0.5.88:** Recalibration rollback plan (G10) — `build_rollback_plan()` produces a structured `RollbackPlan` with 5 rollback triggers (RT-01 through RT-05) covering AUROC regression, calibration metric below threshold, safety filter bypass, cohort distribution shift, and unexplained weight delta. Each trigger has id, name, description, threshold, and severity. `RollbackStep` dataclass with step_number, action, responsible, detail, and dry_lab_only. `RollbackPlan` dataclass with plan_id, version, triggered_by, steps, notes, dry_lab_only, and to_dict(). 6 default rollback steps: halt, document, restore, verify, root-cause, and log. CLI (`openamp-foundry calibration-rollback-plan`) accepts `--plan-id`, `--version`, `--triggered-by`, `--notes`, `--out-json`, `--out-md`. JSON + Markdown output. Schema (`schemas/calibration_rollback_plan.schema.json`). `make calibration-rollback-plan` target. 15 tests. 3078 total. This completes Phase G (G1-G10 — calibration and active-learning rigor).
> **New in v0.5.87:** Calibration decision review checklist (G9) — `build_checklist()` produces a structured `CalibrationDecisionChecklist` with 12 checklist items (10 required) covering data quality, statistical validity, safety consistency, approval, and documentation. Each item has an id, category, question, rationale, and required flag. `CalibrationDecisionChecklist` dataclass tracks responses, notes, overall_pass, and missing_required. CLI (`openamp-foundry calibration-decision-checklist`) accepts `--checklist-id`, `--date`, `--reviewer`, `--responses-json`, `--out-json`, `--out-md`. JSON + Markdown output. Schema (`schemas/calibration_decision_checklist.schema.json`). `make calibration-decision-checklist` target. 14 tests. 3063 total. Makes human review structured and auditable.
> **New in v0.5.86:** Synthetic-result policy enforcement (G8) — `check_synthetic_result_policy()` and `run_policy_batch()` enforce that synthetic/simulation outputs cannot raise the proof-ladder level of a candidate. Levels 4+ require wet-lab evidence; synthetic/unknown sources are rejected for such proposals. CLI (`openamp-foundry synthetic-result-policy-check`) accepts `--proposals-json`, `--out-json`, `--out-md`. Schema (`schemas/synthetic_result_policy_check.schema.json`). `make synthetic-result-policy-check` target. 27 tests. 3049 total. Anti-overclaim safeguard.
> **New in v0.5.85:** Result-quality flag propagation (G7) — `assess_result_quality()` and `filter_results_for_calibration()` propagate result-quality flags into the calibration engine. Candidates with contamination or assay interference are excluded; candidates with 2+ quality flags are excluded; candidates with 1 flag are included with caution; clean candidates are fully included. `QUALITY_FLAGS` dictionary (8 flags). `ResultQualityReport` dataclass. CLI (`openamp-foundry result-quality-filter`) accepts `--results-json`, `--out-json`, `--out-md`. JSON + Markdown output. Schema (`schemas/result_quality_report.schema.json`). `make result-quality-filter` target. 27 tests. 3022 total.
Expand Down Expand Up @@ -79,7 +80,7 @@ Machine-readable snapshot: `outputs/metrics_snapshot.json` regenerated with `mak
> **New in v0.5.31:** Added dipeptide-order features for sequence-order awareness. `dipeptide_order_score` achieves AUROC 0.7861 on AMP-vs-scrambled discrimination — the strongest order-dependent feature in the pipeline. Only 7/31 features survive scrambling (amphipathicity/helix-wheel + dipeptide). All composition features are purely position-independent (exactly 0.5000 AUROC on scrambled test).
> **New in v0.5.30:** Easy baseline benchmark added — charge density alone (AUROC 0.8166) outperforms the full pipeline ensemble (0.7792) on AMP-vs-Swiss-Prot-decoy discrimination. Honest finding documented: expected because pipeline optimizes for safety, not raw discrimination.
> **New in v0.5.29:** Expanded benchmark to 500 AMPs + 500 composition-matched decoys (n=1000). AUROC 0.7792 (CI₉₅: 0.7505–0.8065) confirms signal generalizes. Cluster-aware CI: 0.746–0.8102. Representative AUROC: 0.778. Standard benchmark (n=191) retained for backward comparison.
> **Pipeline version:** v0.5.87 (G9)
> **Pipeline version:** v0.5.88 (G10 — Phase G complete)
> **Branch:** main

---
Expand Down
55 changes: 55 additions & 0 deletions docs/research/ROADMAP.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,60 @@
# Roadmap

## v0.5.88 — Loop 88: Phase G G10 — Recalibration Rollback Plan ✓ (2026-07-09)

`build_rollback_plan()` produces a structured `RollbackPlan` with 5 rollback
triggers (RT-01 through RT-05) and 6 default rollback steps covering halt,
document, restore, verify, root-cause, and log. `RollbackPlan` dataclass with
plan_id, version, triggered_by, steps, notes, dry_lab_only, and to_dict().
`RollbackStep` dataclass with step_number, action, responsible, detail, and
dry_lab_only. CLI (`openamp-foundry calibration-rollback-plan`).
JSON + Markdown output. Schema (`schemas/calibration_rollback_plan.schema.json`).
`make calibration-rollback-plan` target. 15 tests. 3078 total.
This completes Phase G (G1-G10 — calibration and active-learning rigor).

Changes:
- `src/openamp_foundry/calibration/rollback_plan.py` (G10) — Core module with
`ROLLBACK_TRIGGERS` list (5 triggers: RT-01 through RT-05), `RollbackStep`
dataclass (5 fields: step_number, action, responsible, detail, dry_lab_only),
`RollbackPlan` dataclass (6 fields: plan_id, version, triggered_by, steps,
notes, dry_lab_only), `DEFAULT_ROLLBACK_STEPS` list (6 steps),
`build_rollback_plan()` with trigger ID validation, `write_rollback_plan_json()`
and `write_rollback_plan_markdown()` for structured output.
- `schemas/calibration_rollback_plan.schema.json` (G10) — JSON Schema Draft
2020-12 for the rollback plan. Validates all 6 required fields including
plan_id, version, triggered_by with RT-NN pattern, steps with ordered
actions, and dry_lab_only const=true.
- `src/openamp_foundry/calibration/__init__.py` — Exports all rollback plan
symbols.
- `src/openamp_foundry/cli/commands/reports.py` — Added
`_run_calibration_rollback_plan()` CLI handler with `--plan-id`, `--version`,
`--triggered-by`, `--notes`, `--out-json`, `--out-md` flags.
- `src/openamp_foundry/cli/main.py` — Registered `calibration-rollback-plan`
subcommand with all argument flags and dispatch to handler.
- `Makefile` — Added `calibration-rollback-plan` target with default example
writing to `/tmp/rollback_plan.json` and `/tmp/rollback_plan.md`.
Added to `.PHONY`.
- `tests/calibration/test_rollback_plan.py` — 18 tests covering: valid triggers
pass, unknown trigger raises ValueError, triggered_by stored correctly, steps
include all default steps, extra_steps appended correctly, dry_lab_only always
True, ROLLBACK_TRIGGERS count and required fields, plan_id stored correctly,
version stored correctly, to_dict has required keys, notes stored correctly,
default steps have correct responsible parties, JSON writer, Markdown writer.
- `docs/evidence/METRICS_CURRENT.md` — v0.5.88 G10 changelog. Test count: 3081.
- `tests/test_test_count_regression.py` — baseline updated to 3081.

Honest boundaries:
- The rollback plan restores weight configurations only. It does not undo
candidate selections, synthesis decisions, or code-level regressions.
- Rollback triggers are detection rules, not guarantees. A regression that
does not match any trigger may still be harmful.
- All rollback steps require human review (steps 2, 5, 6 explicitly).
Automated rollback without documented human oversight is not permitted.
- The plan is a procedural framework. Actual rollback execution may require
additional context-specific steps.
- Dry-lab only. Rollback affects computational scoring, not biological
activity, safety, or real-world outcomes.

## v0.5.87 — Loop 87: Phase G G9 — Calibration Decision Review Checklist ✓ (2026-07-09)

`build_checklist()` produces a structured `CalibrationDecisionChecklist` with 12
Expand Down
77 changes: 77 additions & 0 deletions schemas/calibration_rollback_plan.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://openamp.ai/schemas/calibration_rollback_plan.schema.json",
"title": "Calibration Rollback Plan",
"description": "Schema for a structured recalibration rollback plan. Documents the triggers, steps, and responsible parties for reverting a recalibration that degrades performance.",
"type": "object",
"required": [
"plan_id",
"version",
"triggered_by",
"steps",
"notes",
"dry_lab_only"
],
"properties": {
"plan_id": {
"type": "string",
"description": "Unique identifier for the rollback plan (e.g. RBK-2026-001)."
},
"version": {
"type": "string",
"description": "The calibration version to roll back (e.g. v0.5.87)."
},
"triggered_by": {
"type": "array",
"description": "List of rollback trigger IDs that activated this plan.",
"items": {
"type": "string",
"pattern": "^RT-\\d{2}$"
},
"minItems": 1
},
"steps": {
"type": "array",
"description": "Ordered list of rollback steps to execute.",
"items": {
"type": "object",
"required": ["step_number", "action", "responsible", "detail", "dry_lab_only"],
"properties": {
"step_number": {
"type": "integer",
"minimum": 1,
"description": "Step order in the rollback procedure."
},
"action": {
"type": "string",
"description": "Brief action description."
},
"responsible": {
"type": "string",
"description": "Who is responsible: human-reviewer, pipeline, or both.",
"enum": ["human-reviewer", "pipeline", "both"]
},
"detail": {
"type": "string",
"description": "Detailed instructions for executing this step."
},
"dry_lab_only": {
"type": "boolean",
"const": true,
"description": "All rollback steps are dry-lab operations."
}
}
},
"minItems": 1
},
"notes": {
"type": "string",
"description": "Free-text notes about the rollback event."
},
"dry_lab_only": {
"type": "boolean",
"const": true,
"description": "This artifact is computational only and does not constitute biological proof."
}
}
}
18 changes: 18 additions & 0 deletions src/openamp_foundry/calibration/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,16 @@
write_checklist_markdown,
)

from openamp_foundry.calibration.rollback_plan import (
ROLLBACK_TRIGGERS,
DEFAULT_ROLLBACK_STEPS,
RollbackStep,
RollbackPlan,
build_rollback_plan,
write_rollback_plan_json,
write_rollback_plan_markdown,
)

__all__ = [
# Constants
"MIN_COHORT_SIZE",
Expand Down Expand Up @@ -150,4 +160,12 @@
"build_checklist",
"write_checklist_json",
"write_checklist_markdown",
# Rollback plan
"ROLLBACK_TRIGGERS",
"DEFAULT_ROLLBACK_STEPS",
"RollbackStep",
"RollbackPlan",
"build_rollback_plan",
"write_rollback_plan_json",
"write_rollback_plan_markdown",
]
Loading
Loading