Skip to content

Commit 6f66ee8

Browse files
author
OpenCode
committed
feat: Phase Y Y4 pipeline maturity certificate schema (PMC-) -- A/B/C/D grade aggregating CBR+FIA+SDA for pre-registration anchoring (#857)
VALID_PMC_GRADES (A-D), VALID_PMC_VERDICTS (4), REQUIRED_PMC_COMPONENTS=(CBR,FIA,SDA). PMCComponentCheck helper; grade A (3 superior verdicts), B (2), C (1), D (0 or no assessed). contributes_to_grade auto-derived from verdict (pipeline_superior/multi_feature_signal/diverse_panel → True). dry_lab_only=True; 54 tests. BASELINE updated 10656->10710.
1 parent 71c6b48 commit 6f66ee8

4 files changed

Lines changed: 525 additions & 2 deletions

File tree

‎docs/research/NEXT_100_PR_MAP.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,5 +303,5 @@ Track and publish structured comparisons between pipeline selections and cheap b
303303
| Y1 | Add cheap baseline comparison record schema (CBR-) (complete). — src/openamp_foundry/evidence/cheap_baseline_comparison_record.py: VALID_CBR_VERDICTS (4: pipeline_superior/tied/baseline_superior/insufficient_data), VALID_BASELINE_METHODS (5: charge_only_rank/length_only_rank/random_selection/charge_length_combined/hydrophobicity_only_rank), VALID_CBR_METRICS (4: auroc/hit_rate/top_k_precision/ndcg), SUPERIORITY_THRESHOLD=0.05, MIN_SAMPLE_SIZE=5; metric_delta auto-computed; verdict auto-derived; dry_lab_only=True; 62 tests. | Structured record: pipeline metric vs charge-only/random/length-only baseline; pre-registered threshold; verdict (pipeline_superior/tied/baseline_superior/insufficient_data). Forces every performance claim to cite the baseline it beat. | C |
304304
| Y2 | Add feature importance audit schema (FIA-) (complete). — src/openamp_foundry/evidence/feature_importance_audit.py: VALID_FIA_VERDICTS (5), VALID_FEATURE_IMPORTANCE_LEVELS (4), VALID_AUDIT_FEATURES (8), DOMINATION_THRESHOLD=0.80; importance_level auto-assigned; top_feature/charge_score/length_score auto-extracted; verdict: charge_dominated when charge_explains_fraction>=0.80; dry_lab_only=True; 50 tests. | Documents which features drove selections and whether charge/length alone explains the result; anti-cheap-explanation gate. | C |
305305
| Y3 | Add selection diversity audit schema (SDA-) (complete). — src/openamp_foundry/evidence/selection_diversity_audit.py: VALID_SDA_VERDICTS (4: diverse_panel/moderately_diverse/proximity_driven/insufficient_data), VALID_DIVERSITY_METRICS (4), DIVERSE_PANEL_THRESHOLD=0.10, PROXIMITY_DRIVEN_THRESHOLD=-0.05, MIN_PANEL_SIZE=3; diversity_delta auto-computed; verdict: diverse_panel (delta>=0.10), proximity_driven (delta<=-0.05); dry_lab_only=True; 46 tests. | Tracks sequence diversity of selected panel vs random draw; detects proximity-driven selection masquerading as discovery; required before any novelty claim. | C |
306-
| Y4 | Add pipeline maturity certificate schema (PMC-). | Aggregates CBR/FIA/SDA results into A/B/C/D maturity grade; anchors pre-registration; prevents retroactive interpretation of results. | C |
306+
| Y4 | Add pipeline maturity certificate schema (PMC-) (complete). — src/openamp_foundry/evidence/pipeline_maturity_certificate.py: VALID_PMC_GRADES (A-D), VALID_PMC_VERDICTS (4: pipeline_validated/pipeline_provisional/pipeline_unvalidated/insufficient_evidence), REQUIRED_PMC_COMPONENTS=(CBR,FIA,SDA); PMCComponentCheck helper; grade A (all 3 superior), B (2), C (1), D (0/none assessed); contributes_to_grade auto-derived from verdict; dry_lab_only=True; 54 tests. | Aggregates CBR/FIA/SDA results into A/B/C/D maturity grade; anchors pre-registration; prevents retroactive interpretation. | C |
307307
| Y5 | Add Phase Y accountability gate (YAG-). | Top-level gate asserting CBR+FIA+SDA+PMC all present; verdict: accountability_verified/accountability_partial/accountability_not_established; closes Phase Y; no external pilot claim is credible without passing this gate. | C |
Lines changed: 198 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,198 @@
1+
"""PMC- pipeline maturity certificate schema.
2+
3+
Aggregates CBR (baseline comparison), FIA (feature importance audit), and
4+
SDA (selection diversity audit) results into an A/B/C/D maturity grade.
5+
Anchors pre-registration: the grade is frozen before results are interpreted
6+
so it cannot be retroactively adjusted. No "mature pipeline" claim is
7+
credible without this certificate.
8+
"""
9+
10+
from __future__ import annotations
11+
12+
from dataclasses import dataclass
13+
14+
VALID_PMC_GRADES: frozenset[str] = frozenset({
15+
"A",
16+
"B",
17+
"C",
18+
"D",
19+
})
20+
21+
VALID_PMC_VERDICTS: frozenset[str] = frozenset({
22+
"pipeline_validated",
23+
"pipeline_provisional",
24+
"pipeline_unvalidated",
25+
"insufficient_evidence",
26+
})
27+
28+
REQUIRED_PMC_COMPONENTS: tuple[str, ...] = ("CBR", "FIA", "SDA")
29+
30+
GRADE_A_REQUIRED_SUPERIOR_VERDICTS: int = 3
31+
GRADE_B_REQUIRED_SUPERIOR_VERDICTS: int = 2
32+
GRADE_C_REQUIRED_SUPERIOR_VERDICTS: int = 1
33+
34+
35+
@dataclass
36+
class PMCComponentCheck:
37+
component_type: str
38+
artifact_id: str
39+
verdict: str
40+
contributes_to_grade: bool
41+
42+
43+
@dataclass
44+
class PipelineMaturityCertificate:
45+
pmc_id: str
46+
pipeline_version: str
47+
component_checks: list[PMCComponentCheck]
48+
n_components_assessed: int
49+
n_superior_verdicts: int
50+
pmc_grade: str
51+
pmc_verdict: str
52+
dry_lab_only: bool
53+
limitations: list[str]
54+
created_at: str
55+
56+
57+
def validate_pipeline_maturity_certificate(pmc: PipelineMaturityCertificate) -> None:
58+
if not pmc.pmc_id.startswith("PMC-"):
59+
raise ValueError(f"pmc_id must start with 'PMC-': {pmc.pmc_id!r}")
60+
if not pmc.pipeline_version:
61+
raise ValueError("pipeline_version must be non-empty")
62+
if len(pmc.component_checks) != len(REQUIRED_PMC_COMPONENTS):
63+
raise ValueError(
64+
f"component_checks must have exactly {len(REQUIRED_PMC_COMPONENTS)} entries"
65+
)
66+
for check in pmc.component_checks:
67+
if check.component_type not in REQUIRED_PMC_COMPONENTS:
68+
raise ValueError(
69+
f"component_type {check.component_type!r} not in REQUIRED_PMC_COMPONENTS"
70+
)
71+
expected_prefix = f"{check.component_type}-"
72+
if check.artifact_id and not check.artifact_id.startswith(expected_prefix):
73+
raise ValueError(
74+
f"artifact_id {check.artifact_id!r} must start with {expected_prefix!r}"
75+
)
76+
n_assessed = sum(1 for c in pmc.component_checks if c.artifact_id)
77+
if pmc.n_components_assessed != n_assessed:
78+
raise ValueError("n_components_assessed mismatch")
79+
n_superior = sum(1 for c in pmc.component_checks if c.contributes_to_grade)
80+
if pmc.n_superior_verdicts != n_superior:
81+
raise ValueError("n_superior_verdicts mismatch")
82+
if pmc.pmc_grade not in VALID_PMC_GRADES:
83+
raise ValueError(f"pmc_grade {pmc.pmc_grade!r} not in VALID_PMC_GRADES")
84+
if pmc.pmc_verdict not in VALID_PMC_VERDICTS:
85+
raise ValueError(
86+
f"pmc_verdict {pmc.pmc_verdict!r} not in VALID_PMC_VERDICTS"
87+
)
88+
if not pmc.dry_lab_only:
89+
raise ValueError("dry_lab_only must be True")
90+
if not pmc.limitations:
91+
raise ValueError("limitations must be non-empty")
92+
if not pmc.created_at:
93+
raise ValueError("created_at must be non-empty")
94+
95+
96+
_SUPERIOR_VERDICTS: frozenset[str] = frozenset({
97+
"pipeline_superior",
98+
"multi_feature_signal",
99+
"diverse_panel",
100+
})
101+
102+
103+
def _contributes_to_grade(component_type: str, verdict: str) -> bool:
104+
return verdict in _SUPERIOR_VERDICTS
105+
106+
107+
def _compute_grade_and_verdict(
108+
n_assessed: int,
109+
n_superior: int,
110+
) -> tuple[str, str]:
111+
if n_assessed == 0:
112+
return "D", "insufficient_evidence"
113+
if n_superior >= GRADE_A_REQUIRED_SUPERIOR_VERDICTS:
114+
return "A", "pipeline_validated"
115+
if n_superior >= GRADE_B_REQUIRED_SUPERIOR_VERDICTS:
116+
return "B", "pipeline_provisional"
117+
if n_superior >= GRADE_C_REQUIRED_SUPERIOR_VERDICTS:
118+
return "C", "pipeline_unvalidated"
119+
return "D", "pipeline_unvalidated"
120+
121+
122+
def build_pipeline_maturity_certificate(
123+
*,
124+
pmc_id: str,
125+
pipeline_version: str,
126+
cbr_artifact_id: str = "",
127+
cbr_verdict: str = "",
128+
fia_artifact_id: str = "",
129+
fia_verdict: str = "",
130+
sda_artifact_id: str = "",
131+
sda_verdict: str = "",
132+
limitations: list[str],
133+
created_at: str,
134+
) -> PipelineMaturityCertificate:
135+
"""Build a PipelineMaturityCertificate.
136+
137+
Pass non-empty artifact_id + verdict for each assessed component.
138+
Empty artifact_id means the component was not assessed.
139+
"""
140+
checks = [
141+
PMCComponentCheck(
142+
component_type="CBR",
143+
artifact_id=cbr_artifact_id,
144+
verdict=cbr_verdict,
145+
contributes_to_grade=_contributes_to_grade("CBR", cbr_verdict),
146+
),
147+
PMCComponentCheck(
148+
component_type="FIA",
149+
artifact_id=fia_artifact_id,
150+
verdict=fia_verdict,
151+
contributes_to_grade=_contributes_to_grade("FIA", fia_verdict),
152+
),
153+
PMCComponentCheck(
154+
component_type="SDA",
155+
artifact_id=sda_artifact_id,
156+
verdict=sda_verdict,
157+
contributes_to_grade=_contributes_to_grade("SDA", sda_verdict),
158+
),
159+
]
160+
n_assessed = sum(1 for c in checks if c.artifact_id)
161+
n_superior = sum(1 for c in checks if c.contributes_to_grade)
162+
grade, verdict = _compute_grade_and_verdict(n_assessed, n_superior)
163+
pmc = PipelineMaturityCertificate(
164+
pmc_id=pmc_id,
165+
pipeline_version=pipeline_version,
166+
component_checks=checks,
167+
n_components_assessed=n_assessed,
168+
n_superior_verdicts=n_superior,
169+
pmc_grade=grade,
170+
pmc_verdict=verdict,
171+
dry_lab_only=True,
172+
limitations=limitations,
173+
created_at=created_at,
174+
)
175+
validate_pipeline_maturity_certificate(pmc)
176+
return pmc
177+
178+
179+
def format_pipeline_maturity_certificate(pmc: PipelineMaturityCertificate) -> str:
180+
lines = [
181+
f"Pipeline Maturity Certificate — {pmc.pmc_id}",
182+
f"Pipeline: {pmc.pipeline_version}",
183+
f"Grade: {pmc.pmc_grade} | Verdict: {pmc.pmc_verdict}",
184+
f"Components assessed: {pmc.n_components_assessed}/{len(REQUIRED_PMC_COMPONENTS)} "
185+
f"| Superior verdicts: {pmc.n_superior_verdicts}",
186+
]
187+
lines.append("Component checks:")
188+
for check in pmc.component_checks:
189+
status = "ASSESSED" if check.artifact_id else "NOT_ASSESSED"
190+
contrib = " [contributes]" if check.contributes_to_grade else ""
191+
lines.append(
192+
f" {check.component_type}: {status} "
193+
f"verdict={check.verdict or 'N/A'}{contrib}"
194+
)
195+
lines.append(f"Created: {pmc.created_at}")
196+
lines.append(f"Limitations: {'; '.join(pmc.limitations)}")
197+
lines.append(f"dry_lab_only: {pmc.dry_lab_only}")
198+
return "\n".join(lines)

0 commit comments

Comments
 (0)