feat(programs): open Domain Knowledge Program v1 — 7-stage production line + per-domain KPI

The real bottleneck is domain MODELLING. Phase B is organized as one program with sub-programs per
domain, each run through the SAME 7-stage production line. No new runtime framework, no new module
(ADR-009, Freeze v1.0) — only program data + a derived reporting view.

- Customer enters by INDUSTRY, not regulation: Industry -> Domain Model -> Requirement Sources ->
  Requirements -> Capabilities -> ... -> Completeness.
- 7-stage checklist identical for every domain (Domain Model / Requirement Sources / Capability
  Registry / Transition Patterns / Playbooks / Reference Scenarios / Completeness) with per-stage
  ownership. README generalized to the framework.
- Each domain lists typical_requirement_sources + typical_certifications -> pre-onboarding capability
  HYPOTHESIS (the ETO insight; feeds Company 2A as inferred, never confirmed).
- Backlog v1 (by customer value): 1 Industrial Automation, 2 Environmental, 3 Automotive, 4 Medical,
  5 Energy. Five domain-definition shells (environmental restructured to the unified shape, law-first
  preserved).
- Per-domain KPI is DERIVED from the real corpus (computed-not-stored; sources modelled / transition
  patterns / playbooks / reference scenarios), NOT a curated number. Reference suite renders maturity
  bars: Industrial Automation 43% (3/7 sources) leads, Environmental 0% (work ahead). Backlog (value)
  and KPI (corpus state) are deliberately separated.
- ADR-009: Domain Knowledge Program framework. Honest known refinement: regulation-ID normalization
  (CRA vs Cyber Resilience Act) aliased in the KPI.

7 program-contract tests (backlog order + industry-first + derived-not-stored), check-loc 0.
Knowledge data + ADR + reference harness = non-runtime -> no deploy (ADR-001).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Benjamin Admin
2026-06-27 18:49:06 +02:00
parent c737e1ad7d
commit 1a9439d013
10 changed files with 312 additions and 159 deletions
@@ -1,8 +1,9 @@
"""Characterization test for the Environmental Knowledge Program definition (data, not code).
"""Characterization tests for the Domain Knowledge Program v1 backlog (data, not code).
Pins the LAW-FIRST contract: the domain is ordered Corpus(B1) -> Capabilities(B2) -> Transition(B3),
not the reverse; ownership is assigned per stage; B3 (ISO 14001 -> corpus) is blocked until both sides
exist. If a future edit reverses the order or drops an owner, this test fails.
Pins the program FRAMEWORK contract: a ranked backlog of domain definitions, each entered by INDUSTRY
with its typical requirement sources + a pre-onboarding capability hypothesis (typical_certifications).
Industrial Automation is rank 1. Environmental stays law-first. If a future edit reorders the backlog,
drops a source list, or reverts environmental to an ISO-first framing, these tests fail.
"""
from __future__ import annotations
@@ -11,45 +12,60 @@ import os
import yaml
_PROG = os.path.join(os.path.dirname(__file__), "..", "knowledge", "programs", "environmental.yaml")
_DIR = os.path.join(os.path.dirname(__file__), "..", "knowledge", "programs")
def _program():
with open(_PROG, encoding="utf-8") as f:
return yaml.safe_load(f)
def _programs():
out = {}
for f in sorted(os.listdir(_DIR)):
if f.endswith(".yaml"):
with open(os.path.join(_DIR, f), encoding="utf-8") as h:
p = yaml.safe_load(h)
out[p["id"]] = p
return out
def test_blueprint_is_the_reusable_production_line():
p = _program()
assert p["blueprint"] == ["corpus", "obligations", "capabilities", "transition_patterns",
"playbooks", "reference_scenarios", "completeness"]
def test_five_domains_ranked_backlog():
ranks = sorted(p["backlog_rank"] for p in _programs().values())
assert ranks == [1, 2, 3, 4, 5]
def test_stages_are_law_first_in_order():
stages = _program()["stages"]
assert [s["id"] for s in stages] == ["B1", "B2", "B3"] # corpus -> capabilities -> transition
assert "Corpus" in stages[0]["name"] and "Transition" in stages[2]["name"]
def test_industrial_automation_is_rank_1():
progs = _programs()
rank1 = [p for p in progs.values() if p["backlog_rank"] == 1]
assert len(rank1) == 1 and rank1[0]["id"] == "PROG-industrial-automation"
assert {"CRA", "MaschinenVO"} <= set(rank1[0]["typical_requirement_sources"])
def test_ownership_assigned_per_stage():
by = {s["id"]: s for s in _program()["stages"]}
assert "Legal Knowledge" in by["B1"]["owner"] # corpus + obligations
assert "Compliance Execution" in by["B2"]["owner"] # capability model
assert "Reasoning" in by["B3"]["owner"] # transition patterns
def test_every_domain_entered_by_industry_with_sources_and_hypothesis():
for p in _programs().values():
assert p.get("industry") and p.get("customer_entry") # industry-first entry
assert p["typical_requirement_sources"] # stage 2 defined
assert p["typical_certifications"] # pre-onboarding capability hypothesis (ETO)
def test_transition_is_blocked_until_both_sides_known():
b3 = {s["id"]: s for s in _program()["stages"]}["B3"]
assert b3["status"] == "blocked"
assert b3["depends_on"] == ["B1", "B2"] # built LAST (law-first)
def test_no_stored_stage_status_progress_is_derived():
# the 7-stage progress is computed-not-stored: program shells must NOT hard-code stage status
for p in _programs().values():
assert "stages" not in p
def test_b1_covers_the_six_environmental_areas():
b1 = {s["id"]: s for s in _program()["stages"]}["B1"]
assert set(b1["areas"]) == {"water", "chemicals", "emissions", "energy", "waste", "product_responsibility"}
def test_environmental_stays_law_first():
env = _programs()["PROG-environmental"]
assert "ISO 14001 ist KEIN Umweltrecht" in env["principle"]
assert set(env["typical_requirement_sources"]) == {"water", "chemicals", "emissions", "energy", "waste", "product_responsibility"}
def test_program_is_a_domain_not_an_iso_project():
p = _program()
assert "Umweltanforderungen" in p["customer_question"] # starts from the law, not ISO 14001
assert "ISO 14001 ist KEIN Umweltrecht" in p["principle"]
def test_automotive_and_medical_present():
progs = _programs()
assert "TISAX" in progs["PROG-automotive"]["typical_requirement_sources"]
assert "MDR" in progs["PROG-medical"]["typical_requirement_sources"]
def test_readme_documents_seven_stage_checklist():
with open(os.path.join(_DIR, "README.md"), encoding="utf-8") as h:
readme = h.read()
for stage in ["Domain Model", "Requirement Sources", "Capability Registry",
"Transition Patterns", "Playbooks", "Reference Scenarios", "Completeness"]:
assert stage in readme
assert "Industrial Automation" in readme # backlog #1 documented