@suss/checker-intent 0.3.1 → 0.4.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/README.md +17 -16
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +2 -2
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
# @suss/checker-intent
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
fails to satisfy what the team declared.
|
|
3
|
+
Pairs team-authored intent against derived code and reports where the
|
|
4
|
+
code fails to satisfy what the team declared.
|
|
5
5
|
|
|
6
6
|
## What this package is
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
behavioral peer checker)
|
|
10
|
-
(from `@suss/contract-intent`) on one side,
|
|
11
|
-
other
|
|
12
|
-
("the team declared X; does the code do it?"),
|
|
13
|
-
provider↔consumer mismatch.
|
|
8
|
+
This is the intent half of suss's checking, and it is deliberately
|
|
9
|
+
separate from `@suss/checker` (the behavioral peer checker). The inputs
|
|
10
|
+
differ: an `IntentSummary` (from `@suss/contract-intent`) on one side, a
|
|
11
|
+
`BehavioralSummary` on the other. So does the output. An `IntentFinding`
|
|
12
|
+
is one-sided coverage ("the team declared X; does the code do it?"),
|
|
13
|
+
rather than a symmetric provider↔consumer mismatch.
|
|
14
14
|
|
|
15
15
|
```ts
|
|
16
16
|
import { checkIntentAgreement } from "@suss/checker-intent";
|
|
@@ -18,8 +18,8 @@ import { checkIntentAgreement } from "@suss/checker-intent";
|
|
|
18
18
|
const findings = checkIntentAgreement(intentSummaries, codeSummaries);
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
For each boundary intent, it pairs against the code summaries
|
|
22
|
-
same boundary key and emits:
|
|
21
|
+
For each boundary intent, it pairs against the code summaries that share
|
|
22
|
+
the same boundary key, and emits:
|
|
23
23
|
|
|
24
24
|
- `unimplementedBoundary`: the intent declares a boundary no code produces.
|
|
25
25
|
- `uncoveredOutcome`: a declared outcome (response / return / throw) the code never produces.
|
|
@@ -27,14 +27,15 @@ same boundary key and emits:
|
|
|
27
27
|
- `undeclaredOutcome`: code produces a REST status the intent doesn't declare (info; intent under-specifies).
|
|
28
28
|
|
|
29
29
|
v0 checks system intent (`kind: boundary`). PRD outcome intent
|
|
30
|
-
(`kind: prd`),
|
|
30
|
+
(`kind: prd`), which covers scenarios and links, is a separate pass.
|
|
31
31
|
|
|
32
|
-
## Where it
|
|
32
|
+
## Where it fits in suss
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
`@suss/behavioral-ir` (code summaries), and
|
|
36
|
-
shared comparison primitives (`boundaryKey`,
|
|
37
|
-
agree on with the behavioral checker.
|
|
34
|
+
This package depends on `@suss/intent-ir` (the intent shapes and
|
|
35
|
+
`IntentFinding`), `@suss/behavioral-ir` (the code summaries), and
|
|
36
|
+
`@suss/ir-core` for the shared comparison primitives (`boundaryKey`,
|
|
37
|
+
`bodyShapesMatch`) that it has to agree on with the behavioral checker.
|
|
38
|
+
It does **not** depend on
|
|
38
39
|
`@suss/checker`. The full design is in
|
|
39
40
|
[`docs/internal/proposals/intent-specs.md`](../../docs/internal/proposals/intent-specs.md).
|
|
40
41
|
|
package/dist/index.cjs
CHANGED
|
@@ -81,7 +81,7 @@ function checkBoundaryIntent(intent, codeByBoundary) {
|
|
|
81
81
|
message: `Intent "${intent.name}" declares boundary ${key} with ${intent.outcomes.length} outcome(s); no code produces this boundary.`
|
|
82
82
|
}
|
|
83
83
|
],
|
|
84
|
-
// The comparison ran
|
|
84
|
+
// The comparison ran: finding no implementation IS the result.
|
|
85
85
|
checked: [
|
|
86
86
|
{
|
|
87
87
|
kind: "boundary",
|
|
@@ -195,7 +195,7 @@ function resolveScenarioLink(prd, scenarioTitle, label, ref, boundaryByName) {
|
|
|
195
195
|
return {
|
|
196
196
|
kind: "danglingScenarioLink",
|
|
197
197
|
severity: "warning",
|
|
198
|
-
// The intent resolved even though the outcome didn't
|
|
198
|
+
// The intent resolved even though the outcome didn't, key on its
|
|
199
199
|
// boundary so a narrow .sussignore rule can target this finding.
|
|
200
200
|
boundary: (0, import_ir_core.boundaryKey)(target.boundary) ?? prdBoundaryLabel(prd),
|
|
201
201
|
intent: { name: prd.title },
|
package/dist/index.d.cts
CHANGED
|
@@ -26,7 +26,7 @@ interface CheckedPrd {
|
|
|
26
26
|
unlinked: number;
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
|
-
* A declared intent that was compared
|
|
29
|
+
* A declared intent that was compared, either a boundary intent paired
|
|
30
30
|
* against code or a PRD whose scenario links were resolved. Discriminated
|
|
31
31
|
* on `kind` so callers render both without a parallel structure; when a
|
|
32
32
|
* third doc kind (workflow) ships it extends this union.
|
|
@@ -44,9 +44,9 @@ interface UncheckedIntent {
|
|
|
44
44
|
* The full result of an intent-agreement pass. Mirrors the behavioural
|
|
45
45
|
* checker's shape philosophy (`checkAll` → findings + pairs +
|
|
46
46
|
* unmatched): findings are what to fix; checked / unchecked are the
|
|
47
|
-
* coverage accounting
|
|
47
|
+
* coverage accounting: which declared intent was actually compared.
|
|
48
48
|
* Callers render or gate on this without knowing which doc kinds the
|
|
49
|
-
* checker compared
|
|
49
|
+
* checker compared: boundary intents and PRDs both land in `checked`
|
|
50
50
|
* (a discriminated union). `unchecked` is reserved for intent that
|
|
51
51
|
* couldn't be compared at all (an unkeyable boundary), never silently
|
|
52
52
|
* dropped.
|
|
@@ -64,7 +64,7 @@ interface CheckIntentResult {
|
|
|
64
64
|
* `unchecked`, never silently dropped.
|
|
65
65
|
*
|
|
66
66
|
* Findings against `source: "inferred"` intent are downgraded one severity
|
|
67
|
-
* level
|
|
67
|
+
* level: the intent describes what the code did when the inference ran, so
|
|
68
68
|
* a divergence is most likely a code change since, not an authoring error.
|
|
69
69
|
* Curation (`"inferred, curated"`) restores full severity.
|
|
70
70
|
*/
|
|
@@ -76,7 +76,7 @@ declare function checkIntentAgreement(intents: IntentSummary[], code: Behavioral
|
|
|
76
76
|
* as: `kind` → the intent finding kind; `boundary` → the finding's
|
|
77
77
|
* boundary key (exact for `fn:` / `gql:` keys, path-normalized for
|
|
78
78
|
* REST). A rule that specifies `consumer` or `provider` never matches
|
|
79
|
-
* an intent finding
|
|
79
|
+
* an intent finding: it has neither side.
|
|
80
80
|
*/
|
|
81
81
|
declare function applyIntentSuppressions(findings: IntentFinding[], rules: SuppressionRule[], opts?: {
|
|
82
82
|
keepHidden?: boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ interface CheckedPrd {
|
|
|
26
26
|
unlinked: number;
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
|
-
* A declared intent that was compared
|
|
29
|
+
* A declared intent that was compared, either a boundary intent paired
|
|
30
30
|
* against code or a PRD whose scenario links were resolved. Discriminated
|
|
31
31
|
* on `kind` so callers render both without a parallel structure; when a
|
|
32
32
|
* third doc kind (workflow) ships it extends this union.
|
|
@@ -44,9 +44,9 @@ interface UncheckedIntent {
|
|
|
44
44
|
* The full result of an intent-agreement pass. Mirrors the behavioural
|
|
45
45
|
* checker's shape philosophy (`checkAll` → findings + pairs +
|
|
46
46
|
* unmatched): findings are what to fix; checked / unchecked are the
|
|
47
|
-
* coverage accounting
|
|
47
|
+
* coverage accounting: which declared intent was actually compared.
|
|
48
48
|
* Callers render or gate on this without knowing which doc kinds the
|
|
49
|
-
* checker compared
|
|
49
|
+
* checker compared: boundary intents and PRDs both land in `checked`
|
|
50
50
|
* (a discriminated union). `unchecked` is reserved for intent that
|
|
51
51
|
* couldn't be compared at all (an unkeyable boundary), never silently
|
|
52
52
|
* dropped.
|
|
@@ -64,7 +64,7 @@ interface CheckIntentResult {
|
|
|
64
64
|
* `unchecked`, never silently dropped.
|
|
65
65
|
*
|
|
66
66
|
* Findings against `source: "inferred"` intent are downgraded one severity
|
|
67
|
-
* level
|
|
67
|
+
* level: the intent describes what the code did when the inference ran, so
|
|
68
68
|
* a divergence is most likely a code change since, not an authoring error.
|
|
69
69
|
* Curation (`"inferred, curated"`) restores full severity.
|
|
70
70
|
*/
|
|
@@ -76,7 +76,7 @@ declare function checkIntentAgreement(intents: IntentSummary[], code: Behavioral
|
|
|
76
76
|
* as: `kind` → the intent finding kind; `boundary` → the finding's
|
|
77
77
|
* boundary key (exact for `fn:` / `gql:` keys, path-normalized for
|
|
78
78
|
* REST). A rule that specifies `consumer` or `provider` never matches
|
|
79
|
-
* an intent finding
|
|
79
|
+
* an intent finding: it has neither side.
|
|
80
80
|
*/
|
|
81
81
|
declare function applyIntentSuppressions(findings: IntentFinding[], rules: SuppressionRule[], opts?: {
|
|
82
82
|
keepHidden?: boolean;
|
package/dist/index.js
CHANGED
|
@@ -61,7 +61,7 @@ function checkBoundaryIntent(intent, codeByBoundary) {
|
|
|
61
61
|
message: `Intent "${intent.name}" declares boundary ${key} with ${intent.outcomes.length} outcome(s); no code produces this boundary.`
|
|
62
62
|
}
|
|
63
63
|
],
|
|
64
|
-
// The comparison ran
|
|
64
|
+
// The comparison ran: finding no implementation IS the result.
|
|
65
65
|
checked: [
|
|
66
66
|
{
|
|
67
67
|
kind: "boundary",
|
|
@@ -175,7 +175,7 @@ function resolveScenarioLink(prd, scenarioTitle, label, ref, boundaryByName) {
|
|
|
175
175
|
return {
|
|
176
176
|
kind: "danglingScenarioLink",
|
|
177
177
|
severity: "warning",
|
|
178
|
-
// The intent resolved even though the outcome didn't
|
|
178
|
+
// The intent resolved even though the outcome didn't, key on its
|
|
179
179
|
// boundary so a narrow .sussignore rule can target this finding.
|
|
180
180
|
boundary: boundaryKey(target.boundary) ?? prdBoundaryLabel(prd),
|
|
181
181
|
intent: { name: prd.title },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@suss/checker-intent",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
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.
|
|
51
|
-
"@suss/intent-ir": "0.
|
|
52
|
-
"@suss/ir-core": "0.
|
|
50
|
+
"@suss/behavioral-ir": "0.4.0",
|
|
51
|
+
"@suss/intent-ir": "0.4.0",
|
|
52
|
+
"@suss/ir-core": "0.4.0"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"tsup": "*",
|