@sigloch/contracts 9.1.0 → 10.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,6 +3,7 @@ import { SC_RULES, evaluateSCRules } from './schema-quality-rules.js';
3
3
  import { UC_RULES, evaluateUCRules } from './uc-quality-rules.js';
4
4
  import { FC_RULES, evaluateFCRules } from './fchain-quality-rules.js';
5
5
  import { MT_RULES, evaluateMTRules } from './metric-rules.js';
6
+ import { toEvaluableGraph } from './flat-graph.js';
6
7
  import { FM_RULES, evaluateFMRules } from './fmea-rules.js';
7
8
  import { VIEW_RULES, evaluateViewRules } from './view-rules.js';
8
9
  import { CR_RULES, evaluateCRRules } from './cr-quality-rules.js';
@@ -11,33 +12,38 @@ import { AO_RULES, evaluateAORules } from './ao-rules.js';
11
12
  import { BQ_RULES, evaluateBQRules } from './quality-rules.js';
12
13
  import { AF_RULES, evaluateAFRules } from './analysis-freshness-rules.js';
13
14
  /**
14
- * All prescribed rule definitions (single source of truth for the catalog).
15
+ * CR-SM-285: das Profil haengt am KATALOG, nicht am ID-Praefix.
15
16
  *
16
- * CR-SM-235: `domain` reicht mit durch die Grundgesamtheit, ueber die eine Regel feuert.
17
- * Konsumenten, die einen Anteil bilden (`se-steering`s `computeApplicable`), lesen den Nenner
18
- * hier statt eine eigene Tabelle zu fuehren. Eine zweite Tabelle kann nicht hinterherhinken,
19
- * wenn es keine zweite gibt.
17
+ * Bis hierher ordnete `SE_PREFIXES`/`CODING_PREFIXES` eine Regel ueber den Anfang ihrer ID zu.
18
+ * Drei dokumentierte Ausfaelle derselben Klasse: `RD-` (CR-SM-221 `'RD-01'.startsWith('R-')`
19
+ * ist false, die Zerlegungsregeln liefen nie im se-Profil), `MS-` (CR-SM-245 fehlte in BEIDEN
20
+ * Listen, die Dimension `ms` hatte im se-Profil keine einzige zaehlende Regel), `BW-`
21
+ * (CR-SM-283). Jede neue Regel-ID war ein potenzieller vierter.
22
+ *
23
+ * Ein Katalog weiss, wozu er gehoert; eine Zeichenkette weiss es nicht. Neue Regeln erben das
24
+ * Profil ihres Katalogs automatisch — und ein NEUER Katalog muss hier eingetragen werden, sonst
25
+ * bricht `ALL_RULE_DEFS` schon beim Typcheck (jeder Eintrag braucht sein Profil).
20
26
  */
21
- export const ALL_RULE_DEFS = [
22
- ...V3_RULES, ...UC_RULES, ...FC_RULES, ...SC_RULES, ...MT_RULES, ...BQ_RULES,
23
- ...ND_RULES, ...CR_RULES, ...AO_RULES, ...FM_RULES, ...VIEW_RULES, ...AF_RULES,
24
- ].map(r => ({ id: r.id, name: r.name, severity: r.severity, domain: r.domain }));
25
- // CR-SM-221: 'RD-' was missing — 'RD-01'.startsWith('R-') is false, so the
26
- // decomposition rules ran in `default` only and never in the `se` profile.
27
- // CR-SM-245: 'MS-' fehlte hier UND in CODING_PREFIXES — MS-01/02/03 fielen aus beiden Profilen
28
- // und liefen nur im 'default'-Lauf. Die Dimension `ms` wird von genau vier Regeln getragen
29
- // (MS-01/02/03 + AF-05); AF-05 ist eine `domain: ['graph']`-Regel und traegt per CR-SM-239
30
- // keinen Nenner bei. Im se-Profil hatte `ms` damit keine einzige zaehlende Regel — ein leerer
31
- // Topic-Score und drei fehlende SRR-Legs. Zweiter Fall derselben Klasse nach 'RD-' (CR-SM-221),
32
- // jetzt vom Profil-Test in se-grammar-invariant.test.ts abgedeckt.
33
- const SE_PREFIXES = ['R-', 'RD-', 'UC-', 'FC-', 'SC-', 'MT-', 'CR-', 'AO-', 'FM-', 'NFR-', 'RT-', 'PH-', 'CA-', 'IO-', 'VR-', 'CL-', 'AF-', 'MS-'];
34
- const CODING_PREFIXES = ['BQ-', 'ND-'];
27
+ const CATALOGS = [
28
+ { profile: 'se', rules: V3_RULES },
29
+ { profile: 'se', rules: UC_RULES },
30
+ { profile: 'se', rules: FC_RULES },
31
+ { profile: 'se', rules: SC_RULES },
32
+ { profile: 'se', rules: MT_RULES },
33
+ { profile: 'se', rules: CR_RULES },
34
+ { profile: 'se', rules: AO_RULES },
35
+ { profile: 'se', rules: FM_RULES },
36
+ { profile: 'se', rules: VIEW_RULES },
37
+ { profile: 'se', rules: AF_RULES },
38
+ // Sprach-/Textqualitaet statt SE-Struktur das ist die Trennlinie, die die Praefixliste meinte.
39
+ { profile: 'coding', rules: BQ_RULES },
40
+ { profile: 'coding', rules: ND_RULES },
41
+ ];
42
+ export const ALL_RULE_DEFS = CATALOGS.flatMap(({ profile, rules }) => rules.map(r => ({ id: r.id, name: r.name, severity: r.severity, domain: r.domain, profile })));
35
43
  export function getRuleDefsForProfile(profile) {
36
- if (profile === 'se')
37
- return ALL_RULE_DEFS.filter(r => SE_PREFIXES.some(p => r.id.startsWith(p)));
38
- if (profile === 'coding')
39
- return ALL_RULE_DEFS.filter(r => CODING_PREFIXES.some(p => r.id.startsWith(p)));
40
- return ALL_RULE_DEFS;
44
+ if (profile === 'default')
45
+ return ALL_RULE_DEFS;
46
+ return ALL_RULE_DEFS.filter(r => r.profile === profile);
41
47
  }
42
48
  /**
43
49
  * Evaluate all rules against a graph. Single call replaces the individual evaluator calls.
@@ -47,6 +53,16 @@ export function getRuleDefsForProfile(profile) {
47
53
  * `DEFAULT_METRIC_POLICY` sichtbar an der Aufrufstelle.
48
54
  */
49
55
  export function evaluateAllRules(graph, policy) {
56
+ // CR-SM-284: die Hebung der flach committeten SSOT laeuft HIER, nicht beim Aufrufer.
57
+ //
58
+ // `toEvaluableGraph` gibt es seit CR-SM-258 — und sie wurde von keinem Produktionspfad und
59
+ // keinem Messskript gerufen, nur aus Tests. Eine Korrektur, die man rufen DARF statt MUSS, ist
60
+ // keine: an graphcode erzeugte die flache Lesart 158 Phantom-Befunde (R-19 124, R-20 115,
61
+ // R-26 36, CR-R04 42) und verdeckte zugleich 156 ECHTE Fehler (CR-R02, severity error).
62
+ //
63
+ // Idempotent und identitaetserhaltend (s. dort), also eine Normalisierung am einzigen Eingang
64
+ // und kein Fallback: ein bereits genesteter Graph geht unveraendert und uneingepackt durch.
65
+ graph = toEvaluableGraph(graph);
50
66
  return [
51
67
  ...evaluateRules(graph, policy),
52
68
  ...evaluateBQRules(graph, policy),
@@ -4,7 +4,6 @@
4
4
  import type { OntologyGraph } from './ontology.js';
5
5
  import type { RuleDefinition, RuleViolation } from './rules.js';
6
6
  import type { MetricPolicy } from './policy.js';
7
- export declare function fc01ActorBoundary(graph: OntologyGraph): RuleViolation[];
8
7
  export declare function fc02LeafUcHasFchain(graph: OntologyGraph): RuleViolation[];
9
8
  export declare function fc03FchainFlat(graph: OntologyGraph): RuleViolation[];
10
9
  export declare function fc04ActorBounded(graph: OntologyGraph): RuleViolation[];
@@ -1,48 +1,5 @@
1
1
  import { indexOf } from './graph-index.js';
2
2
  // ---------------------------------------------------------------------------
3
- // FC-01: FCHAIN must have Actor boundary (input or output via FLOW→ACTOR io)
4
- // ---------------------------------------------------------------------------
5
- export function fc01ActorBoundary(graph) {
6
- // CR-SM-264: dieselbe Frage, einmal statt je Kette neu.
7
- //
8
- // Die alte Fassung war die verschachtelte Form, die UC-02 kubisch gemacht hat (CR-SM-261):
9
- // je FCHAIN alle Traces, darin je io-Kante noch einmal alle Traces, darin je Treffer alle
10
- // Elemente — `FCHAIN x FUNC x T x T x E`. Im Profil nach Teil a war FC-01 mit 6,3 % die
11
- // teuerste FCHAIN-Regel.
12
- //
13
- // Beide Zweige fragen in Wahrheit DASSELBE: "beruehrt dieses Element eine io-Kante, deren
14
- // anderes Ende ein ACTOR ist?" Einmal fuer den Zwischenknoten der Kettenglieder, einmal
15
- // direkt fuer den Eltern-UC. Eine Menge beantwortet beide.
16
- const idx = indexOf(graph);
17
- const actorAdjacent = new Set();
18
- for (const t of idx.tracesOfType('io')) {
19
- if (idx.typeOf(t.target) === 'ACTOR')
20
- actorAdjacent.add(t.source);
21
- if (idx.typeOf(t.source) === 'ACTOR')
22
- actorAdjacent.add(t.target);
23
- }
24
- return idx.elementsOfType('FCHAIN')
25
- .filter(fc => {
26
- // Mitglieder der Kette — bewusst OHNE Typfilter, wie in der alten Fassung: FC-01 fragt
27
- // nach dem, was komponiert ist, nicht nach dem, was eine FUNC ist (FC-03 tut das).
28
- const memberIds = idx.out(fc.id, 'compose').map(t => t.target);
29
- const hasActorIO = memberIds.some(fid => idx.out(fid, 'io').some(t => actorAdjacent.has(t.target)) ||
30
- idx.in(fid, 'io').some(t => actorAdjacent.has(t.source)));
31
- // Der Umweg ueber den Eltern-UC: dessen eigene ACTOR-io zaehlt auch.
32
- const parentUC = idx.in(fc.id, 'compose').find(t => idx.typeOf(t.source) === 'UC');
33
- const hasDirectActorIO = parentUC !== undefined && actorAdjacent.has(parentUC.source);
34
- return !hasActorIO && !hasDirectActorIO;
35
- })
36
- .map(fc => ({
37
- rule_id: 'FC-01',
38
- severity: 'warning',
39
- element_id: fc.id,
40
- message: `${fc.id} has no actor boundary (no ACTOR io connection)`,
41
- fix_hint: 'Ensure at least one FUNC in the chain connects to an ACTOR via FLOW io',
42
- context: { element_type: fc.type, element_name: fc.name },
43
- }));
44
- }
45
- // ---------------------------------------------------------------------------
46
3
  // FC-02: Leaf UC (no UC→compose→UC) must have at least one FCHAIN
47
4
  // ---------------------------------------------------------------------------
48
5
  export function fc02LeafUcHasFchain(graph) {
@@ -142,7 +99,6 @@ export function fc04ActorBounded(graph) {
142
99
  // Aggregated
143
100
  // ---------------------------------------------------------------------------
144
101
  export const FC_RULES = [
145
- { id: 'FC-01', name: 'FCHAIN has actor boundary', severity: 'warning', evaluate: fc01ActorBoundary, domain: ['FCHAIN'] },
146
102
  { id: 'FC-02', name: 'Leaf UC has FCHAIN', severity: 'warning', evaluate: fc02LeafUcHasFchain, domain: ['UC'] },
147
103
  // CR-SM-243: domain ist FUNC, nicht FCHAIN — die Regel meldet am FUNC mit der
148
104
  // verschachtelten Zerlegung. Die FCHAIN ist der Suchraum, nicht die Grundgesamtheit:
@@ -1,3 +1,11 @@
1
1
  import type { OntologyGraph } from './ontology.js';
2
- /** Hebt eine flach committete SSOT in die Form, die der Live-Gate dem Evaluator gibt. */
2
+ /**
3
+ * Hebt eine flach committete SSOT in die Form, die der Live-Gate dem Evaluator gibt.
4
+ *
5
+ * CR-SM-284: **identitaetserhaltend.** War nichts zu heben — der Normalfall, weil der Live-Gate
6
+ * bereits genestet liefert —, kommt DIESELBE Referenz zurueck. Das ist die Voraussetzung dafuer,
7
+ * dass `evaluateAllRules` die Funktion selbst rufen kann: die WeakMap-Caches der Familie
8
+ * (`indexOf`, `moduleCrossings`, `MEASURE_CACHE`) haengen an der Graph-Identitaet, und ein bei
9
+ * jedem Aufruf neu gebautes Objekt haette sie im Best-of-N-Loop bei jedem Kandidaten gesprengt.
10
+ */
3
11
  export declare function toEvaluableGraph(graph: OntologyGraph): OntologyGraph;
@@ -42,11 +42,20 @@ function nestAttributes(entry, canonical) {
42
42
  attributes.status = entry.status;
43
43
  return { ...top, attributes };
44
44
  }
45
- /** Hebt eine flach committete SSOT in die Form, die der Live-Gate dem Evaluator gibt. */
45
+ /**
46
+ * Hebt eine flach committete SSOT in die Form, die der Live-Gate dem Evaluator gibt.
47
+ *
48
+ * CR-SM-284: **identitaetserhaltend.** War nichts zu heben — der Normalfall, weil der Live-Gate
49
+ * bereits genestet liefert —, kommt DIESELBE Referenz zurueck. Das ist die Voraussetzung dafuer,
50
+ * dass `evaluateAllRules` die Funktion selbst rufen kann: die WeakMap-Caches der Familie
51
+ * (`indexOf`, `moduleCrossings`, `MEASURE_CACHE`) haengen an der Graph-Identitaet, und ein bei
52
+ * jedem Aufruf neu gebautes Objekt haette sie im Best-of-N-Loop bei jedem Kandidaten gesprengt.
53
+ */
46
54
  export function toEvaluableGraph(graph) {
47
- return {
48
- ...graph,
49
- elements: graph.elements.map((e) => nestAttributes(e, TOP_LEVEL_ELEMENT_KEYS)),
50
- traces: graph.traces.map((t) => nestAttributes(t, TOP_LEVEL_TRACE_KEYS)),
51
- };
55
+ const elements = graph.elements.map((e) => nestAttributes(e, TOP_LEVEL_ELEMENT_KEYS));
56
+ const traces = graph.traces.map((t) => nestAttributes(t, TOP_LEVEL_TRACE_KEYS));
57
+ // `nestAttributes` gibt bei bereits genesteten Eintraegen das Original zurueck; sind ALLE
58
+ // unveraendert, war der Graph schon evaluierbar und wird nicht angefasst.
59
+ const untouched = elements.every((e, i) => e === graph.elements[i]) && traces.every((t, i) => t === graph.traces[i]);
60
+ return untouched ? graph : { ...graph, elements, traces };
52
61
  }
@@ -11,14 +11,17 @@
11
11
  */
12
12
  export declare const GRAMMAR_SNAPSHOT: {
13
13
  readonly versions: {
14
- readonly ontology: "8.0.0";
15
- readonly metaModel: "4.0.0";
16
- readonly rules: "9.1.0";
14
+ readonly ontology: "9.0.0";
15
+ readonly metaModel: "5.0.0";
16
+ readonly rules: "19.0.0";
17
17
  };
18
18
  readonly elementTypes: readonly ["ACTOR", "CR", "FCHAIN", "FLOW", "FUNC", "MOD", "MS", "REQ", "SCHEMA", "SYS", "TEST", "UC"];
19
19
  readonly traceTypes: readonly ["allocate", "compose", "io", "relation", "satisfy", "verify"];
20
- readonly patterns: readonly ["ACTOR -io-> FLOW", "CR -relation-> FUNC", "CR -relation-> MOD", "CR -relation-> MS", "CR -relation-> REQ", "CR -relation-> UC", "FCHAIN -compose-> FUNC [1..*]", "FCHAIN -satisfy-> REQ", "FLOW -io-> ACTOR", "FLOW -io-> FUNC", "FLOW -relation-> SCHEMA [0..1]", "FUNC -allocate-> MOD [0..1]", "FUNC -compose-> FUNC [0..*]", "FUNC -io-> FLOW", "FUNC -satisfy-> REQ where target.kinds in {functional,postcondition,precondition}", "MOD -compose-> MOD [0..*]", "MOD -satisfy-> REQ where target.kinds in {mitigation,non-functional,risk}", "MS -compose-> FUNC", "MS -compose-> REQ", "MS -compose-> UC", "MS -relation-> MS label=depends-on", "REQ -compose-> REQ [0..*]", "SYS -compose-> MOD [0..*]", "SYS -compose-> REQ [0..*]", "SYS -compose-> SYS [0..*]", "SYS -compose-> UC [1..*]", "SYS -satisfy-> REQ where target.kinds in {mitigation,non-functional,risk}", "TEST -verify-> REQ", "UC -compose-> FCHAIN [1..*]", "UC -compose-> REQ [1..*]"];
20
+ readonly patterns: readonly ["ACTOR -io-> FLOW", "CR -relation-> FUNC", "CR -relation-> MOD", "CR -relation-> MS", "CR -relation-> REQ", "CR -relation-> UC", "FCHAIN -compose-> FUNC [1..*]", "FCHAIN -satisfy-> REQ", "FLOW -io-> ACTOR", "FLOW -io-> FUNC", "FLOW -relation-> SCHEMA [1]", "FUNC -allocate-> MOD [0..1]", "FUNC -compose-> FUNC [0..*]", "FUNC -io-> FLOW", "FUNC -satisfy-> REQ where target.kinds in {functional,postcondition,precondition}", "MOD -compose-> MOD [0..*]", "MOD -satisfy-> REQ where target.kinds in {mitigation,non-functional,risk}", "MS -compose-> FUNC", "MS -compose-> REQ", "MS -compose-> UC", "MS -relation-> MS label=depends-on", "REQ -compose-> REQ [0..*]", "SYS -compose-> MOD [0..*]", "SYS -compose-> REQ [0..*]", "SYS -compose-> SYS [0..*]", "SYS -compose-> UC [1..*]", "SYS -satisfy-> REQ where target.kinds in {mitigation,non-functional,risk}", "TEST -verify-> REQ", "UC -compose-> FCHAIN [1..*]", "UC -compose-> REQ [1..*]"];
21
+ readonly elementColumns: readonly ["OntologyElement.attributes", "OntologyElement.created_at", "OntologyElement.description", "OntologyElement.id", "OntologyElement.kinds", "OntologyElement.method", "OntologyElement.name", "OntologyElement.status", "OntologyElement.type", "OntologyElement.updated_at", "Trace.attributes", "Trace.created_at", "Trace.label", "Trace.source", "Trace.target", "Trace.type", "Trace.verified_at", "Trace.weight"];
21
22
  readonly attributes: readonly ["CR.rationale: string", "CR.spike: boolean", "CR.status: enum", "FLOW.protocol: string", "FLOW.qos: string", "FUNC.concept: boolean", "FUNC.external: boolean", "FUNC.measuredMs: number", "FUNC.realRef: object", "FUNC.safety_relevant: boolean", "FUNC.sourceFile: string", "FUNC.timingBudgetMs: number", "MOD.concept: boolean", "MOD.external: boolean", "MOD.kind: string", "MOD.path: string", "MOD.realRef: object", "REQ.detection: number", "REQ.occurrence: number", "REQ.severity: number", "SCHEMA.concept: boolean", "SCHEMA.contract: string", "SCHEMA.external: boolean", "SCHEMA.realRef: object", "TEST.concept: boolean", "TEST.sourceFile: string", "TEST.testRefs: array", "UC.operatingMode: string"];
22
- readonly rules: readonly ["AF-01 (warning) domain=[graph]", "AF-02 (warning) domain=[graph]", "AF-03 (warning) domain=[graph]", "AF-04 (warning) domain=[graph]", "AF-05 (warning) domain=[graph]", "AO-D01 (info) domain=[FUNC]", "AO-D03 (info) domain=[FUNC]", "BQ-01 (warning) domain=[REQ]", "BQ-02 (warning) domain=[REQ]", "BQ-04 (warning) domain=[REQ]", "BQ-06 (warning) domain=[REQ]", "BQ-07 (warning) domain=[REQ]", "CA-01 (error) domain=[FUNC]", "CL-01 (warning) domain=[ACTOR]", "CR-01 (warning) domain=[MOD]", "CR-R01 (error) domain=[CR]", "CR-R02 (error) domain=[CR]", "CR-R03 (warning) domain=[all]", "CR-R04 (warning) domain=[CR]", "FC-01 (warning) domain=[FCHAIN]", "FC-02 (warning) domain=[UC]", "FC-03 (warning) domain=[FUNC]", "FC-04 (warning) domain=[FCHAIN]", "FM-01 (warning) domain=[REQ]", "FM-02 (warning) domain=[REQ]", "FM-03 (error) domain=[REQ]", "IO-01 (warning) domain=[FUNC]", "MS-01 (warning) domain=[MS]", "MS-02 (error) domain=[MS]", "MS-03 (info) domain=[CR]", "MT-01 (warning) domain=[MOD]", "MT-02 (info) domain=[MOD]", "ND-01 (error) domain=[FUNC]", "ND-02 (error) domain=[SCHEMA]", "NFR-01 (warning) domain=[FCHAIN,FUNC,MOD]", "PH-01 (info) domain=[MOD]", "R-01 (error) domain=[REQ]", "R-02 (warning) domain=[FUNC]", "R-03 (error) domain=[MOD]", "R-04 (warning) domain=[MOD]", "R-05 (warning) domain=[TEST]", "R-08 (error) domain=[all]", "R-10 (warning) domain=[FLOW]", "R-12 (warning) domain=[FUNC]", "R-14 (warning) domain=[UC]", "R-15 (warning) domain=[FCHAIN]", "R-16 (warning) domain=[ACTOR]", "R-17 (warning) domain=[SYS]", "R-18 (error) domain=[all]", "R-19 (warning) domain=[TEST]", "R-20 (warning) domain=[FUNC]", "R-21 (warning) domain=[FCHAIN]", "R-22 (warning) domain=[FUNC]", "R-23 (warning) domain=[MOD]", "R-26 (warning) domain=[SCHEMA]", "R-27 (warning) domain=[MOD]", "R-29 (error) domain=[TEST]", "R-30 (warning) domain=[FUNC]", "R-31 (warning) domain=[FUNC]", "RD-01 (warning) domain=[REQ]", "RD-02 (warning) domain=[REQ]", "RD-03 (info) domain=[REQ]", "RD-04 (warning) domain=[FUNC,MOD,SYS]", "RT-01 (error) domain=[FUNC]", "SC-02 (warning) domain=[SCHEMA]", "SC-04 (warning) domain=[FLOW]", "UC-01 (error) domain=[UC]", "UC-02 (error) domain=[UC]", "UC-03 (warning) domain=[UC]", "UC-04 (warning) domain=[UC]", "UC-05 (info) domain=[UC]", "UC-06 (info) domain=[UC]", "VR-01 (info) domain=[TEST]"];
23
+ readonly rules: readonly ["AF-01 (warning) domain=[graph]", "AF-02 (warning) domain=[graph]", "AF-03 (warning) domain=[graph]", "AF-04 (warning) domain=[graph]", "AF-05 (warning) domain=[graph]", "BQ-01 (warning) domain=[REQ]", "BQ-02 (warning) domain=[REQ]", "BQ-04 (warning) domain=[REQ]", "BQ-06 (warning) domain=[REQ]", "BQ-07 (warning) domain=[REQ]", "BW-02 (warning) domain=[FUNC]", "CL-01 (warning) domain=[ACTOR]", "CR-01 (warning) domain=[MOD]", "CR-R01 (error) domain=[CR]", "CR-R02 (error) domain=[CR]", "CR-R03 (warning) domain=[all]", "FC-02 (warning) domain=[UC]", "FC-03 (warning) domain=[FUNC]", "FC-04 (warning) domain=[FCHAIN]", "FM-01 (warning) domain=[REQ]", "FM-02 (warning) domain=[REQ]", "FM-03 (error) domain=[REQ]", "IO-01 (warning) domain=[FUNC]", "MS-01 (warning) domain=[MS]", "MS-02 (error) domain=[MS]", "MS-03 (info) domain=[CR]", "MT-01 (warning) domain=[MOD]", "MT-02 (info) domain=[MOD]", "ND-01 (error) domain=[FUNC]", "ND-02 (error) domain=[SCHEMA]", "NFR-01 (warning) domain=[FCHAIN,FUNC,MOD]", "R-01 (error) domain=[REQ]", "R-02 (warning) domain=[FUNC]", "R-04 (warning) domain=[MOD]", "R-05 (warning) domain=[TEST]", "R-08 (error) domain=[all]", "R-10 (warning) domain=[FLOW]", "R-12 (warning) domain=[FUNC]", "R-15 (warning) domain=[FCHAIN]", "R-16 (warning) domain=[ACTOR]", "R-17 (warning) domain=[SYS]", "R-18 (error) domain=[all]", "R-19 (warning) domain=[TEST]", "R-20 (warning) domain=[FUNC]", "R-21 (warning) domain=[FCHAIN]", "R-22 (warning) domain=[FUNC]", "R-23 (warning) domain=[MOD]", "R-26 (warning) domain=[SCHEMA]", "R-29 (error) domain=[TEST]", "R-30 (warning) domain=[FUNC]", "R-31 (warning) domain=[FUNC]", "RD-01 (warning) domain=[REQ]", "RD-02 (warning) domain=[REQ]", "RD-03 (info) domain=[REQ]", "RD-04 (warning) domain=[FUNC,MOD,SYS]", "SC-02 (warning) domain=[SCHEMA]", "UC-01 (error) domain=[UC]", "UC-02 (error) domain=[UC]", "UC-03 (warning) domain=[UC]", "UC-04 (warning) domain=[UC]", "UC-05 (info) domain=[UC]", "UC-06 (info) domain=[UC]", "VR-01 (info) domain=[TEST]"];
23
24
  readonly conformanceRules: readonly ["RC-01 (error)", "RC-02 (error)", "RC-03 (error)", "RC-04 (warning)", "RC-05 (warning)", "RC-06 (warning)"];
25
+ readonly policy: readonly ["apTable = null", "boundaryWidth = {warning:5}", "crossingFlows = {warning:3}", "decompositionBreadth = {warning:9}", "instability = null", "lcom4 = {info:4,warning:6}", "moduleSize = {coupled:7,crossings:2,large:9}", "riskRpn = 100"];
26
+ readonly exports: readonly ["AF_RULES", "ALL_RULE_DEFS", "AO_RULES", "ActionPriority", "AnalysisArtifactId", "AnalysisFreshnessStampSchema", "ApTableSchema", "BOUNDED_PATTERNS", "BQ_RULES", "CODE_CONFORMANCE_RULES", "CR_RULES", "CodeFactsSchema", "DEFAULT_METRIC_POLICY", "DIMENSION_READINESS_DELTA_NAME", "DIMENSION_READINESS_NAME", "ELEMENT_ATTRIBUTES", "ELEMENT_DESCRIPTIONS", "ElementType", "ElementUid", "FC_RULES", "FM_RULES", "FileFactsSchema", "ImportEdgeSchema", "MAX_SLUG_LENGTH", "META_MODEL_VERSION", "MODELING_ELEMENT_TYPES", "MT_RULES", "MetricPolicySchema", "ND_RULES", "ONTOLOGY_VERSION", "OntologyElement", "OntologyGraph", "PHASE_READINESS_NAME", "PhaseGate", "REQUIRED_PATTERNS", "RULES_VERSION", "RULE_TO_DIMENSION", "RULE_TO_PHASE", "ReadinessDimension", "ReadinessReport", "ReadinessScore", "RealRefSchema", "RepoRelativePathSchema", "ReqKind", "RuleSeverity", "RuleViolation", "SC_RULES", "TRACE_PATTERNS", "TestRefSchema", "TestRefsSchema", "TestResult", "Trace", "TraceType", "UC_RULES", "V3_RULES", "VIEW_RULES", "VerificationMethod", "ViolationCandidate", "ViolationContext", "actionPriority", "allocationCohesion", "apMethod", "attributeTypeOf", "bq01Unambiguous", "bq02Verifiable", "bq04Necessary", "bq06Conforming", "bq07Complete", "bw02WhiteboxWidth", "cl01ConopsCompleteness", "cr01CrossingFlowCount", "decomposedFuncs", "evaluateAFRules", "evaluateAORules", "evaluateAllRules", "evaluateBQRules", "evaluateCRRules", "evaluateConformanceRules", "evaluateFCRules", "evaluateFMRules", "evaluateMTRules", "evaluateNDRules", "evaluateRules", "evaluateSCRules", "evaluateUCRules", "evaluateViewRules", "extractFormatE", "fc02LeafUcHasFchain", "fc03FchainFlat", "fc04ActorBounded", "fm01MissingFmeaAttributes", "fm02MissingMitigation", "fm03HighRiskUnverified", "funcSimilarity", "getRuleDefsForProfile", "hydrateAttrValue", "importCoverage", "indexOf", "io01CrossModuleCompleteness", "isElementUid", "isValidTrace", "jaccard", "maxOccurs", "minOccurs", "moduleMetrics", "mt01Instability", "mt02Lcom4", "nd01FuncNearDuplicate", "nd02SchemaNearDuplicate", "nfr01BudgetOvershoot", "normalizeReqKinds", "pairsAbove", "parseElementUid", "parseFormatE", "sc02IsReferenced", "schemaSimilarity", "serializeToFormatE", "setBQ04SimilarityMatrix", "toElementUid", "toEvaluableGraph", "tokens", "traceRejection", "tryParseElementUid", "uc01HasRequirements", "uc02HasActor", "uc03HasScenario", "uc04GoalDefined", "uc05HasPostcondition", "uc06HasPrecondition", "vr01TestNoResult"];
24
27
  };
@@ -11,9 +11,9 @@
11
11
  */
12
12
  export const GRAMMAR_SNAPSHOT = {
13
13
  versions: {
14
- ontology: "8.0.0",
15
- metaModel: "4.0.0",
16
- rules: "9.1.0",
14
+ ontology: "9.0.0",
15
+ metaModel: "5.0.0",
16
+ rules: "19.0.0",
17
17
  },
18
18
  elementTypes: [
19
19
  "ACTOR",
@@ -48,7 +48,7 @@ export const GRAMMAR_SNAPSHOT = {
48
48
  "FCHAIN -satisfy-> REQ",
49
49
  "FLOW -io-> ACTOR",
50
50
  "FLOW -io-> FUNC",
51
- "FLOW -relation-> SCHEMA [0..1]",
51
+ "FLOW -relation-> SCHEMA [1]",
52
52
  "FUNC -allocate-> MOD [0..1]",
53
53
  "FUNC -compose-> FUNC [0..*]",
54
54
  "FUNC -io-> FLOW",
@@ -69,6 +69,26 @@ export const GRAMMAR_SNAPSHOT = {
69
69
  "UC -compose-> FCHAIN [1..*]",
70
70
  "UC -compose-> REQ [1..*]",
71
71
  ],
72
+ elementColumns: [
73
+ "OntologyElement.attributes",
74
+ "OntologyElement.created_at",
75
+ "OntologyElement.description",
76
+ "OntologyElement.id",
77
+ "OntologyElement.kinds",
78
+ "OntologyElement.method",
79
+ "OntologyElement.name",
80
+ "OntologyElement.status",
81
+ "OntologyElement.type",
82
+ "OntologyElement.updated_at",
83
+ "Trace.attributes",
84
+ "Trace.created_at",
85
+ "Trace.label",
86
+ "Trace.source",
87
+ "Trace.target",
88
+ "Trace.type",
89
+ "Trace.verified_at",
90
+ "Trace.weight",
91
+ ],
72
92
  attributes: [
73
93
  "CR.rationale: string",
74
94
  "CR.spike: boolean",
@@ -105,21 +125,17 @@ export const GRAMMAR_SNAPSHOT = {
105
125
  "AF-03 (warning) domain=[graph]",
106
126
  "AF-04 (warning) domain=[graph]",
107
127
  "AF-05 (warning) domain=[graph]",
108
- "AO-D01 (info) domain=[FUNC]",
109
- "AO-D03 (info) domain=[FUNC]",
110
128
  "BQ-01 (warning) domain=[REQ]",
111
129
  "BQ-02 (warning) domain=[REQ]",
112
130
  "BQ-04 (warning) domain=[REQ]",
113
131
  "BQ-06 (warning) domain=[REQ]",
114
132
  "BQ-07 (warning) domain=[REQ]",
115
- "CA-01 (error) domain=[FUNC]",
133
+ "BW-02 (warning) domain=[FUNC]",
116
134
  "CL-01 (warning) domain=[ACTOR]",
117
135
  "CR-01 (warning) domain=[MOD]",
118
136
  "CR-R01 (error) domain=[CR]",
119
137
  "CR-R02 (error) domain=[CR]",
120
138
  "CR-R03 (warning) domain=[all]",
121
- "CR-R04 (warning) domain=[CR]",
122
- "FC-01 (warning) domain=[FCHAIN]",
123
139
  "FC-02 (warning) domain=[UC]",
124
140
  "FC-03 (warning) domain=[FUNC]",
125
141
  "FC-04 (warning) domain=[FCHAIN]",
@@ -135,16 +151,13 @@ export const GRAMMAR_SNAPSHOT = {
135
151
  "ND-01 (error) domain=[FUNC]",
136
152
  "ND-02 (error) domain=[SCHEMA]",
137
153
  "NFR-01 (warning) domain=[FCHAIN,FUNC,MOD]",
138
- "PH-01 (info) domain=[MOD]",
139
154
  "R-01 (error) domain=[REQ]",
140
155
  "R-02 (warning) domain=[FUNC]",
141
- "R-03 (error) domain=[MOD]",
142
156
  "R-04 (warning) domain=[MOD]",
143
157
  "R-05 (warning) domain=[TEST]",
144
158
  "R-08 (error) domain=[all]",
145
159
  "R-10 (warning) domain=[FLOW]",
146
160
  "R-12 (warning) domain=[FUNC]",
147
- "R-14 (warning) domain=[UC]",
148
161
  "R-15 (warning) domain=[FCHAIN]",
149
162
  "R-16 (warning) domain=[ACTOR]",
150
163
  "R-17 (warning) domain=[SYS]",
@@ -155,7 +168,6 @@ export const GRAMMAR_SNAPSHOT = {
155
168
  "R-22 (warning) domain=[FUNC]",
156
169
  "R-23 (warning) domain=[MOD]",
157
170
  "R-26 (warning) domain=[SCHEMA]",
158
- "R-27 (warning) domain=[MOD]",
159
171
  "R-29 (error) domain=[TEST]",
160
172
  "R-30 (warning) domain=[FUNC]",
161
173
  "R-31 (warning) domain=[FUNC]",
@@ -163,9 +175,7 @@ export const GRAMMAR_SNAPSHOT = {
163
175
  "RD-02 (warning) domain=[REQ]",
164
176
  "RD-03 (info) domain=[REQ]",
165
177
  "RD-04 (warning) domain=[FUNC,MOD,SYS]",
166
- "RT-01 (error) domain=[FUNC]",
167
178
  "SC-02 (warning) domain=[SCHEMA]",
168
- "SC-04 (warning) domain=[FLOW]",
169
179
  "UC-01 (error) domain=[UC]",
170
180
  "UC-02 (error) domain=[UC]",
171
181
  "UC-03 (warning) domain=[UC]",
@@ -182,4 +192,146 @@ export const GRAMMAR_SNAPSHOT = {
182
192
  "RC-05 (warning)",
183
193
  "RC-06 (warning)",
184
194
  ],
195
+ policy: [
196
+ "apTable = null",
197
+ "boundaryWidth = {warning:5}",
198
+ "crossingFlows = {warning:3}",
199
+ "decompositionBreadth = {warning:9}",
200
+ "instability = null",
201
+ "lcom4 = {info:4,warning:6}",
202
+ "moduleSize = {coupled:7,crossings:2,large:9}",
203
+ "riskRpn = 100",
204
+ ],
205
+ exports: [
206
+ "AF_RULES",
207
+ "ALL_RULE_DEFS",
208
+ "AO_RULES",
209
+ "ActionPriority",
210
+ "AnalysisArtifactId",
211
+ "AnalysisFreshnessStampSchema",
212
+ "ApTableSchema",
213
+ "BOUNDED_PATTERNS",
214
+ "BQ_RULES",
215
+ "CODE_CONFORMANCE_RULES",
216
+ "CR_RULES",
217
+ "CodeFactsSchema",
218
+ "DEFAULT_METRIC_POLICY",
219
+ "DIMENSION_READINESS_DELTA_NAME",
220
+ "DIMENSION_READINESS_NAME",
221
+ "ELEMENT_ATTRIBUTES",
222
+ "ELEMENT_DESCRIPTIONS",
223
+ "ElementType",
224
+ "ElementUid",
225
+ "FC_RULES",
226
+ "FM_RULES",
227
+ "FileFactsSchema",
228
+ "ImportEdgeSchema",
229
+ "MAX_SLUG_LENGTH",
230
+ "META_MODEL_VERSION",
231
+ "MODELING_ELEMENT_TYPES",
232
+ "MT_RULES",
233
+ "MetricPolicySchema",
234
+ "ND_RULES",
235
+ "ONTOLOGY_VERSION",
236
+ "OntologyElement",
237
+ "OntologyGraph",
238
+ "PHASE_READINESS_NAME",
239
+ "PhaseGate",
240
+ "REQUIRED_PATTERNS",
241
+ "RULES_VERSION",
242
+ "RULE_TO_DIMENSION",
243
+ "RULE_TO_PHASE",
244
+ "ReadinessDimension",
245
+ "ReadinessReport",
246
+ "ReadinessScore",
247
+ "RealRefSchema",
248
+ "RepoRelativePathSchema",
249
+ "ReqKind",
250
+ "RuleSeverity",
251
+ "RuleViolation",
252
+ "SC_RULES",
253
+ "TRACE_PATTERNS",
254
+ "TestRefSchema",
255
+ "TestRefsSchema",
256
+ "TestResult",
257
+ "Trace",
258
+ "TraceType",
259
+ "UC_RULES",
260
+ "V3_RULES",
261
+ "VIEW_RULES",
262
+ "VerificationMethod",
263
+ "ViolationCandidate",
264
+ "ViolationContext",
265
+ "actionPriority",
266
+ "allocationCohesion",
267
+ "apMethod",
268
+ "attributeTypeOf",
269
+ "bq01Unambiguous",
270
+ "bq02Verifiable",
271
+ "bq04Necessary",
272
+ "bq06Conforming",
273
+ "bq07Complete",
274
+ "bw02WhiteboxWidth",
275
+ "cl01ConopsCompleteness",
276
+ "cr01CrossingFlowCount",
277
+ "decomposedFuncs",
278
+ "evaluateAFRules",
279
+ "evaluateAORules",
280
+ "evaluateAllRules",
281
+ "evaluateBQRules",
282
+ "evaluateCRRules",
283
+ "evaluateConformanceRules",
284
+ "evaluateFCRules",
285
+ "evaluateFMRules",
286
+ "evaluateMTRules",
287
+ "evaluateNDRules",
288
+ "evaluateRules",
289
+ "evaluateSCRules",
290
+ "evaluateUCRules",
291
+ "evaluateViewRules",
292
+ "extractFormatE",
293
+ "fc02LeafUcHasFchain",
294
+ "fc03FchainFlat",
295
+ "fc04ActorBounded",
296
+ "fm01MissingFmeaAttributes",
297
+ "fm02MissingMitigation",
298
+ "fm03HighRiskUnverified",
299
+ "funcSimilarity",
300
+ "getRuleDefsForProfile",
301
+ "hydrateAttrValue",
302
+ "importCoverage",
303
+ "indexOf",
304
+ "io01CrossModuleCompleteness",
305
+ "isElementUid",
306
+ "isValidTrace",
307
+ "jaccard",
308
+ "maxOccurs",
309
+ "minOccurs",
310
+ "moduleMetrics",
311
+ "mt01Instability",
312
+ "mt02Lcom4",
313
+ "nd01FuncNearDuplicate",
314
+ "nd02SchemaNearDuplicate",
315
+ "nfr01BudgetOvershoot",
316
+ "normalizeReqKinds",
317
+ "pairsAbove",
318
+ "parseElementUid",
319
+ "parseFormatE",
320
+ "sc02IsReferenced",
321
+ "schemaSimilarity",
322
+ "serializeToFormatE",
323
+ "setBQ04SimilarityMatrix",
324
+ "toElementUid",
325
+ "toEvaluableGraph",
326
+ "tokens",
327
+ "traceRejection",
328
+ "tryParseElementUid",
329
+ "uc01HasRequirements",
330
+ "uc02HasActor",
331
+ "uc03HasScenario",
332
+ "uc04GoalDefined",
333
+ "uc05HasPostcondition",
334
+ "uc06HasPrecondition",
335
+ "vr01TestNoResult",
336
+ ],
185
337
  };
@@ -3,11 +3,11 @@
3
3
  * Single source of truth for SE ontology schemas across all projects.
4
4
  */
5
5
  /** Ontology schema version (element types + trace types). */
6
- export declare const ONTOLOGY_VERSION = "8.0.0";
6
+ export declare const ONTOLOGY_VERSION = "9.0.0";
7
7
  /** Rules engine version (validation rules incl. RC conformance). */
8
- export declare const RULES_VERSION = "9.1.0";
8
+ export declare const RULES_VERSION = "19.0.0";
9
9
  /** Meta-model version (trace pattern constraints + format-e parser). */
10
- export declare const META_MODEL_VERSION = "4.0.0";
10
+ export declare const META_MODEL_VERSION = "5.0.0";
11
11
  export * from './ontology.js';
12
12
  export * from './rules.js';
13
13
  export * from './conformance-rules.js';
@@ -21,6 +21,7 @@ export * from './fmea-rules.js';
21
21
  export * from './view-rules.js';
22
22
  export * from './cr-quality-rules.js';
23
23
  export * from './near-duplicate-rules.js';
24
+ export * from './similarity.js';
24
25
  export * from './ao-rules.js';
25
26
  export * from './quality-rules.js';
26
27
  export * from './analysis-freshness-rules.js';