@sigloch/graphcode-client 1.2.0 → 1.3.1
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/panels.d.ts +26 -0
- package/dist/panels.js +41 -0
- package/dist/readiness-completeness.d.ts +4 -1
- package/dist/readiness-completeness.js +6 -2
- package/package.json +4 -4
package/dist/panels.d.ts
CHANGED
|
@@ -57,6 +57,32 @@ export interface RecommendationsPanel {
|
|
|
57
57
|
total: number;
|
|
58
58
|
}
|
|
59
59
|
export declare function recommendationsPanel(violations: RuleViolation[], limit?: number): RecommendationsPanel;
|
|
60
|
+
/** One rule's firings, collapsed: the true count plus a NAMED-capped element sample. */
|
|
61
|
+
export interface ViolationGroup {
|
|
62
|
+
ruleId: string;
|
|
63
|
+
severity: 'error' | 'warning' | 'info';
|
|
64
|
+
/** Firings of this rule over the UNCAPPED input — never derived from `elementIds`. */
|
|
65
|
+
count: number;
|
|
66
|
+
message: string;
|
|
67
|
+
fixHint?: string;
|
|
68
|
+
/** At most `elementLimit` element ids, in input order. */
|
|
69
|
+
elementIds: string[];
|
|
70
|
+
/** How many element ids the cap cut off — the cap is never silent. */
|
|
71
|
+
elementIdsOmitted: number;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Group violations by ruleId — **group first, cap after**.
|
|
75
|
+
*
|
|
76
|
+
* The counting runs over the UNCAPPED violations, never over an already-capped
|
|
77
|
+
* item list: cap-then-count reports "50×" for a rule that fired 60×, and a wrong
|
|
78
|
+
* number is worse than a long list (CR-GVE-250). `elementIds` is cut at
|
|
79
|
+
* `elementLimit` and says via `elementIdsOmitted` how many are missing — a silent
|
|
80
|
+
* cap is exactly the defect this function exists to prevent.
|
|
81
|
+
*
|
|
82
|
+
* Pure projection: the input array is not mutated, and violations without an
|
|
83
|
+
* `elementId` (graph-scoped findings) still count, they just contribute no id.
|
|
84
|
+
*/
|
|
85
|
+
export declare function groupViolations(violations: RuleViolation[], elementLimit?: number): ViolationGroup[];
|
|
60
86
|
export type Freshness = 'live' | 'stale' | 'absent';
|
|
61
87
|
/**
|
|
62
88
|
* Two artifact kinds with TWO distinct staleness mechanisms (CR-GC-222):
|
package/dist/panels.js
CHANGED
|
@@ -27,6 +27,47 @@ export function recommendationsPanel(violations, limit = 5) {
|
|
|
27
27
|
});
|
|
28
28
|
return { items, total: violations.length };
|
|
29
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* Group violations by ruleId — **group first, cap after**.
|
|
32
|
+
*
|
|
33
|
+
* The counting runs over the UNCAPPED violations, never over an already-capped
|
|
34
|
+
* item list: cap-then-count reports "50×" for a rule that fired 60×, and a wrong
|
|
35
|
+
* number is worse than a long list (CR-GVE-250). `elementIds` is cut at
|
|
36
|
+
* `elementLimit` and says via `elementIdsOmitted` how many are missing — a silent
|
|
37
|
+
* cap is exactly the defect this function exists to prevent.
|
|
38
|
+
*
|
|
39
|
+
* Pure projection: the input array is not mutated, and violations without an
|
|
40
|
+
* `elementId` (graph-scoped findings) still count, they just contribute no id.
|
|
41
|
+
*/
|
|
42
|
+
export function groupViolations(violations, elementLimit = 10) {
|
|
43
|
+
const byRule = new Map();
|
|
44
|
+
for (const v of violations) {
|
|
45
|
+
let g = byRule.get(v.ruleId);
|
|
46
|
+
if (!g) {
|
|
47
|
+
g = {
|
|
48
|
+
ruleId: v.ruleId,
|
|
49
|
+
severity: v.severity,
|
|
50
|
+
count: 0,
|
|
51
|
+
message: v.message,
|
|
52
|
+
fixHint: v.fixHint,
|
|
53
|
+
elementIds: [],
|
|
54
|
+
elementIdsOmitted: 0,
|
|
55
|
+
allElementIds: [],
|
|
56
|
+
};
|
|
57
|
+
byRule.set(v.ruleId, g);
|
|
58
|
+
}
|
|
59
|
+
g.count += 1;
|
|
60
|
+
if (v.elementId)
|
|
61
|
+
g.allElementIds.push(v.elementId);
|
|
62
|
+
}
|
|
63
|
+
return [...byRule.values()]
|
|
64
|
+
.sort((a, b) => b.count - a.count)
|
|
65
|
+
.map(({ allElementIds, ...g }) => ({
|
|
66
|
+
...g,
|
|
67
|
+
elementIds: allElementIds.slice(0, Math.max(0, elementLimit)),
|
|
68
|
+
elementIdsOmitted: Math.max(0, allElementIds.length - Math.max(0, elementLimit)),
|
|
69
|
+
}));
|
|
70
|
+
}
|
|
30
71
|
/**
|
|
31
72
|
* The canonical INCOSE-tab artifact catalog (readiness-artifact-model.md §6). Renders are the
|
|
32
73
|
* deterministic CR-GC-220 views; the 5 analysis ids are exactly CR-GC-221's creation keys
|
|
@@ -56,7 +56,10 @@ export interface CompletenessLeg {
|
|
|
56
56
|
* no dedicated SYS→UC rule exists, R-17 is the closest twin),
|
|
57
57
|
* UC→FCHAIN = UC-03, UC→REQ = UC-01.
|
|
58
58
|
* PDR: FCHAIN→FUNC = R-15, FCHAIN-actor-bounded = FC-04 (trigger+consumer).
|
|
59
|
-
* CDR: FLOW→SCHEMA =
|
|
59
|
+
* CDR: FLOW→SCHEMA = R-18 (seit CR-SM-271: die Untergrenze ist Grammatik,
|
|
60
|
+
* `FLOW -relation-> SCHEMA [1..1]` — SC-04 existiert nicht mehr; ein
|
|
61
|
+
* R-18-Befund am FLOW heisst "Kanten ungrammatisch", inkl. fehlendem
|
|
62
|
+
* oder doppeltem SCHEMA).
|
|
60
63
|
* TRR: TEST.testRefs = R-19, FUNC.realRef = R-20.
|
|
61
64
|
*/
|
|
62
65
|
export declare const COMPLETENESS_SLICES: Record<string, CompletenessLeg[]>;
|
|
@@ -8,7 +8,10 @@ export const typeOf = (byId, id) => byId.get(id)?.type;
|
|
|
8
8
|
* no dedicated SYS→UC rule exists, R-17 is the closest twin),
|
|
9
9
|
* UC→FCHAIN = UC-03, UC→REQ = UC-01.
|
|
10
10
|
* PDR: FCHAIN→FUNC = R-15, FCHAIN-actor-bounded = FC-04 (trigger+consumer).
|
|
11
|
-
* CDR: FLOW→SCHEMA =
|
|
11
|
+
* CDR: FLOW→SCHEMA = R-18 (seit CR-SM-271: die Untergrenze ist Grammatik,
|
|
12
|
+
* `FLOW -relation-> SCHEMA [1..1]` — SC-04 existiert nicht mehr; ein
|
|
13
|
+
* R-18-Befund am FLOW heisst "Kanten ungrammatisch", inkl. fehlendem
|
|
14
|
+
* oder doppeltem SCHEMA).
|
|
12
15
|
* TRR: TEST.testRefs = R-19, FUNC.realRef = R-20.
|
|
13
16
|
*/
|
|
14
17
|
export const COMPLETENESS_SLICES = {
|
|
@@ -24,8 +27,9 @@ export const COMPLETENESS_SLICES = {
|
|
|
24
27
|
{ id: 'FCHAIN-actor-bounded', sourceType: 'FCHAIN', ruleId: 'FC-04' },
|
|
25
28
|
],
|
|
26
29
|
// Interfaces carry a data contract: every FLOW has a SCHEMA (CR-GC-106 schema-before-code).
|
|
30
|
+
// CR-SM-271: SC-04 entfiel — der Fall meldet als R-18 (Untergrenzen-Bein) am FLOW.
|
|
27
31
|
CDR: [
|
|
28
|
-
{ id: 'FLOW→SCHEMA', sourceType: 'FLOW', ruleId: '
|
|
32
|
+
{ id: 'FLOW→SCHEMA', sourceType: 'FLOW', ruleId: 'R-18' },
|
|
29
33
|
],
|
|
30
34
|
// Binding: tests are runnable and functions carry code — concept/external exemptions
|
|
31
35
|
// are R-19/R-20's own business now (single source of truth), not re-decided here.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sigloch/graphcode-client",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -37,11 +37,11 @@
|
|
|
37
37
|
"access": "public"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
|
-
"@sigloch/contracts": ">=
|
|
40
|
+
"@sigloch/contracts": ">=10 <11",
|
|
41
41
|
"@sigloch/graph-api-core": ">=5 <6"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@sigloch/contracts": "
|
|
45
|
-
"@sigloch/graph-api-core": "
|
|
44
|
+
"@sigloch/contracts": ">=10 <11",
|
|
45
|
+
"@sigloch/graph-api-core": ">=5.4 <6"
|
|
46
46
|
}
|
|
47
47
|
}
|