Merge phase/06-regression-capability — v1.16.6 (v1.17 P6 regression capability complete)
This commit is contained in:
@@ -566,6 +566,61 @@ def _check_cap_022_oidc_role() -> Tuple[Status, str]:
|
||||
return _check_lifecycle_module_terraform("iam-role")
|
||||
|
||||
|
||||
def _check_cap_023_metrics_collector() -> Tuple[Status, str]:
|
||||
"""CAP-023: metrics collector runs and emits the expected schema (v1.17).
|
||||
|
||||
Verifies that core/metrics/collector.py imports cleanly, the SQLite
|
||||
cold store initializes, and the fact/dim tables exist.
|
||||
"""
|
||||
import importlib
|
||||
try:
|
||||
mod = importlib.import_module("core.metrics.collector")
|
||||
mod._init_store()
|
||||
import sqlite3, os
|
||||
db_path = mod._STORE_PATH
|
||||
if not os.path.isfile(db_path):
|
||||
return "Skipped", "metrics collector init skipped (no store)"
|
||||
conn = sqlite3.connect(db_path)
|
||||
tables = [r[0] for r in conn.execute("SELECT name FROM sqlite_master WHERE type='table'").fetchall()]
|
||||
conn.close()
|
||||
required = {"fact_run", "fact_capability", "fact_decision", "dim_capability"}
|
||||
missing = required - set(tables)
|
||||
if missing:
|
||||
return "Broken", f"metrics store missing tables: {missing}"
|
||||
return "Verified", "metrics collector runs; fact/dim tables present"
|
||||
except Exception as exc:
|
||||
return "Broken", f"metrics collector import/init failed: {exc}"
|
||||
|
||||
|
||||
def _check_cap_024_deck_structure() -> Tuple[Status, str]:
|
||||
"""CAP-024: unified deck structure (v1.17).
|
||||
|
||||
Verifies the unified deck source of truth exists, has 12-20 slides
|
||||
(## Slide N), has the x3 arc (arc preview + recap), and per-slide
|
||||
benefit callouts.
|
||||
"""
|
||||
import os
|
||||
deck_path = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
|
||||
"docs", "presentations", "nova-no-humans-platform.md")
|
||||
if not os.path.isfile(deck_path):
|
||||
return "Skipped", "unified deck not found"
|
||||
with open(deck_path) as f:
|
||||
content = f.read()
|
||||
slide_count = content.count("## Slide ")
|
||||
if slide_count < 12 or slide_count > 20:
|
||||
return "Broken", f"deck has {slide_count} slides (expected 12-20)"
|
||||
has_arc_preview = "Arc Preview" in content
|
||||
has_recap = "Recap + Ask" in content
|
||||
has_benefit = content.count("Benefit:") >= 10
|
||||
if not (has_arc_preview and has_recap and has_benefit):
|
||||
missing = []
|
||||
if not has_arc_preview: missing.append("arc preview")
|
||||
if not has_recap: missing.append("recap+ask")
|
||||
if not has_benefit: missing.append("per-slide benefit callouts")
|
||||
return "Broken", f"deck missing: {missing}"
|
||||
return "Verified", f"deck has {slide_count} slides, x3 arc present, per-slide benefits present"
|
||||
|
||||
|
||||
# Registry: ordered, each entry is (capability_id, name, tier, check_fn).
|
||||
# Phase 52 seeds this with 10 local-tier checks; Phase 54 expands it to
|
||||
# cover every v1.1->v1.8 advertised capability and adds the live-AWS tier
|
||||
@@ -615,6 +670,10 @@ CAPABILITY_REGISTRY: List[Tuple[str, str, str, Callable[[], Tuple[Status, str]]]
|
||||
_check_cap_021_uptime),
|
||||
("CAP-022", "OIDC role (L1 iam-role lifecycle evidence)", "lifecycle-pipeline",
|
||||
_check_cap_022_oidc_role),
|
||||
("CAP-023", "metrics collector runs + emits expected schema", "local",
|
||||
_check_cap_023_metrics_collector),
|
||||
("CAP-024", "unified deck structure (slide count, x3, per-slide benefits)", "local",
|
||||
_check_cap_024_deck_structure),
|
||||
]
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
"""Tests for CAP-023 (metrics collector) + CAP-024 (deck structure) (P6, REQ-198)."""
|
||||
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
ROOT = Path(__file__).resolve().parent.parent
|
||||
sys.path.insert(0, str(ROOT))
|
||||
|
||||
|
||||
def test_cap_023_metrics_collector():
|
||||
"""CAP-023: metrics collector runs and emits the expected schema."""
|
||||
from core.regression_verify import _check_cap_023_metrics_collector
|
||||
status, detail = _check_cap_023_metrics_collector()
|
||||
assert status in ("Verified", "Skipped"), f"CAP-023 {status}: {detail}"
|
||||
|
||||
|
||||
def test_cap_024_deck_structure():
|
||||
"""CAP-024: unified deck has correct structure (slide count, x3, benefits)."""
|
||||
from core.regression_verify import _check_cap_024_deck_structure
|
||||
status, detail = _check_cap_024_deck_structure()
|
||||
assert status in ("Verified", "Skipped"), f"CAP-024 {status}: {detail}"
|
||||
|
||||
|
||||
def test_cap_024_deck_exists():
|
||||
"""The unified deck source of truth exists."""
|
||||
deck_path = ROOT / "docs" / "presentations" / "nova-no-humans-platform.md"
|
||||
assert deck_path.exists(), "unified deck not found"
|
||||
|
||||
|
||||
def test_cap_024_old_decks_retired():
|
||||
"""The old decks are retired (D-130)."""
|
||||
old_decks = [
|
||||
ROOT / "docs" / "presentations" / "how-the-platform-works.md",
|
||||
ROOT / "docs" / "presentations" / "the-developer-experience.md",
|
||||
]
|
||||
for deck in old_decks:
|
||||
assert not deck.exists(), f"old deck not retired: {deck}"
|
||||
Reference in New Issue
Block a user