@sigloch/contracts 6.1.0 → 9.1.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.
- package/dist/se/ao-rules.js +44 -29
- package/dist/se/conformance-rules.d.ts +29 -0
- package/dist/se/conformance-rules.js +107 -17
- package/dist/se/fchain-quality-rules.js +57 -53
- package/dist/se/flat-graph.d.ts +3 -0
- package/dist/se/flat-graph.js +52 -0
- package/dist/se/format-e-parser.d.ts +14 -2
- package/dist/se/format-e-parser.js +33 -9
- package/dist/se/grammar-snapshot.d.ts +7 -6
- package/dist/se/grammar-snapshot.js +17 -16
- package/dist/se/graph-index.d.ts +56 -0
- package/dist/se/graph-index.js +60 -0
- package/dist/se/index.d.ts +5 -3
- package/dist/se/index.js +5 -3
- package/dist/se/meta-model.d.ts +52 -7
- package/dist/se/meta-model.js +108 -14
- package/dist/se/metric-rules.d.ts +8 -0
- package/dist/se/metric-rules.js +95 -23
- package/dist/se/ontology.d.ts +32 -25
- package/dist/se/ontology.js +56 -11
- package/dist/se/quality-rules.js +19 -5
- package/dist/se/readiness.d.ts +4 -2
- package/dist/se/readiness.js +23 -1
- package/dist/se/rules.d.ts +12 -7
- package/dist/se/rules.js +215 -103
- package/dist/se/uc-quality-rules.js +67 -25
- package/package.json +1 -1
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
import { indexOf } from './graph-index.js';
|
|
1
2
|
// ---------------------------------------------------------------------------
|
|
2
3
|
// UC-01: UC must have compose→REQ trace (CR-165: satisfy UC→REQ is invalid per meta-model)
|
|
3
4
|
// ---------------------------------------------------------------------------
|
|
4
5
|
export function uc01HasRequirements(graph) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
// CR-SM-264: compose-Kanten je UC aus dem Index. Vorher ein Vollscan ueber alle Traces je UC,
|
|
7
|
+
// darin ein Vollscan ueber alle Elemente je Treffer — `UC x T x E`.
|
|
8
|
+
const idx = indexOf(graph);
|
|
9
|
+
return idx.elementsOfType('UC')
|
|
10
|
+
.filter(uc => !idx.out(uc.id, 'compose').some(t => idx.typeOf(t.target) === 'REQ'))
|
|
8
11
|
.map(uc => ({
|
|
9
12
|
rule_id: 'UC-01',
|
|
10
13
|
severity: 'error',
|
|
@@ -18,20 +21,56 @@ export function uc01HasRequirements(graph) {
|
|
|
18
21
|
// UC-02: UC FCHAIN must have an ACTOR with io trace
|
|
19
22
|
// ---------------------------------------------------------------------------
|
|
20
23
|
export function uc02HasActor(graph) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
// CR-SM-261: dieselbe Frage, einmal statt je UC neu.
|
|
25
|
+
//
|
|
26
|
+
// Die alte Fassung scannte je UC alle Traces, darin je io-Trace alle ELEMENTE (die
|
|
27
|
+
// ACTOR-Suche) und noch einmal alle Traces (die compose-Suche) — `UC × T × (E + T)`. Das
|
|
28
|
+
// Profil aus CR-SM-260 hat sie mit 50,8 % des gesamten Regellaufs und einem Wachstum von
|
|
29
|
+
// n^3,05 gemessen, kubisch statt quadratisch und damit die teuerste Regel des Katalogs.
|
|
30
|
+
//
|
|
31
|
+
// Die Umkehrung: erst die Menge der io-Ziele bilden, die von einem ACTOR ausgehen (einmal
|
|
32
|
+
// ueber Elemente und Traces), dann je UC nur noch Mitgliedschaft pruefen. Dieselbe Aussage,
|
|
33
|
+
// dieselben Befunde in derselben Reihenfolge — die Iteration ueber `graph.elements` bleibt
|
|
34
|
+
// die aeussere Schleife.
|
|
35
|
+
// CR-SM-266 D1/D4: die Regel prueft ERREICHBARKEIT statt Adjazenz.
|
|
36
|
+
//
|
|
37
|
+
// Bis hierher suchte sie einen io-Ziel-Treffer direkt am UC oder an dessen compose-Kind —
|
|
38
|
+
// also genau die beiden Kanten `ACTOR -io-> UC` und (ueber die FCHAIN) den Direktweg. Beide
|
|
39
|
+
// Patterns sind mit D1/D4 entfallen; die Regel waere damit UNERFUELLBAR geworden: sie haette
|
|
40
|
+
// einen Zustand verlangt, den R-18 im selben Lauf als ungueltige Kante ablehnt — der
|
|
41
|
+
// gegenlaeufige Fall aus Gate 4 des Grammatik-Reviews, und fuer den Nutzer eine Sackgasse
|
|
42
|
+
// statt eines Fehlers.
|
|
43
|
+
//
|
|
44
|
+
// Der tragende Pfad ist jetzt der einzige: `ACTOR -io-> FLOW -io-> FUNC`, FUNC in einer
|
|
45
|
+
// FCHAIN des UC. Zwei Sprungweiten (Actor→FLOW, FLOW→FUNC), danach Mengen-Mitgliedschaft —
|
|
46
|
+
// die CR-SM-261-Optimierung bleibt damit erhalten (kein Scan je UC, alles ueber den Index
|
|
47
|
+
// aus CR-SM-264), und die Iteration ueber `elementsOfType('UC')` bleibt die aeussere
|
|
48
|
+
// Schleife, also ist die Befundreihenfolge weiter die Graph-Reihenfolge (Gate 5).
|
|
49
|
+
const idx = indexOf(graph);
|
|
50
|
+
const actorIds = idx.idsOfType('ACTOR');
|
|
51
|
+
// Schritt 1: die FLOWs, die ein ACTOR speist.
|
|
52
|
+
const actorFlows = new Set(idx.tracesOfType('io').filter(t => actorIds.has(t.source)).map(t => t.target));
|
|
53
|
+
// Schritt 2: die FUNCs, die an einem solchen FLOW haengen — in BEIDE Richtungen. Ein UC ist
|
|
54
|
+
// auch dann an einen Actor angebunden, wenn die Kette IHM etwas liefert (FUNC -io-> FLOW
|
|
55
|
+
// -io-> ACTOR), nicht nur wenn sie von ihm getriggert wird. Die alte Fassung sah nur die
|
|
56
|
+
// Trigger-Richtung, weil `ACTOR -io-> UC` nur so herum existierte.
|
|
57
|
+
const actorFacingFuncs = new Set();
|
|
58
|
+
for (const t of idx.tracesOfType('io')) {
|
|
59
|
+
if (actorFlows.has(t.source))
|
|
60
|
+
actorFacingFuncs.add(t.target);
|
|
61
|
+
if (actorIds.has(t.target) && idx.typeOf(t.source) === 'FLOW') {
|
|
62
|
+
for (const producer of idx.in(t.source, 'io'))
|
|
63
|
+
actorFacingFuncs.add(producer.source);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return idx.elementsOfType('UC')
|
|
67
|
+
.filter(uc => !idx.out(uc.id, 'compose').some(chain => idx.out(chain.target, 'compose').some(member => actorFacingFuncs.has(member.target))))
|
|
29
68
|
.map(uc => ({
|
|
30
69
|
rule_id: 'UC-02',
|
|
31
70
|
severity: 'error',
|
|
32
71
|
element_id: uc.id,
|
|
33
|
-
message: `${uc.id}
|
|
34
|
-
fix_hint: '
|
|
72
|
+
message: `${uc.id} is not reachable from any ACTOR`,
|
|
73
|
+
fix_hint: 'Wire an ACTOR to a FLOW that feeds (or is fed by) a FUNC in one of this UC\'s function chains',
|
|
35
74
|
context: { element_type: uc.type, element_name: uc.name },
|
|
36
75
|
}));
|
|
37
76
|
}
|
|
@@ -39,10 +78,9 @@ export function uc02HasActor(graph) {
|
|
|
39
78
|
// UC-03: UC must have compose→FCHAIN (scenario)
|
|
40
79
|
// ---------------------------------------------------------------------------
|
|
41
80
|
export function uc03HasScenario(graph) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
.filter(uc => !
|
|
45
|
-
graph.elements.some(e => e.id === t.target && e.type === 'FCHAIN')))
|
|
81
|
+
const idx = indexOf(graph);
|
|
82
|
+
return idx.elementsOfType('UC')
|
|
83
|
+
.filter(uc => !idx.out(uc.id, 'compose').some(t => idx.typeOf(t.target) === 'FCHAIN'))
|
|
46
84
|
.map(uc => ({
|
|
47
85
|
rule_id: 'UC-03',
|
|
48
86
|
severity: 'warning',
|
|
@@ -77,10 +115,12 @@ export function uc04GoalDefined(graph) {
|
|
|
77
115
|
// UC-05: UC should have postcondition REQ (CR-165: compose only, satisfy UC→REQ invalid)
|
|
78
116
|
// ---------------------------------------------------------------------------
|
|
79
117
|
export function uc05HasPostcondition(graph) {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
.filter(uc => !
|
|
83
|
-
|
|
118
|
+
const idx = indexOf(graph);
|
|
119
|
+
return idx.elementsOfType('UC')
|
|
120
|
+
.filter(uc => !idx.out(uc.id, 'compose').some(t => {
|
|
121
|
+
const target = idx.byId.get(t.target);
|
|
122
|
+
return target?.type === 'REQ' && target.kinds?.includes('postcondition');
|
|
123
|
+
}))
|
|
84
124
|
.map(uc => ({
|
|
85
125
|
rule_id: 'UC-05',
|
|
86
126
|
severity: 'info',
|
|
@@ -94,10 +134,12 @@ export function uc05HasPostcondition(graph) {
|
|
|
94
134
|
// UC-06: UC should have precondition REQ (CR-165: compose only, satisfy UC→REQ invalid)
|
|
95
135
|
// ---------------------------------------------------------------------------
|
|
96
136
|
export function uc06HasPrecondition(graph) {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
.filter(uc => !
|
|
100
|
-
|
|
137
|
+
const idx = indexOf(graph);
|
|
138
|
+
return idx.elementsOfType('UC')
|
|
139
|
+
.filter(uc => !idx.out(uc.id, 'compose').some(t => {
|
|
140
|
+
const target = idx.byId.get(t.target);
|
|
141
|
+
return target?.type === 'REQ' && target.kinds?.includes('precondition');
|
|
142
|
+
}))
|
|
101
143
|
.map(uc => ({
|
|
102
144
|
rule_id: 'UC-06',
|
|
103
145
|
severity: 'info',
|