Files
breakpilot-compliance/backend-compliance/reference_scenarios/architecture_stability_kpi.py
T
Benjamin Admin cefacb87af feat: Architecture Stability + Knowledge Velocity KPI — Phase Ω (Evidence of Generality)
The focus has shifted: no more architecture epics (the Journey Matcher was the last building
block). The question is no longer "can the architecture do this?" but "where does it fail under
real domain knowledge?". This operationalises the two KPIs almost nobody measures, as a non-
runtime, auditable ledger:

  - Architecture Stability : per integrated Requirement Source — new runtime classes? new pipeline?
  - Knowledge Velocity     : can a domain EXPERT integrate a source data-only, without a developer?

A new domain is a ROW in knowledge/architecture_stability/integration_ledger.yaml (data), never a
code change — so the KPI improves by adding data, which IS the proof. Current state: 6 sources
across 5 target types (CRA, MaschinenVO, TISAX, Tender, OEM, Environmental) = 6/6 = 100% stability
and 100% data-only. The pipeline functions are listed honestly as one-time, domain-agnostic
infrastructure (now frozen), so the KPI cannot be gamed.

The test is a LIVING GUARDRAIL: it fails the day a source needs runtime code, surfacing the exact
moment generality breaks. Non-runtime -> no deploy. 5 tests pass, check-loc 0.
2026-06-28 10:49:00 +02:00

84 lines
4.5 KiB
Python

# ruff: noqa
# mypy: ignore-errors
"""Architecture Stability + Knowledge Velocity KPI — Phase Ω (Evidence of Generality).
Not "can the architecture do this?" but "where does it fail under real domain knowledge?". This reads
the integration ledger and computes two KPIs almost nobody measures:
- Architecture Stability : share of integrated Requirement Sources that needed 0 new runtime classes
AND no new pipeline.
- Knowledge Velocity : share of sources a DOMAIN EXPERT could integrate data-only (no developer).
A new domain is a ROW in the ledger (data), never a code change — so this KPI literally improves by
adding data, which is the proof. Non-runtime -> no deploy.
Run: cd backend-compliance && PYTHONPATH=. python3 reference_scenarios/architecture_stability_kpi.py
"""
from __future__ import annotations
import os
import yaml
OUT = []
def w(s=""):
OUT.append(s)
_LEDGER = os.path.join(os.path.dirname(__file__), "..", "knowledge", "architecture_stability", "integration_ledger.yaml")
L = yaml.safe_load(open(_LEDGER, encoding="utf-8"))
sources = L["sources"]
n = len(sources)
stable = [s for s in sources if s["new_runtime_classes"] == 0 and not s["new_pipeline"]]
data_only = [s for s in sources if s["integration_kind"] == "data_only"]
arch_stability = len(stable) / n if n else 0.0
knowledge_velocity = len(data_only) / n if n else 0.0
w("# Architecture Stability + Knowledge Velocity — Phase Ω (Evidence of Generality)")
w("")
w('_Der Fokus hat sich verschoben: nicht mehr „kann die Architektur das?", sondern „wo versagt sie bei echtem Fachwissen?". Diese zwei KPIs erhebt kaum jemand. Eine neue Domäne ist eine ZEILE im Ledger (Daten), nie eine Codeänderung — genau das macht den KPI auditierbar._')
w("")
w("## Architecture Stability — pro integrierter Anforderungsquelle: neue Runtime-Klassen? neue Pipeline?")
w("")
w("| Quelle | Zieltyp | als | neue Runtime-Klassen | neue Pipeline | Ergebnis |")
w("|---|---|---|---:|---:|---|")
for s in sources:
ok = "✅" if (s["new_runtime_classes"] == 0 and not s["new_pipeline"]) else "❌"
w("| %s | %s | %s | %d | %s | %s |" % (
s["source"], s["target_type"], s["integrated_as"], s["new_runtime_classes"],
"ja" if s["new_pipeline"] else "0", ok))
w("")
w("- **Architecture Stability: %d/%d = %d%%** der Quellen ohne neue Runtime-Klasse und ohne neue Pipeline." % (
len(stable), n, round(arch_stability * 100)))
w("- **Knowledge Velocity: %d/%d = %d%%** der Quellen **data-only** integriert (kein Entwickler nötig)." % (
len(data_only), n, round(knowledge_velocity * 100)))
w("")
# pipeline functions = one-time, domain-agnostic infrastructure (honesty: not per-domain costs)
pf = L["pipeline_functions"]
w("## Ehrlichkeit: die Pipeline-Funktionen sind EINMALIG (jetzt eingefroren)")
w("- %d domänen-AGNOSTISCHE Funktionen, einmal gebaut, nicht je Domäne: %s." % (
len(pf), ", ".join("`%s`" % f["fn"] for f in pf)))
w("- Die letzte (`journey_matcher`) war der **letzte architektonische Baustein** (ADR-011). Ab hier: Wissensarbeit, nicht Architektur.")
w("")
# three knowledge layers (the architecture has settled symmetrically)
kl = L["knowledge_layers"]
w("## Drei saubere Wissensebenen (greifen ineinander, vermischen sich nicht)")
w("| Ebene | Inhalt |")
w("|---|---|")
w("| **Beschreibend** (was IST) | %s |" % ", ".join(kl["descriptive"]))
w("| **Transformation** (wie BEWEGEN) | %s |" % ", ".join(kl["transformation"]))
w("| **Produktion** (wie TUN/BEWEISEN) | %s |" % ", ".join(kl["production"]))
w("")
w("## Die drei Erfolgsfragen ab jetzt (statt Coverage)")
w("1. **Musste für eine neue Domäne Runtime-Code geändert werden?** → bisher: **nein** (%d/%d)." % (len(stable), n))
w("2. **Knowledge Velocity** — neues Wissen ohne Entwickler aufnehmbar? → bisher: **ja** (%d/%d data-only)." % (len(data_only), n))
w("3. **Architecture Stability** — bestehende Capability/Journey strukturell ändern oder nur Daten ergänzen? → bisher: **nur Daten**.")
w("")
w('> **Befund:** Über fünf Zielarten und sechs Quellen blieb `Reality → Evidence → Capability → Required → Delta → Journey → Roadmap → Playbooks → Verification` unverändert. Das ist der eigentliche Nachweis: keine Compliance-Architektur, sondern eine allgemeine Requirements-Verifikationsarchitektur, die ihre Generalität UNTER realer fachlicher Belastung behält. Der nächste Test ist nicht ein Feature, sondern die nächste echte Domäne (Umwelt-Cluster · Automotive · Medizintechnik · Payment) — jede als neue Ledger-Zeile, bei stabilem KPI.')
w("")
print("\n".join(OUT))