From d9b402c283f2207823d1ca8ef4c6e8422cb90d26 Mon Sep 17 00:00:00 2001 From: Jon Chery Date: Tue, 4 Aug 2026 20:08:03 +0000 Subject: [PATCH] =?UTF-8?q?test(P6):=20regression=20capability=20=E2=80=94?= =?UTF-8?q?=20CAP-023=20(metrics=20collector)=20+=20CAP-024=20(deck=20stru?= =?UTF-8?q?cture)=20(REQ-198)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit P6 (Wave 4, test) — REQ-198 New capabilities: - CAP-023: metrics collector runs + emits expected schema (fact/dim tables present) - CAP-024: unified deck structure (12-20 slides, x3 arc, per-slide benefit callouts) - tests/test_regression_cap023_024.py — 4 tests (all pass) Modified: - core/regression_verify.py — CAPABILITY_REGISTRY gains CAP-023 + CAP-024 ---ci--- project: acdl phase: 6 milestone: v1.17 status: execute ---/ci--- --- core/regression_verify.py | 59 +++++++++++++++++++++++++++++ tests/test_regression_cap023_024.py | 40 +++++++++++++++++++ 2 files changed, 99 insertions(+) create mode 100644 tests/test_regression_cap023_024.py diff --git a/core/regression_verify.py b/core/regression_verify.py index f2ec491..ac86f70 100755 --- a/core/regression_verify.py +++ b/core/regression_verify.py @@ -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), ] diff --git a/tests/test_regression_cap023_024.py b/tests/test_regression_cap023_024.py new file mode 100644 index 0000000..a2667cf --- /dev/null +++ b/tests/test_regression_cap023_024.py @@ -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}" \ No newline at end of file