Files
breakpilot-compliance/backend-compliance/tests/test_mcap_convergence_analysis.py
T
Benjamin Admin c160bb8291 feat: Cross-Domain MCAP Convergence Analysis — which capabilities carry the system (Phase Ω pause)
After Automotive, pause on domains and ask the deeper question: not "which MCAPs occur most often?"
(frequency deceives) but "which MCAPs CARRY the largest part of the system?". A deterministic MCAP
Impact Score (no AI) aggregates over the EXISTING data only:

  Impact = distinct Sources + Target Types + Domains + Journeys + Regulatory + Business Leverage

Critically anti-frequency-deception: a `likely_covered` cap is attributed to its source CERT (one
source), not to every target regulation — otherwise generic management caps win on raw frequency.
With that fix the Core surfaces the true cross-cutting nodes: secure_signed_update_distribution (18),
technical_vulnerability_management (17), access_control, incident_management, sbom_creation,
product_cyber_risk_assessment — exactly the bridges the user predicted; the high-frequency single-
domain environmental management caps correctly drop out.

Four reports, pure aggregation (no runtime, no new architecture): Core (highest impact), Emerging
(>=2 domains), Isolated (1 source/journey — specialised or convergence-not-yet-seen), Suspicious
(too coarse: generic verbs; too fine: hyper-specific isolated names) — an abstraction-level review
tool for domain experts. 11/62 caps already reach impact >=8; the method is ready to reveal whether a
30-50 MCAP core forms as Medical/Payment arrive. Non-runtime -> no deploy. 5 tests pass, check-loc 0.
2026-06-28 11:48:04 +02:00

65 lines
2.2 KiB
Python

"""Cross-Domain MCAP Convergence Analysis — impact over frequency (Phase Ω pause).
Pins the deterministic MCAP Impact analysis and, critically, the anti-frequency-deception property:
a capability that bridges many target TYPES / domains / journeys (secure_signed_update_distribution)
must outrank a high-frequency single-domain management cap (conduct_internal_environmental_audits).
Four reports (Core / Emerging / Isolated / Suspicious), pure aggregation over existing data, no runtime.
"""
from __future__ import annotations
import os
import subprocess
import sys
def _run():
root = os.path.join(os.path.dirname(__file__), "..")
r = subprocess.run(
[sys.executable, "reference_scenarios/mcap_convergence_analysis.py"],
cwd=root, env={**os.environ, "PYTHONPATH": "."}, capture_output=True, text=True,
)
assert r.returncode == 0, r.stderr
return r.stdout
def _section(out, header):
start = out.index(header)
nxt = out.find("\n## ", start + 1)
return out[start: nxt if nxt != -1 else len(out)]
def test_runs_end_to_end():
out = _run()
assert "Cross-Domain MCAP Convergence Analysis" in out
assert "Impact = distinct Sources" in out
def test_core_is_cross_cutting_not_frequency():
out = _run()
core = _section(out, "## 1. Core MCAPs")
# the most cross-cutting capability tops the Core report
assert "`secure_signed_update_distribution` | **18** |" in core
assert "technical_vulnerability_management" in core
# a high-frequency BUT single-domain management cap must NOT be in Core (frequency != impact)
assert "conduct_internal_environmental_audits" not in core
def test_all_four_reports_present():
out = _run()
for header in ["## 1. Core MCAPs", "## 2. Emerging MCAPs", "## 3. Isolated MCAPs", "## 4. Suspicious MCAPs"]:
assert header in out
def test_isolated_and_suspicious_are_review_tools():
out = _run()
iso = _section(out, "## 3. Isolated MCAPs")
assert "issue_battery_passport" in iso or "measure_air_emissions" in iso
susp = _section(out, "## 4. Suspicious MCAPs")
assert "zu grob" in susp and "zu fein" in susp
def test_abstraction_level_signal():
out = _run()
assert "richtigen Abstraktionsniveau" in out
assert "Strukturkern" in out