@sigloch/contracts 12.7.0 → 12.8.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.
|
@@ -25,5 +25,5 @@ export declare const GRAMMAR_SNAPSHOT: {
|
|
|
25
25
|
readonly conformanceRules: readonly ["RC-01 (warning)", "RC-02 (warning)", "RC-03 (warning)", "RC-04 (warning)", "RC-05 (warning)", "RC-06 (warning)", "RC-07 (warning)", "RC-08 (warning)", "RC-09 (warning)", "RC-10 (warning)", "RC-11 (warning)", "RC-12 (warning)", "RC-13 (warning)"];
|
|
26
26
|
readonly policy: readonly ["apTable = null", "boundaryWidth = {warning:5}", "criticality = {infrastructure:3}", "crossingFlows = {warning:3}", "decompositionBreadth = {min:3,warning:9}", "instability = null", "lcom4 = {info:4,warning:6}", "riskRpn = 100"];
|
|
27
27
|
readonly ruleHelp: readonly ["AF-01", "AF-02", "AF-03", "AF-04", "AF-05", "BQ-01", "BQ-02", "BQ-04", "BQ-06", "BQ-07", "BW-02", "CL-01", "CR-01", "CR-R01", "CR-R02", "CR-R03", "FC-03", "FC-04", "FC-05", "FM-01", "FM-02", "FM-03", "IO-01", "IO-02", "MS-01", "MS-02", "MS-03", "MT-01", "MT-02", "MT-04", "ND-01", "ND-02", "NFR-01", "R-01", "R-02", "R-04", "R-05", "R-08", "R-10", "R-12", "R-15", "R-16", "R-17", "R-18", "R-19", "R-20", "R-21", "R-22", "R-23", "R-26", "R-29", "R-30", "R-31", "R-32", "R-33", "R-35", "RC-01", "RC-02", "RC-03", "RC-04", "RC-05", "RC-06", "RC-07", "RC-08", "RC-09", "RC-10", "RC-11", "RC-12", "RC-13", "RD-01", "RD-02", "RD-04", "RD-05", "SC-02", "UC-01", "UC-02", "UC-03", "UC-04", "VR-01"];
|
|
28
|
-
readonly exports: readonly ["ACCEPTED_FINDINGS_ATTRIBUTE", "AF_RULES", "ALL_RULE_DEFS", "AO_RULES", "AcceptedFindingSchema", "ActionPriority", "AnalysisArtifactId", "AnalysisFreshnessStampSchema", "ApTableSchema", "BOUNDED_PATTERNS", "BQ_RULES", "CLOSED_STATUS", "CODE_CONFORMANCE_RULES", "CR_RULES", "CallEdgeSchema", "CallSiteSchema", "ChainMetrics", "CodeFactsSchema", "DEFAULT_METRIC_POLICY", "ELEMENT_ATTRIBUTES", "ELEMENT_DESCRIPTIONS", "ElementType", "ElementUid", "FC_RULES", "FM_RULES", "FileFactsSchema", "FlowSync", "FunctionCriticality", "GRAPH_ANCHOR", "ImportEdgeSchema", "MARK_STAGE", "MAX_SLUG_LENGTH", "META_MODEL_VERSION", "MODELING_ELEMENT_TYPES", "MT_RULES", "Mark", "MetricPolicySchema", "ModuleMetrics", "ND_RULES", "ONTOLOGY_VERSION", "OntologyElement", "OntologyGraph", "PHASE_READINESS_NAME", "REQUIRED_PATTERNS", "RULES_VERSION", "RULE_HELP", "RULE_TASKS", "RealRefSchema", "RepoRelativePathSchema", "ReqKind", "ReqRole", "RequirementScope", "RiskCarriers", "RuleSeverity", "RuleViolation", "SC_RULES", "STAGE_SETS", "SteerSpace", "SteerTerm", "TASK_ENTRY", "TASK_OWNED_RULES", "TRACE_PATTERNS", "TestRefSchema", "TestRefsSchema", "TestResult", "Trace", "TraceType", "UC_RULES", "V3_RULES", "VIEW_RULES", "VerificationMethod", "ViolationCandidate", "ViolationContext", "acceptedRuleIds", "actionPriority", "admittingAlternatives", "allocationCohesion", "apMethod", "attributeTypeOf", "boxContracts", "bq01Unambiguous", "bq02Verifiable", "bq04Necessary", "bq06Conforming", "bq07Complete", "bw02WhiteboxWidth", "callCoverage", "chainMetrics", "chainsByFunc", "cl01ConopsCompleteness", "contractsOfFlow", "cr01CrossingFlowCount", "crossingContractCount", "decomposedFuncs", "evaluateAFRules", "evaluateAORules", "evaluateAllRules", "evaluateBQRules", "evaluateCRRules", "evaluateConformanceRules", "evaluateFCRules", "evaluateFMRules", "evaluateMTRules", "evaluateNDRules", "evaluateRules", "evaluateSCRules", "evaluateUCRules", "evaluateViewRules", "extractFormatE", "fc03FchainFlat", "fc04ActorBounded", "fc05ChainConnected", "flowProducers", "fm01MissingFmeaAttributes", "fm02MissingMitigation", "fm03HighRiskUnverified", "funcSimilarity", "funcSubtree", "functionCriticality", "getRuleDefsForProfile", "hydrateAttrValue", "importCoverage", "indexOf", "io01CrossModuleCompleteness", "isDue", "isElementUid", "isValidTrace", "jaccard", "markOfStage", "maxOccurs", "minOccurs", "moduleCrossings", "moduleMetrics", "mt01Instability", "mt02Lcom4", "mt04WhiteboxLcom4", "nd01FuncNearDuplicate", "nd02SchemaNearDuplicate", "nfr01BudgetOvershoot", "normalizeReqKinds", "pairsAbove", "parseElementUid", "readAnalysisStamp", "readFlowSync", "readRealRef", "readReqRole", "readTestRefs", "requirementScope", "riskCarriers", "sc02IsReferenced", "schemaSimilarity", "setBQ04SimilarityMatrix", "subtreeFuncs", "taskOf", "toElementUid", "toEvaluableGraph", "tokens", "traceRejection", "tryParseElementUid", "uc01HasRequirements", "uc02HasActor", "uc03HasScenario", "uc04GoalDefined", "unbuiltElementIds", "unwiredFuncs", "vr01TestNoResult", "whiteboxContractCount"];
|
|
28
|
+
readonly exports: readonly ["ACCEPTED_FINDINGS_ATTRIBUTE", "AF_RULES", "ALL_RULE_DEFS", "AO_RULES", "AcceptedFindingSchema", "ActionPriority", "AnalysisArtifactId", "AnalysisFreshnessStampSchema", "ApTableSchema", "BOUNDED_PATTERNS", "BQ_RULES", "CLOSED_STATUS", "CODE_CONFORMANCE_RULES", "CR_RULES", "CallEdgeSchema", "CallSiteSchema", "ChainMetrics", "CodeFactsSchema", "ConstraintCarriers", "DEFAULT_METRIC_POLICY", "ELEMENT_ATTRIBUTES", "ELEMENT_DESCRIPTIONS", "ElementType", "ElementUid", "FC_RULES", "FM_RULES", "FileFactsSchema", "FlowSync", "FunctionCriticality", "GRAPH_ANCHOR", "ImportEdgeSchema", "MARK_STAGE", "MAX_SLUG_LENGTH", "META_MODEL_VERSION", "MODELING_ELEMENT_TYPES", "MT_RULES", "Mark", "MetricPolicySchema", "ModuleMetrics", "ND_RULES", "ONTOLOGY_VERSION", "OntologyElement", "OntologyGraph", "PHASE_READINESS_NAME", "REQUIRED_PATTERNS", "RULES_VERSION", "RULE_HELP", "RULE_TASKS", "RealRefSchema", "RepoRelativePathSchema", "ReqKind", "ReqRole", "RequirementScope", "RiskCarriers", "RuleSeverity", "RuleViolation", "SC_RULES", "STAGE_SETS", "SteerSpace", "SteerTerm", "TASK_ENTRY", "TASK_OWNED_RULES", "TRACE_PATTERNS", "TestRefSchema", "TestRefsSchema", "TestResult", "Trace", "TraceType", "UC_RULES", "V3_RULES", "VIEW_RULES", "VerificationMethod", "ViolationCandidate", "ViolationContext", "acceptedRuleIds", "actionPriority", "admittingAlternatives", "allocationCohesion", "apMethod", "attributeTypeOf", "boxContracts", "bq01Unambiguous", "bq02Verifiable", "bq04Necessary", "bq06Conforming", "bq07Complete", "bw02WhiteboxWidth", "callCoverage", "chainMetrics", "chainsByFunc", "cl01ConopsCompleteness", "constraintCarriers", "contractsOfFlow", "cr01CrossingFlowCount", "crossingContractCount", "decomposedFuncs", "evaluateAFRules", "evaluateAORules", "evaluateAllRules", "evaluateBQRules", "evaluateCRRules", "evaluateConformanceRules", "evaluateFCRules", "evaluateFMRules", "evaluateMTRules", "evaluateNDRules", "evaluateRules", "evaluateSCRules", "evaluateUCRules", "evaluateViewRules", "extractFormatE", "fc03FchainFlat", "fc04ActorBounded", "fc05ChainConnected", "flowProducers", "fm01MissingFmeaAttributes", "fm02MissingMitigation", "fm03HighRiskUnverified", "funcSimilarity", "funcSubtree", "functionCriticality", "getRuleDefsForProfile", "hydrateAttrValue", "importCoverage", "indexOf", "io01CrossModuleCompleteness", "isDue", "isElementUid", "isValidTrace", "jaccard", "markOfStage", "maxOccurs", "minOccurs", "moduleCrossings", "moduleMetrics", "mt01Instability", "mt02Lcom4", "mt04WhiteboxLcom4", "nd01FuncNearDuplicate", "nd02SchemaNearDuplicate", "nfr01BudgetOvershoot", "normalizeReqKinds", "pairsAbove", "parseElementUid", "readAnalysisStamp", "readFlowSync", "readRealRef", "readReqRole", "readTestRefs", "requirementScope", "riskCarriers", "sc02IsReferenced", "schemaSimilarity", "setBQ04SimilarityMatrix", "subtreeFuncs", "taskOf", "toElementUid", "toEvaluableGraph", "tokens", "traceRejection", "tryParseElementUid", "uc01HasRequirements", "uc02HasActor", "uc03HasScenario", "uc04GoalDefined", "unbuiltElementIds", "unwiredFuncs", "vr01TestNoResult", "whiteboxContractCount"];
|
|
29
29
|
};
|
|
@@ -342,6 +342,7 @@ export const GRAMMAR_SNAPSHOT = {
|
|
|
342
342
|
"CallSiteSchema",
|
|
343
343
|
"ChainMetrics",
|
|
344
344
|
"CodeFactsSchema",
|
|
345
|
+
"ConstraintCarriers",
|
|
345
346
|
"DEFAULT_METRIC_POLICY",
|
|
346
347
|
"ELEMENT_ATTRIBUTES",
|
|
347
348
|
"ELEMENT_DESCRIPTIONS",
|
|
@@ -414,6 +415,7 @@ export const GRAMMAR_SNAPSHOT = {
|
|
|
414
415
|
"chainMetrics",
|
|
415
416
|
"chainsByFunc",
|
|
416
417
|
"cl01ConopsCompleteness",
|
|
418
|
+
"constraintCarriers",
|
|
417
419
|
"contractsOfFlow",
|
|
418
420
|
"cr01CrossingFlowCount",
|
|
419
421
|
"crossingContractCount",
|
|
@@ -43,6 +43,13 @@
|
|
|
43
43
|
*
|
|
44
44
|
* Jede Liste ist nach Kennung sortiert.
|
|
45
45
|
*
|
|
46
|
+
* ## Zweiter Export, dieselbe Ableitung (CR-SM-418)
|
|
47
|
+
*
|
|
48
|
+
* `constraintCarriers` liest mit derselben Tabelle die Traeger jeder nicht-funktionalen REQ ohne
|
|
49
|
+
* Rolle — ein Constraint an Modul, Kette oder System. Eigener Export statt einer dritten Liste
|
|
50
|
+
* hier: `riskCarriers` bleibt die Risikoflaeche, und ein Leser holt die Constraints nur, wenn er
|
|
51
|
+
* sie braucht (am graphcode-Modell 72 Zeilen, rund 33 KB).
|
|
52
|
+
*
|
|
46
53
|
* @author andreas@siglochconsulting
|
|
47
54
|
*/
|
|
48
55
|
import { z } from 'zod/v4';
|
|
@@ -64,3 +71,21 @@ export declare const RiskCarriers: z.ZodObject<{
|
|
|
64
71
|
export type RiskCarriers = z.infer<typeof RiskCarriers>;
|
|
65
72
|
/** Die Traeger je Risiko und die Risiken je Traeger dieses Graphen. */
|
|
66
73
|
export declare function riskCarriers(graph: OntologyGraph): RiskCarriers;
|
|
74
|
+
/**
|
|
75
|
+
* Eine Zeile je nicht-funktionaler REQ ohne gueltige Rolle mit mindestens einem Erfueller — ein
|
|
76
|
+
* Constraint, den der Autor oben setzt (Modul, Kette, System) und der in seine Blattfunktionen
|
|
77
|
+
* wandert (graphcode CR-GC-804, `se-vorbereitung` §2). Nach R-18 ist der Erfueller einer
|
|
78
|
+
* nicht-funktionalen REQ ein MOD, eine FCHAIN oder ein SYS; `by` nennt ihn wie modelliert.
|
|
79
|
+
*
|
|
80
|
+
* Eine REQ mit Rolle steht NICHT hier: die Gegenmassnahme zaehlt in der Zeile ihres Risikos
|
|
81
|
+
* (`riskCarriers`), das Risiko selbst wird nicht erfuellt. Keine Zeile ohne Erfueller (RD-01
|
|
82
|
+
* meldet sie), keine Umkehrliste je Traeger: sie hat keinen Leser.
|
|
83
|
+
*/
|
|
84
|
+
export declare const ConstraintCarriers: z.ZodArray<z.ZodObject<{
|
|
85
|
+
reqId: z.ZodString;
|
|
86
|
+
carriers: z.ZodArray<z.ZodString>;
|
|
87
|
+
by: z.ZodArray<z.ZodString>;
|
|
88
|
+
}, z.core.$strict>>;
|
|
89
|
+
export type ConstraintCarriers = z.infer<typeof ConstraintCarriers>;
|
|
90
|
+
/** Die Traeger je nicht-funktionaler Anforderung ohne Rolle dieses Graphen. */
|
|
91
|
+
export declare function constraintCarriers(graph: OntologyGraph): ConstraintCarriers;
|
package/dist/se/risk-carriers.js
CHANGED
|
@@ -43,10 +43,17 @@
|
|
|
43
43
|
*
|
|
44
44
|
* Jede Liste ist nach Kennung sortiert.
|
|
45
45
|
*
|
|
46
|
+
* ## Zweiter Export, dieselbe Ableitung (CR-SM-418)
|
|
47
|
+
*
|
|
48
|
+
* `constraintCarriers` liest mit derselben Tabelle die Traeger jeder nicht-funktionalen REQ ohne
|
|
49
|
+
* Rolle — ein Constraint an Modul, Kette oder System. Eigener Export statt einer dritten Liste
|
|
50
|
+
* hier: `riskCarriers` bleibt die Risikoflaeche, und ein Leser holt die Constraints nur, wenn er
|
|
51
|
+
* sie braucht (am graphcode-Modell 72 Zeilen, rund 33 KB).
|
|
52
|
+
*
|
|
46
53
|
* @author andreas@siglochconsulting
|
|
47
54
|
*/
|
|
48
55
|
import { z } from 'zod/v4';
|
|
49
|
-
import { readReqRole } from './ontology.js';
|
|
56
|
+
import { normalizeReqKinds, readReqRole } from './ontology.js';
|
|
50
57
|
import { indexOf } from './graph-index.js';
|
|
51
58
|
import { subtreeFuncs } from './module-crossings.js';
|
|
52
59
|
// CR-SM-361: ein Zod-Vertrag, kein Typ — der Erzeuger prueft sein Ergebnis.
|
|
@@ -69,10 +76,9 @@ const hasRole = (e, role) => {
|
|
|
69
76
|
return r.state === 'bound' && r.value === role;
|
|
70
77
|
};
|
|
71
78
|
const byId = (a, b) => (a < b ? -1 : a > b ? 1 : 0);
|
|
72
|
-
/** Die
|
|
73
|
-
|
|
79
|
+
/** Die EINE Ableitung beider Exporte: die Traeger eines Erfuellers, nach der Tabelle im Kopf. */
|
|
80
|
+
function carrierWalk(graph) {
|
|
74
81
|
const idx = indexOf(graph);
|
|
75
|
-
const element = new Map(graph.elements.map((e) => [e.id, e]));
|
|
76
82
|
const isLeaf = (func) => !idx.out(func, 'compose').some((t) => idx.typeOf(t.target) === 'FUNC');
|
|
77
83
|
const carriersOf = (satisfier) => {
|
|
78
84
|
switch (idx.typeOf(satisfier)) {
|
|
@@ -83,6 +89,12 @@ export function riskCarriers(graph) {
|
|
|
83
89
|
default: return []; // SYS gilt quer; jeder andere Typ ist kein legaler Erfueller (R-18).
|
|
84
90
|
}
|
|
85
91
|
};
|
|
92
|
+
return { idx, carriersOf };
|
|
93
|
+
}
|
|
94
|
+
/** Die Traeger je Risiko und die Risiken je Traeger dieses Graphen. */
|
|
95
|
+
export function riskCarriers(graph) {
|
|
96
|
+
const { idx, carriersOf } = carrierWalk(graph);
|
|
97
|
+
const element = new Map(graph.elements.map((e) => [e.id, e]));
|
|
86
98
|
const risksOf = new Map();
|
|
87
99
|
const risks = graph.elements.filter((e) => hasRole(e, 'risk')).map((risk) => {
|
|
88
100
|
const mitigations = [...new Set(idx.out(risk.id, 'compose').map((t) => t.target).filter((id) => hasRole(element.get(id), 'mitigation')))];
|
|
@@ -107,3 +119,36 @@ export function riskCarriers(graph) {
|
|
|
107
119
|
.map(([funcId, ids]) => ({ funcId, risks: [...ids].sort(byId) }));
|
|
108
120
|
return RiskCarriers.parse({ risks, surface });
|
|
109
121
|
}
|
|
122
|
+
// ---------------------------------------------------------------------------
|
|
123
|
+
// CR-SM-418: dieselbe Ableitung fuer jede nicht-funktionale Anforderung ohne Rolle
|
|
124
|
+
// ---------------------------------------------------------------------------
|
|
125
|
+
/**
|
|
126
|
+
* Eine Zeile je nicht-funktionaler REQ ohne gueltige Rolle mit mindestens einem Erfueller — ein
|
|
127
|
+
* Constraint, den der Autor oben setzt (Modul, Kette, System) und der in seine Blattfunktionen
|
|
128
|
+
* wandert (graphcode CR-GC-804, `se-vorbereitung` §2). Nach R-18 ist der Erfueller einer
|
|
129
|
+
* nicht-funktionalen REQ ein MOD, eine FCHAIN oder ein SYS; `by` nennt ihn wie modelliert.
|
|
130
|
+
*
|
|
131
|
+
* Eine REQ mit Rolle steht NICHT hier: die Gegenmassnahme zaehlt in der Zeile ihres Risikos
|
|
132
|
+
* (`riskCarriers`), das Risiko selbst wird nicht erfuellt. Keine Zeile ohne Erfueller (RD-01
|
|
133
|
+
* meldet sie), keine Umkehrliste je Traeger: sie hat keinen Leser.
|
|
134
|
+
*/
|
|
135
|
+
export const ConstraintCarriers = z.array(z.strictObject({
|
|
136
|
+
reqId: z.string(),
|
|
137
|
+
/** Die Blattfunktionen, die die Anforderung tragen — ohne die des Systems. */
|
|
138
|
+
carriers: z.array(z.string()),
|
|
139
|
+
/** Die Erfueller der satisfy-Kanten, wie modelliert. */
|
|
140
|
+
by: z.array(z.string()).min(1),
|
|
141
|
+
}));
|
|
142
|
+
/** Die Traeger je nicht-funktionaler Anforderung ohne Rolle dieses Graphen. */
|
|
143
|
+
export function constraintCarriers(graph) {
|
|
144
|
+
const { idx, carriersOf } = carrierWalk(graph);
|
|
145
|
+
const rows = idx.elementsOfType('REQ')
|
|
146
|
+
.filter((r) => normalizeReqKinds(r.kinds).includes('non-functional') && readReqRole(r.attributes).state !== 'bound')
|
|
147
|
+
.map((r) => {
|
|
148
|
+
const by = [...new Set(idx.in(r.id, 'satisfy').map((t) => t.source))].sort(byId);
|
|
149
|
+
return { reqId: r.id, carriers: [...new Set(by.flatMap(carriersOf))].sort(byId), by };
|
|
150
|
+
})
|
|
151
|
+
.filter((row) => row.by.length > 0)
|
|
152
|
+
.sort((a, b) => byId(a.reqId, b.reqId));
|
|
153
|
+
return ConstraintCarriers.parse(rows);
|
|
154
|
+
}
|