@sigloch/contracts 10.7.0 → 10.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.
- package/dist/se/grammar-snapshot.d.ts +1 -1
- package/dist/se/grammar-snapshot.js +1 -0
- package/dist/se/rules.d.ts +18 -0
- package/dist/se/rules.js +23 -3
- package/package.json +1 -1
|
@@ -24,5 +24,5 @@ export declare const GRAMMAR_SNAPSHOT: {
|
|
|
24
24
|
readonly conformanceRules: readonly ["RC-01 (error)", "RC-02 (error)", "RC-03 (error)", "RC-04 (warning)", "RC-05 (warning)", "RC-06 (warning)", "RC-07 (warning)"];
|
|
25
25
|
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"];
|
|
26
26
|
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-02", "FC-03", "FC-04", "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", "RC-01", "RC-02", "RC-03", "RC-04", "RC-05", "RC-06", "RC-07", "RD-01", "RD-02", "RD-03", "RD-04", "RD-05", "SC-02", "UC-01", "UC-02", "UC-03", "UC-04", "UC-05", "UC-06", "VR-01"];
|
|
27
|
-
readonly exports: readonly ["AF_RULES", "ALL_RULE_DEFS", "AO_RULES", "ActionPriority", "AnalysisArtifactId", "AnalysisFreshnessStampSchema", "ApTableSchema", "BOUNDED_PATTERNS", "BQ_RULES", "CLOSED_STATUS", "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", "READINESS_SCORED_PROFILES", "REQUIRED_PATTERNS", "RULES_VERSION", "RULE_HELP", "RULE_TO_DIMENSION", "RULE_TO_PHASE", "ReadinessDimension", "ReadinessReport", "ReadinessScore", "RealRefSchema", "RepoRelativePathSchema", "ReqKind", "RuleSeverity", "RuleViolation", "SC_RULES", "SteerSpace", "SteerTerm", "TRACE_PATTERNS", "TestRefSchema", "TestRefsSchema", "TestResult", "Trace", "TraceType", "UC_RULES", "V3_RULES", "VIEW_RULES", "VerificationMethod", "ViolationCandidate", "ViolationContext", "actionPriority", "admittingAlternatives", "allocationCohesion", "apMethod", "attributeTypeOf", "boxContracts", "bq01Unambiguous", "bq02Verifiable", "bq04Necessary", "bq06Conforming", "bq07Complete", "bw02WhiteboxWidth", "chainsByFunc", "cl01ConopsCompleteness", "cr01CrossingFlowCount", "crossingContractCount", "decomposedFuncs", "evaluateAFRules", "evaluateAORules", "evaluateAllRules", "evaluateBQRules", "evaluateCRRules", "evaluateConformanceRules", "evaluateFCRules", "evaluateFMRules", "evaluateMTRules", "evaluateNDRules", "evaluateRules", "evaluateSCRules", "evaluateUCRules", "evaluateViewRules", "extractFormatE", "fc02LeafUcHasFchain", "fc03FchainFlat", "fc04ActorBounded", "fm01MissingFmeaAttributes", "fm02MissingMitigation", "fm03HighRiskUnverified", "funcSimilarity", "funcSubtree", "functionCriticality", "getRuleDefsForProfile", "hydrateAttrValue", "importCoverage", "indexOf", "io01CrossModuleCompleteness", "isElementUid", "isValidTrace", "jaccard", "maxOccurs", "minOccurs", "moduleCrossings", "moduleMetrics", "mt01Instability", "mt02Lcom4", "mt04WhiteboxLcom4", "nd01FuncNearDuplicate", "nd02SchemaNearDuplicate", "nfr01BudgetOvershoot", "normalizeReqKinds", "pairsAbove", "parseElementUid", "sc02IsReferenced", "schemaSimilarity", "setBQ04SimilarityMatrix", "subtreeFuncs", "toElementUid", "toEvaluableGraph", "tokens", "traceRejection", "tryParseElementUid", "uc01HasRequirements", "uc02HasActor", "uc03HasScenario", "uc04GoalDefined", "uc05HasPostcondition", "uc06HasPrecondition", "vr01TestNoResult", "whiteboxContractCount"];
|
|
27
|
+
readonly exports: readonly ["AF_RULES", "ALL_RULE_DEFS", "AO_RULES", "ActionPriority", "AnalysisArtifactId", "AnalysisFreshnessStampSchema", "ApTableSchema", "BOUNDED_PATTERNS", "BQ_RULES", "CLOSED_STATUS", "CODE_CONFORMANCE_RULES", "CR_RULES", "CodeFactsSchema", "DEFAULT_METRIC_POLICY", "DIMENSION_READINESS_DELTA_NAME", "DIMENSION_READINESS_NAME", "ELEMENT_ATTRIBUTES", "ELEMENT_DESCRIPTIONS", "ElementType", "ElementUid", "FC_RULES", "flowProducers", "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", "READINESS_SCORED_PROFILES", "REQUIRED_PATTERNS", "RULES_VERSION", "RULE_HELP", "RULE_TO_DIMENSION", "RULE_TO_PHASE", "ReadinessDimension", "ReadinessReport", "ReadinessScore", "RealRefSchema", "RepoRelativePathSchema", "ReqKind", "RuleSeverity", "RuleViolation", "SC_RULES", "SteerSpace", "SteerTerm", "TRACE_PATTERNS", "TestRefSchema", "TestRefsSchema", "TestResult", "Trace", "TraceType", "UC_RULES", "V3_RULES", "VIEW_RULES", "VerificationMethod", "ViolationCandidate", "ViolationContext", "actionPriority", "admittingAlternatives", "allocationCohesion", "apMethod", "attributeTypeOf", "boxContracts", "bq01Unambiguous", "bq02Verifiable", "bq04Necessary", "bq06Conforming", "bq07Complete", "bw02WhiteboxWidth", "chainsByFunc", "cl01ConopsCompleteness", "cr01CrossingFlowCount", "crossingContractCount", "decomposedFuncs", "evaluateAFRules", "evaluateAORules", "evaluateAllRules", "evaluateBQRules", "evaluateCRRules", "evaluateConformanceRules", "evaluateFCRules", "evaluateFMRules", "evaluateMTRules", "evaluateNDRules", "evaluateRules", "evaluateSCRules", "evaluateUCRules", "evaluateViewRules", "extractFormatE", "fc02LeafUcHasFchain", "fc03FchainFlat", "fc04ActorBounded", "fm01MissingFmeaAttributes", "fm02MissingMitigation", "fm03HighRiskUnverified", "funcSimilarity", "funcSubtree", "functionCriticality", "getRuleDefsForProfile", "hydrateAttrValue", "importCoverage", "indexOf", "io01CrossModuleCompleteness", "isElementUid", "isValidTrace", "jaccard", "maxOccurs", "minOccurs", "moduleCrossings", "moduleMetrics", "mt01Instability", "mt02Lcom4", "mt04WhiteboxLcom4", "nd01FuncNearDuplicate", "nd02SchemaNearDuplicate", "nfr01BudgetOvershoot", "normalizeReqKinds", "pairsAbove", "parseElementUid", "sc02IsReferenced", "schemaSimilarity", "setBQ04SimilarityMatrix", "subtreeFuncs", "toElementUid", "toEvaluableGraph", "tokens", "traceRejection", "tryParseElementUid", "uc01HasRequirements", "uc02HasActor", "uc03HasScenario", "uc04GoalDefined", "uc05HasPostcondition", "uc06HasPrecondition", "vr01TestNoResult", "whiteboxContractCount"];
|
|
28
28
|
};
|
package/dist/se/rules.d.ts
CHANGED
|
@@ -335,6 +335,24 @@ export interface RuleDefinition {
|
|
|
335
335
|
* vierter Nutzer daran (MT-02, `metric-rules.ts`) — deshalb exportiert.
|
|
336
336
|
*/
|
|
337
337
|
export declare function decomposedFuncs(graph: OntologyGraph): Set<string>;
|
|
338
|
+
/**
|
|
339
|
+
* Die Produzentenmenge je FLOW — das Praedikat hinter IO-02, exportiert (CR-SM-347).
|
|
340
|
+
*
|
|
341
|
+
* Zwei io-Kanten derselben Quelle auf denselben FLOW sind EINE Quelle, kein Verstoss.
|
|
342
|
+
* Konsumenten werden bewusst nicht gezaehlt (Begruendung im Kopf von IO-02).
|
|
343
|
+
*
|
|
344
|
+
* WARUM EXPORTIERT: die Zug-Vorlagen muessen vor dem Vorschlag wissen, ob eine
|
|
345
|
+
* `X -io-> FLOW`-Kante den FLOW auf zwei Produzenten braechte — sonst schlagen sie einen Zug
|
|
346
|
+
* vor, den das Gate mit `IO-02:error` abweist (genau so geschehen mit der R-31-Vorlage im
|
|
347
|
+
* Release 1.7.0). Die Waechterkette in `edgeToCandidate` sieht diese Grenze sonst NICHT:
|
|
348
|
+
* `isValidTrace` prueft Grammatik, `retireFor` die Obergrenze aus `BOUNDED_PATTERNS` — und die
|
|
349
|
+
* vier io-Zeilen tragen kein `cardinality`-Feld, ausserdem begrenzt Kardinalitaet die QUELL-,
|
|
350
|
+
* nicht die ZIEL-Seite.
|
|
351
|
+
*
|
|
352
|
+
* Exportiert statt in se-engine nachgebaut: zwei Fassungen derselben Mengenfrage waeren genau
|
|
353
|
+
* die zweite Wahrheit, die CR-SM-286/-302 beseitigt haben.
|
|
354
|
+
*/
|
|
355
|
+
export declare function flowProducers(graph: OntologyGraph): Map<string, Set<string>>;
|
|
338
356
|
export declare const V3_RULES: RuleDefinition[];
|
|
339
357
|
/** Run all rules against a graph. CR-SM-236: `policy` ist Pflicht — wie bei `evaluateAllRules`. */
|
|
340
358
|
export declare function evaluateRules(graph: OntologyGraph, policy: MetricPolicy): RuleViolation[];
|
package/dist/se/rules.js
CHANGED
|
@@ -461,12 +461,27 @@ function flowCompleteness(graph) {
|
|
|
461
461
|
// umgelegten Ketten, nicht vom Auftrennen. Die Entscheidung oben steht; ein gemessener
|
|
462
462
|
// Zielkonflikt mit BW-02 traegt sie nicht.
|
|
463
463
|
// ---------------------------------------------------------------------------
|
|
464
|
-
|
|
464
|
+
/**
|
|
465
|
+
* Die Produzentenmenge je FLOW — das Praedikat hinter IO-02, exportiert (CR-SM-347).
|
|
466
|
+
*
|
|
467
|
+
* Zwei io-Kanten derselben Quelle auf denselben FLOW sind EINE Quelle, kein Verstoss.
|
|
468
|
+
* Konsumenten werden bewusst nicht gezaehlt (Begruendung im Kopf von IO-02).
|
|
469
|
+
*
|
|
470
|
+
* WARUM EXPORTIERT: die Zug-Vorlagen muessen vor dem Vorschlag wissen, ob eine
|
|
471
|
+
* `X -io-> FLOW`-Kante den FLOW auf zwei Produzenten braechte — sonst schlagen sie einen Zug
|
|
472
|
+
* vor, den das Gate mit `IO-02:error` abweist (genau so geschehen mit der R-31-Vorlage im
|
|
473
|
+
* Release 1.7.0). Die Waechterkette in `edgeToCandidate` sieht diese Grenze sonst NICHT:
|
|
474
|
+
* `isValidTrace` prueft Grammatik, `retireFor` die Obergrenze aus `BOUNDED_PATTERNS` — und die
|
|
475
|
+
* vier io-Zeilen tragen kein `cardinality`-Feld, ausserdem begrenzt Kardinalitaet die QUELL-,
|
|
476
|
+
* nicht die ZIEL-Seite.
|
|
477
|
+
*
|
|
478
|
+
* Exportiert statt in se-engine nachgebaut: zwei Fassungen derselben Mengenfrage waeren genau
|
|
479
|
+
* die zweite Wahrheit, die CR-SM-286/-302 beseitigt haben.
|
|
480
|
+
*/
|
|
481
|
+
export function flowProducers(graph) {
|
|
465
482
|
const idx = indexOf(graph);
|
|
466
483
|
const flowIds = new Set(idx.idsOfType('FLOW'));
|
|
467
484
|
const isEndpoint = (id) => { const t = idx.typeOf(id); return t === 'FUNC' || t === 'ACTOR'; };
|
|
468
|
-
// Produzenten je FLOW als MENGE: zwei io-Kanten derselben Quelle auf denselben FLOW sind
|
|
469
|
-
// eine Quelle, kein Verstoss. Konsumenten werden bewusst nicht gezaehlt (s. Kopf).
|
|
470
485
|
const producers = new Map();
|
|
471
486
|
for (const t of idx.tracesOfType('io')) {
|
|
472
487
|
if (!flowIds.has(t.target) || !isEndpoint(t.source))
|
|
@@ -475,6 +490,11 @@ function flowSingleProducer(graph) {
|
|
|
475
490
|
producers.set(t.target, new Set());
|
|
476
491
|
producers.get(t.target).add(t.source);
|
|
477
492
|
}
|
|
493
|
+
return producers;
|
|
494
|
+
}
|
|
495
|
+
function flowSingleProducer(graph) {
|
|
496
|
+
const idx = indexOf(graph);
|
|
497
|
+
const producers = flowProducers(graph);
|
|
478
498
|
const violations = [];
|
|
479
499
|
// Ueber die Elementliste laufen, nicht ueber die Map: die Reihenfolge eines Befundes darf
|
|
480
500
|
// nicht an der Trace-Reihenfolge haengen (CR-SM-244, Ordnung).
|