Skip to content

Commit 523f79e

Browse files
cschanhniemOpenCode
andauthored
feat: Phase Y Y5 phase Y accountability gate schema (YAG-) -- top-level gate asserting CBR+FIA+SDA+PMC; closes Phase Y baseline accountability loop (#858) (#1017)
REQUIRED_Y_COMPONENTS=(CBR,FIA,SDA,PMC), VALID_YAG_VERDICTS (3: accountability_verified/accountability_partial/accountability_not_established). YComponentCheck helper; verdict: accountability_verified (all 4), accountability_partial (2-3), accountability_not_established (0-1). Each artifact_id prefix-validated (CBR-/FIA-/SDA-/PMC-); dry_lab_only=True. 54 tests; BASELINE updated 10710->10764. Completes Phase Y. Co-authored-by: OpenCode <opencode@example.com>
1 parent 5e60a3c commit 523f79e

4 files changed

Lines changed: 469 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
@@ -304,4 +304,4 @@ Track and publish structured comparisons between pipeline selections and cheap b
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 |
306306
| 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 |
307-
| 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 |
307+
| Y5 | Add Phase Y accountability gate (YAG-) (complete). — src/openamp_foundry/evidence/phase_y_accountability_gate.py: REQUIRED_Y_COMPONENTS=(CBR,FIA,SDA,PMC), VALID_YAG_VERDICTS (3: accountability_verified/accountability_partial/accountability_not_established); YComponentCheck helper; verdict: accountability_verified (all 4), accountability_partial (2-3), accountability_not_established (0-1); artifact_id prefix-validated per component; dry_lab_only=True; 54 tests. Closes Phase Y. | Top-level gate asserting CBR+FIA+SDA+PMC all present; closes Phase Y; no external pilot claim is credible without passing this gate. | C |
Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
"""YAG- Phase Y accountability gate schema.
2+
3+
Top-level gate asserting all four Phase Y accountability components are
4+
present: CBR + FIA + SDA + PMC.
5+
6+
No external pilot claim is credible without passing this gate.
7+
Verdict: accountability_verified / accountability_partial / accountability_not_established.
8+
"""
9+
10+
from __future__ import annotations
11+
12+
from dataclasses import dataclass
13+
14+
REQUIRED_Y_COMPONENTS: tuple[str, ...] = ("CBR", "FIA", "SDA", "PMC")
15+
16+
VALID_YAG_VERDICTS: frozenset[str] = frozenset({
17+
"accountability_verified",
18+
"accountability_partial",
19+
"accountability_not_established",
20+
})
21+
22+
ACCOUNTABILITY_VERIFIED_REQUIRED_PRESENT: int = 4
23+
ACCOUNTABILITY_PARTIAL_MIN_PRESENT: int = 2
24+
25+
26+
@dataclass
27+
class YComponentCheck:
28+
component_type: str
29+
artifact_id: str
30+
present: bool
31+
32+
33+
@dataclass
34+
class PhaseYAccountabilityGate:
35+
yag_id: str
36+
pipeline_version: str
37+
component_checks: list[YComponentCheck]
38+
n_components_present: int
39+
yag_verdict: str
40+
dry_lab_only: bool
41+
limitations: list[str]
42+
created_at: str
43+
44+
45+
def validate_phase_y_accountability_gate(yag: PhaseYAccountabilityGate) -> None:
46+
if not yag.yag_id.startswith("YAG-"):
47+
raise ValueError(f"yag_id must start with 'YAG-': {yag.yag_id!r}")
48+
if not yag.pipeline_version:
49+
raise ValueError("pipeline_version must be non-empty")
50+
if len(yag.component_checks) != len(REQUIRED_Y_COMPONENTS):
51+
raise ValueError(
52+
f"component_checks must have exactly {len(REQUIRED_Y_COMPONENTS)} entries"
53+
)
54+
for check in yag.component_checks:
55+
if check.component_type not in REQUIRED_Y_COMPONENTS:
56+
raise ValueError(
57+
f"component_type {check.component_type!r} not in REQUIRED_Y_COMPONENTS"
58+
)
59+
expected_prefix = f"{check.component_type}-"
60+
if check.artifact_id and not check.artifact_id.startswith(expected_prefix):
61+
raise ValueError(
62+
f"artifact_id {check.artifact_id!r} must start with {expected_prefix!r}"
63+
)
64+
n_present = sum(1 for c in yag.component_checks if c.present)
65+
if yag.n_components_present != n_present:
66+
raise ValueError("n_components_present mismatch")
67+
if yag.yag_verdict not in VALID_YAG_VERDICTS:
68+
raise ValueError(
69+
f"yag_verdict {yag.yag_verdict!r} not in VALID_YAG_VERDICTS"
70+
)
71+
if not yag.dry_lab_only:
72+
raise ValueError("dry_lab_only must be True")
73+
if not yag.limitations:
74+
raise ValueError("limitations must be non-empty")
75+
if not yag.created_at:
76+
raise ValueError("created_at must be non-empty")
77+
78+
79+
def _compute_verdict(n_present: int) -> str:
80+
if n_present >= ACCOUNTABILITY_VERIFIED_REQUIRED_PRESENT:
81+
return "accountability_verified"
82+
if n_present >= ACCOUNTABILITY_PARTIAL_MIN_PRESENT:
83+
return "accountability_partial"
84+
return "accountability_not_established"
85+
86+
87+
def build_phase_y_accountability_gate(
88+
*,
89+
yag_id: str,
90+
pipeline_version: str,
91+
cbr_artifact_id: str = "",
92+
fia_artifact_id: str = "",
93+
sda_artifact_id: str = "",
94+
pmc_artifact_id: str = "",
95+
limitations: list[str],
96+
created_at: str,
97+
) -> PhaseYAccountabilityGate:
98+
"""Build a PhaseYAccountabilityGate.
99+
100+
Pass non-empty artifact_id for each component that is present.
101+
Empty artifact_id means the component is absent (present=False).
102+
"""
103+
checks = [
104+
YComponentCheck(
105+
component_type="CBR",
106+
artifact_id=cbr_artifact_id,
107+
present=bool(cbr_artifact_id),
108+
),
109+
YComponentCheck(
110+
component_type="FIA",
111+
artifact_id=fia_artifact_id,
112+
present=bool(fia_artifact_id),
113+
),
114+
YComponentCheck(
115+
component_type="SDA",
116+
artifact_id=sda_artifact_id,
117+
present=bool(sda_artifact_id),
118+
),
119+
YComponentCheck(
120+
component_type="PMC",
121+
artifact_id=pmc_artifact_id,
122+
present=bool(pmc_artifact_id),
123+
),
124+
]
125+
n_present = sum(1 for c in checks if c.present)
126+
verdict = _compute_verdict(n_present)
127+
yag = PhaseYAccountabilityGate(
128+
yag_id=yag_id,
129+
pipeline_version=pipeline_version,
130+
component_checks=checks,
131+
n_components_present=n_present,
132+
yag_verdict=verdict,
133+
dry_lab_only=True,
134+
limitations=limitations,
135+
created_at=created_at,
136+
)
137+
validate_phase_y_accountability_gate(yag)
138+
return yag
139+
140+
141+
def format_phase_y_accountability_gate(yag: PhaseYAccountabilityGate) -> str:
142+
lines = [
143+
f"Phase Y Accountability Gate — {yag.yag_id}",
144+
f"Pipeline: {yag.pipeline_version}",
145+
f"Verdict: {yag.yag_verdict}",
146+
f"Components present: {yag.n_components_present}/{len(REQUIRED_Y_COMPONENTS)}",
147+
]
148+
lines.append("Component checks:")
149+
for check in yag.component_checks:
150+
status = "PRESENT" if check.present else "ABSENT"
151+
artifact = f" [{check.artifact_id}]" if check.artifact_id else ""
152+
lines.append(f" {check.component_type}: {status}{artifact}")
153+
lines.append(f"Created: {yag.created_at}")
154+
lines.append(f"Limitations: {'; '.join(yag.limitations)}")
155+
lines.append(f"dry_lab_only: {yag.dry_lab_only}")
156+
return "\n".join(lines)

0 commit comments

Comments
 (0)