@suss/checker-intent 0.5.9 → 0.5.11
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/index.cjs +12 -8
- package/dist/index.js +15 -9
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -47,7 +47,7 @@ function checkIntentAgreement(intents, code) {
|
|
|
47
47
|
return { findings, checked, unchecked };
|
|
48
48
|
}
|
|
49
49
|
function checkBoundaryIntent(intent, codeByBoundary) {
|
|
50
|
-
const key = (0, import_ir_core.
|
|
50
|
+
const key = (0, import_ir_core.pairingKey)(intent.boundary);
|
|
51
51
|
if (key === null) {
|
|
52
52
|
return {
|
|
53
53
|
findings: [
|
|
@@ -69,16 +69,20 @@ function checkBoundaryIntent(intent, codeByBoundary) {
|
|
|
69
69
|
]
|
|
70
70
|
};
|
|
71
71
|
}
|
|
72
|
-
const
|
|
72
|
+
const label = (0, import_ir_core.boundaryKey)(intent.boundary) ?? key;
|
|
73
|
+
const impls = (codeByBoundary.get(key) ?? []).filter((impl) => {
|
|
74
|
+
const binding = impl.identity.boundaryBinding;
|
|
75
|
+
return binding !== null && (0, import_ir_core.semanticsAgree)(binding.semantics, intent.boundary.semantics);
|
|
76
|
+
});
|
|
73
77
|
if (impls.length === 0) {
|
|
74
78
|
return {
|
|
75
79
|
findings: [
|
|
76
80
|
{
|
|
77
81
|
kind: "unimplementedBoundary",
|
|
78
82
|
severity: "error",
|
|
79
|
-
boundary:
|
|
83
|
+
boundary: label,
|
|
80
84
|
intent: { name: intent.name },
|
|
81
|
-
message: `Intent "${intent.name}" declares boundary ${
|
|
85
|
+
message: `Intent "${intent.name}" declares boundary ${label} with ${intent.outcomes.length} outcome(s); no code produces this boundary.`
|
|
82
86
|
}
|
|
83
87
|
],
|
|
84
88
|
// The comparison ran: finding no implementation IS the result.
|
|
@@ -86,7 +90,7 @@ function checkBoundaryIntent(intent, codeByBoundary) {
|
|
|
86
90
|
{
|
|
87
91
|
kind: "boundary",
|
|
88
92
|
intent: intent.name,
|
|
89
|
-
boundary:
|
|
93
|
+
boundary: label,
|
|
90
94
|
implementations: []
|
|
91
95
|
}
|
|
92
96
|
],
|
|
@@ -95,7 +99,7 @@ function checkBoundaryIntent(intent, codeByBoundary) {
|
|
|
95
99
|
}
|
|
96
100
|
const findings = [];
|
|
97
101
|
for (const impl of impls) {
|
|
98
|
-
findings.push(...compareIntentToImpl(intent, impl,
|
|
102
|
+
findings.push(...compareIntentToImpl(intent, impl, label));
|
|
99
103
|
}
|
|
100
104
|
return {
|
|
101
105
|
findings,
|
|
@@ -103,7 +107,7 @@ function checkBoundaryIntent(intent, codeByBoundary) {
|
|
|
103
107
|
{
|
|
104
108
|
kind: "boundary",
|
|
105
109
|
intent: intent.name,
|
|
106
|
-
boundary:
|
|
110
|
+
boundary: label,
|
|
107
111
|
implementations: impls.map(codeRef)
|
|
108
112
|
}
|
|
109
113
|
],
|
|
@@ -263,7 +267,7 @@ function indexCodeByBoundary(code) {
|
|
|
263
267
|
if (binding === null) {
|
|
264
268
|
continue;
|
|
265
269
|
}
|
|
266
|
-
const key = (0, import_ir_core.
|
|
270
|
+
const key = (0, import_ir_core.pairingKey)(binding);
|
|
267
271
|
if (key === null) {
|
|
268
272
|
continue;
|
|
269
273
|
}
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,9 @@ import {
|
|
|
4
4
|
applySuppressionsToFindings,
|
|
5
5
|
bodyShapesMatch,
|
|
6
6
|
boundaryKey,
|
|
7
|
-
|
|
7
|
+
pairingKey,
|
|
8
|
+
ruleBoundaryMatchesKey,
|
|
9
|
+
semanticsAgree
|
|
8
10
|
} from "@suss/ir-core";
|
|
9
11
|
function checkIntentAgreement(intents, code) {
|
|
10
12
|
const findings = [];
|
|
@@ -27,7 +29,7 @@ function checkIntentAgreement(intents, code) {
|
|
|
27
29
|
return { findings, checked, unchecked };
|
|
28
30
|
}
|
|
29
31
|
function checkBoundaryIntent(intent, codeByBoundary) {
|
|
30
|
-
const key =
|
|
32
|
+
const key = pairingKey(intent.boundary);
|
|
31
33
|
if (key === null) {
|
|
32
34
|
return {
|
|
33
35
|
findings: [
|
|
@@ -49,16 +51,20 @@ function checkBoundaryIntent(intent, codeByBoundary) {
|
|
|
49
51
|
]
|
|
50
52
|
};
|
|
51
53
|
}
|
|
52
|
-
const
|
|
54
|
+
const label = boundaryKey(intent.boundary) ?? key;
|
|
55
|
+
const impls = (codeByBoundary.get(key) ?? []).filter((impl) => {
|
|
56
|
+
const binding = impl.identity.boundaryBinding;
|
|
57
|
+
return binding !== null && semanticsAgree(binding.semantics, intent.boundary.semantics);
|
|
58
|
+
});
|
|
53
59
|
if (impls.length === 0) {
|
|
54
60
|
return {
|
|
55
61
|
findings: [
|
|
56
62
|
{
|
|
57
63
|
kind: "unimplementedBoundary",
|
|
58
64
|
severity: "error",
|
|
59
|
-
boundary:
|
|
65
|
+
boundary: label,
|
|
60
66
|
intent: { name: intent.name },
|
|
61
|
-
message: `Intent "${intent.name}" declares boundary ${
|
|
67
|
+
message: `Intent "${intent.name}" declares boundary ${label} with ${intent.outcomes.length} outcome(s); no code produces this boundary.`
|
|
62
68
|
}
|
|
63
69
|
],
|
|
64
70
|
// The comparison ran: finding no implementation IS the result.
|
|
@@ -66,7 +72,7 @@ function checkBoundaryIntent(intent, codeByBoundary) {
|
|
|
66
72
|
{
|
|
67
73
|
kind: "boundary",
|
|
68
74
|
intent: intent.name,
|
|
69
|
-
boundary:
|
|
75
|
+
boundary: label,
|
|
70
76
|
implementations: []
|
|
71
77
|
}
|
|
72
78
|
],
|
|
@@ -75,7 +81,7 @@ function checkBoundaryIntent(intent, codeByBoundary) {
|
|
|
75
81
|
}
|
|
76
82
|
const findings = [];
|
|
77
83
|
for (const impl of impls) {
|
|
78
|
-
findings.push(...compareIntentToImpl(intent, impl,
|
|
84
|
+
findings.push(...compareIntentToImpl(intent, impl, label));
|
|
79
85
|
}
|
|
80
86
|
return {
|
|
81
87
|
findings,
|
|
@@ -83,7 +89,7 @@ function checkBoundaryIntent(intent, codeByBoundary) {
|
|
|
83
89
|
{
|
|
84
90
|
kind: "boundary",
|
|
85
91
|
intent: intent.name,
|
|
86
|
-
boundary:
|
|
92
|
+
boundary: label,
|
|
87
93
|
implementations: impls.map(codeRef)
|
|
88
94
|
}
|
|
89
95
|
],
|
|
@@ -243,7 +249,7 @@ function indexCodeByBoundary(code) {
|
|
|
243
249
|
if (binding === null) {
|
|
244
250
|
continue;
|
|
245
251
|
}
|
|
246
|
-
const key =
|
|
252
|
+
const key = pairingKey(binding);
|
|
247
253
|
if (key === null) {
|
|
248
254
|
continue;
|
|
249
255
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@suss/checker-intent",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.11",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Pair team-authored intent (IntentSummary) against derived code (BehavioralSummary) and report where they diverge.",
|
|
6
6
|
"keywords": [
|
|
@@ -47,9 +47,9 @@
|
|
|
47
47
|
"zod": "^4.0.0"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@suss/behavioral-ir": "0.5.
|
|
51
|
-
"@suss/intent-ir": "0.5.
|
|
52
|
-
"@suss/ir-core": "0.5.
|
|
50
|
+
"@suss/behavioral-ir": "0.5.11",
|
|
51
|
+
"@suss/intent-ir": "0.5.11",
|
|
52
|
+
"@suss/ir-core": "0.5.11"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"tsup": "*",
|