@descryy/mcp 0.5.0 → 0.6.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/browser/driver.d.ts +51 -2
- package/dist/browser/driver.d.ts.map +1 -1
- package/dist/browser/driver.js +16 -2
- package/dist/browser/driver.js.map +1 -1
- package/dist/browser/evidence.d.ts +9 -0
- package/dist/browser/evidence.d.ts.map +1 -1
- package/dist/browser/evidence.js +10 -2
- package/dist/browser/evidence.js.map +1 -1
- package/dist/browser/fake-driver.d.ts +8 -0
- package/dist/browser/fake-driver.d.ts.map +1 -1
- package/dist/browser/fake-driver.js +22 -1
- package/dist/browser/fake-driver.js.map +1 -1
- package/dist/browser/playwright-driver.d.ts +36 -2
- package/dist/browser/playwright-driver.d.ts.map +1 -1
- package/dist/browser/playwright-driver.js +176 -19
- package/dist/browser/playwright-driver.js.map +1 -1
- package/dist/browser/scenario-runner.d.ts.map +1 -1
- package/dist/browser/scenario-runner.js +3 -1
- package/dist/browser/scenario-runner.js.map +1 -1
- package/dist/browser/tool-support.js +1 -1
- package/dist/browser/tool-support.js.map +1 -1
- package/dist/capped.d.ts +41 -0
- package/dist/capped.d.ts.map +1 -0
- package/dist/capped.js +35 -0
- package/dist/capped.js.map +1 -0
- package/dist/render.d.ts +37 -0
- package/dist/render.d.ts.map +1 -1
- package/dist/render.js +52 -4
- package/dist/render.js.map +1 -1
- package/dist/runtime-registry.d.ts +19 -1
- package/dist/runtime-registry.d.ts.map +1 -1
- package/dist/runtime-registry.js +88 -4
- package/dist/runtime-registry.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +23 -1
- package/dist/server.js.map +1 -1
- package/dist/session.d.ts +22 -0
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +27 -1
- package/dist/session.js.map +1 -1
- package/dist/tools/analyze.d.ts +23 -3
- package/dist/tools/analyze.d.ts.map +1 -1
- package/dist/tools/analyze.js +34 -2
- package/dist/tools/analyze.js.map +1 -1
- package/dist/tools/browser-save-scenario.d.ts.map +1 -1
- package/dist/tools/browser-save-scenario.js +109 -3
- package/dist/tools/browser-save-scenario.js.map +1 -1
- package/dist/tools/browser-start-session.d.ts.map +1 -1
- package/dist/tools/browser-start-session.js +9 -0
- package/dist/tools/browser-start-session.js.map +1 -1
- package/dist/tools/contracts.d.ts +41 -10
- package/dist/tools/contracts.d.ts.map +1 -1
- package/dist/tools/contracts.js +117 -17
- package/dist/tools/contracts.js.map +1 -1
- package/dist/tools/cross-pr.d.ts +39 -10
- package/dist/tools/cross-pr.d.ts.map +1 -1
- package/dist/tools/cross-pr.js +113 -29
- package/dist/tools/cross-pr.js.map +1 -1
- package/dist/tools/git-diff.d.ts.map +1 -1
- package/dist/tools/git-diff.js +30 -2
- package/dist/tools/git-diff.js.map +1 -1
- package/dist/tools/observe-runtime.js +1 -1
- package/dist/tools/observe-runtime.js.map +1 -1
- package/dist/tools/observe-tests.d.ts +12 -0
- package/dist/tools/observe-tests.d.ts.map +1 -1
- package/dist/tools/observe-tests.js +59 -5
- package/dist/tools/observe-tests.js.map +1 -1
- package/dist/tools/pre-push.d.ts +40 -7
- package/dist/tools/pre-push.d.ts.map +1 -1
- package/dist/tools/pre-push.js +65 -23
- package/dist/tools/pre-push.js.map +1 -1
- package/dist/tools/scope.d.ts.map +1 -1
- package/dist/tools/scope.js +20 -4
- package/dist/tools/scope.js.map +1 -1
- package/dist/tools/validate.d.ts +40 -1
- package/dist/tools/validate.d.ts.map +1 -1
- package/dist/tools/validate.js +150 -27
- package/dist/tools/validate.js.map +1 -1
- package/package.json +20 -12
package/dist/tools/pre-push.js
CHANGED
|
@@ -38,12 +38,28 @@
|
|
|
38
38
|
*
|
|
39
39
|
* ## Blocking versus informational
|
|
40
40
|
*
|
|
41
|
-
* `blockingTotal` counts `contracts` and `validate` findings only
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
41
|
+
* `blockingTotal` counts `contracts` and `validate` findings only, and — since
|
|
42
|
+
* UAT round 3, Suggestion 6 — only the ones each tool's own `claim` field
|
|
43
|
+
* marks a `defect`. `scope` and `pr_analysis` answer "what does this change
|
|
44
|
+
* touch" — real, useful, and not a defect, so counting them would make every
|
|
45
|
+
* change with a blast radius look like a failure. A `lead` (`ROUTE_NOT_CALLED`,
|
|
46
|
+
* `SET_BUT_UNDOCUMENTED`) is worth a look but is not provable from the graph
|
|
47
|
+
* alone, so it is counted separately in `leadTotal` rather than folded into
|
|
48
|
+
* the number a git hook branches on. `descry check` exits non-zero on
|
|
49
|
+
* `blockingTotal`, which is why the line has to be drawn here rather than
|
|
50
|
+
* left to the caller.
|
|
51
|
+
*
|
|
52
|
+
* ## Scoped to what you are pushing
|
|
53
|
+
*
|
|
54
|
+
* UAT round 3, B11. `contracts` did not receive the `files` this tool was
|
|
55
|
+
* called with, so `blockingTotal` counted the repository's entire standing
|
|
56
|
+
* backlog rather than the change being pushed — 15 pre-existing
|
|
57
|
+
* `ROUTE_NOT_CALLED` findings for unrelated paths, on a push touching three
|
|
58
|
+
* unrelated files. `contracts` now takes the same `files` this tool was
|
|
59
|
+
* given (it already accepted `paths`, a different axis — a URL template
|
|
60
|
+
* substring, not a source file), so both blocking sources answer about the
|
|
61
|
+
* files in front of the developer. `validate` already took `files`; only the
|
|
62
|
+
* threading into `contracts` was missing.
|
|
47
63
|
*
|
|
48
64
|
* ## Class and tier
|
|
49
65
|
*
|
|
@@ -97,6 +113,10 @@ function listOf(data, key) {
|
|
|
97
113
|
const value = data[key];
|
|
98
114
|
return Array.isArray(value) ? value : [];
|
|
99
115
|
}
|
|
116
|
+
/** How many of `items` carry `claim: "defect"`. Items with no `claim` at all (scope, pr_analysis) count as zero. */
|
|
117
|
+
function defectsIn(items) {
|
|
118
|
+
return items.filter((item) => item.claim === "defect").length;
|
|
119
|
+
}
|
|
100
120
|
async function run(args, ctx) {
|
|
101
121
|
const files = optionalStringArray(args, "files") ?? [];
|
|
102
122
|
const perSource = optionalInteger(args, "perSource", 1) ?? PER_SOURCE;
|
|
@@ -110,9 +130,10 @@ async function run(args, ctx) {
|
|
|
110
130
|
"Sources are NOT ranked against each other. Whether a contract mismatch outranks an unset " +
|
|
111
131
|
"environment variable is a judgement Descry has no model for, so each source contributes its " +
|
|
112
132
|
"own top few and the totals say what they were selected from.",
|
|
113
|
-
"blockingTotal counts contracts and validate findings
|
|
114
|
-
"change touches, which is not a defect
|
|
115
|
-
"
|
|
133
|
+
"blockingTotal counts contracts and validate findings claimed as defects only — see claim on " +
|
|
134
|
+
"each finding. scope and pr_analysis answer what a change touches, which is not a defect, and " +
|
|
135
|
+
"a lead (worth a look, not provable from the graph alone) is counted separately in leadTotal " +
|
|
136
|
+
"rather than folded into the number a hook branches on.",
|
|
116
137
|
];
|
|
117
138
|
if (files.length === 0) {
|
|
118
139
|
return answer({
|
|
@@ -125,7 +146,7 @@ async function run(args, ctx) {
|
|
|
125
146
|
irSchemaVersion: base.irSchemaVersion,
|
|
126
147
|
commitSpread: base.commitSpread,
|
|
127
148
|
notes,
|
|
128
|
-
data: { files: [], sections: [], blockingTotal: 0, nodeBudget },
|
|
149
|
+
data: { files: [], sections: [], blockingTotal: 0, leadTotal: 0, nodeBudget },
|
|
129
150
|
});
|
|
130
151
|
}
|
|
131
152
|
// Sequential rather than concurrent, deliberately: these share one SQLite
|
|
@@ -152,6 +173,7 @@ async function run(args, ctx) {
|
|
|
152
173
|
source,
|
|
153
174
|
state: "failed",
|
|
154
175
|
total: 0,
|
|
176
|
+
defects: 0,
|
|
155
177
|
shown: [],
|
|
156
178
|
blocking,
|
|
157
179
|
headline: `${source} failed: ${error instanceof Error ? error.message : String(error)}`,
|
|
@@ -164,6 +186,9 @@ async function run(args, ctx) {
|
|
|
164
186
|
source,
|
|
165
187
|
state: sub.state,
|
|
166
188
|
total: items.length,
|
|
189
|
+
// scope and pr_analysis carry no `claim` at all — `defectsIn` reads 0 for
|
|
190
|
+
// them, which is correct: neither reports a claim that something is wrong.
|
|
191
|
+
defects: defectsIn(items),
|
|
167
192
|
shown: items.slice(0, perSource),
|
|
168
193
|
blocking,
|
|
169
194
|
headline: sub.headline,
|
|
@@ -181,6 +206,7 @@ async function run(args, ctx) {
|
|
|
181
206
|
source: "pr_analysis",
|
|
182
207
|
state: "refused",
|
|
183
208
|
total: 0,
|
|
209
|
+
defects: 0,
|
|
184
210
|
shown: [],
|
|
185
211
|
blocking: false,
|
|
186
212
|
headline: "pr_analysis needs a base ref to diff against and has no default. Pass \"base\" to include it.",
|
|
@@ -201,12 +227,21 @@ async function run(args, ctx) {
|
|
|
201
227
|
}
|
|
202
228
|
await runOne("contracts", contractsTool,
|
|
203
229
|
// pathsOnly is what the pre-push tier means for a tool with no traversal to
|
|
204
|
-
// budget — see the module header.
|
|
205
|
-
|
|
230
|
+
// budget — see the module header. `files` is UAT round 3, B11: without it,
|
|
231
|
+
// contracts compared the whole graph and this section's total was the
|
|
232
|
+
// repository's standing backlog, not the change being pushed.
|
|
233
|
+
{ pathsOnly: true, files },
|
|
234
|
+
// shapeMismatches is always empty under pathsOnly, but folded in anyway
|
|
235
|
+
// rather than assumed empty — a future call that drops pathsOnly should
|
|
236
|
+
// not silently under-count defects here.
|
|
237
|
+
(data) => [...listOf(data, "findings"), ...listOf(data, "shapeMismatches")], true);
|
|
206
238
|
await runOne("validate", validateTool, { files, maxFindings: VALIDATE_MAX_FINDINGS }, (data) => listOf(data, "findings"), true);
|
|
207
239
|
const blockingTotal = sections
|
|
208
240
|
.filter((section) => section.blocking)
|
|
209
|
-
.reduce((sum, section) => sum + section.
|
|
241
|
+
.reduce((sum, section) => sum + section.defects, 0);
|
|
242
|
+
const leadTotal = sections
|
|
243
|
+
.filter((section) => section.blocking)
|
|
244
|
+
.reduce((sum, section) => sum + (section.total - section.defects), 0);
|
|
210
245
|
const failed = sections.filter((section) => section.state === "failed");
|
|
211
246
|
if (failed.length > 0) {
|
|
212
247
|
notes.push(`${failed.length} of 4 constituent(s) failed and contributed nothing: ` +
|
|
@@ -214,15 +249,20 @@ async function run(args, ctx) {
|
|
|
214
249
|
"reply is not.");
|
|
215
250
|
}
|
|
216
251
|
return answer({
|
|
217
|
-
headline: blockingTotal
|
|
218
|
-
?
|
|
219
|
-
|
|
220
|
-
"contracts and validate sections."
|
|
252
|
+
headline: blockingTotal > 0
|
|
253
|
+
? `${blockingTotal} defect(s) blocking across ${files.length} changed file(s)` +
|
|
254
|
+
(leadTotal > 0 ? `, plus ${leadTotal} lead(s) to review` : "") +
|
|
255
|
+
" — see the contracts and validate sections."
|
|
256
|
+
: leadTotal > 0
|
|
257
|
+
? `No blocking defects across ${files.length} changed file(s); ${leadTotal} lead(s) to ` +
|
|
258
|
+
"review — see the contracts and validate sections."
|
|
259
|
+
: `No contract or environment findings across ${files.length} changed file(s).`,
|
|
221
260
|
// `empty` is earned here: all four ran against a real graph and found
|
|
222
|
-
// nothing blocking. A constituent that refused makes that
|
|
223
|
-
// state follows the weakest link rather than the happy
|
|
224
|
-
|
|
225
|
-
|
|
261
|
+
// nothing at all, blocking or not. A constituent that refused makes that
|
|
262
|
+
// untrue, so the state follows the weakest link rather than the happy
|
|
263
|
+
// path — and a lead is still something found, so it is `ok`, not `empty`.
|
|
264
|
+
state: failed.length > 0 ? "failed" : blockingTotal > 0 || leadTotal > 0 ? "ok" : "empty",
|
|
265
|
+
data: { files, sections, blockingTotal, leadTotal, nodeBudget },
|
|
226
266
|
resolutionFloor: (floors.length === 0 ? 0 : Math.min(...floors)),
|
|
227
267
|
nameLevel: true,
|
|
228
268
|
commitSha: base.commitSha,
|
|
@@ -242,8 +282,10 @@ export const prePushTool = {
|
|
|
242
282
|
"returns one short envelope: what your change touches, what it touches that has no test, which " +
|
|
243
283
|
"API contracts break, and which environment claims do not hold. Each source contributes its own " +
|
|
244
284
|
"top few — they are deliberately not ranked against each other, because Descry has no model for " +
|
|
245
|
-
"whether a contract mismatch outranks an unset variable.
|
|
246
|
-
"
|
|
285
|
+
"whether a contract mismatch outranks an unset variable. Both are scoped to the files you pass, " +
|
|
286
|
+
"not the repository's whole backlog. blockingTotal counts only defects (provable from the graph " +
|
|
287
|
+
"alone) from the two sources that report them, and is what a git hook should branch on; leads " +
|
|
288
|
+
"(worth a look, not provable alone) are counted separately in leadTotal.",
|
|
247
289
|
inputSchema: SCHEMA,
|
|
248
290
|
run,
|
|
249
291
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pre-push.js","sourceRoot":"","sources":["../../src/tools/pre-push.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"pre-push.js","sourceRoot":"","sources":["../../src/tools/pre-push.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmEG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EACL,MAAM,EACN,eAAe,EACf,cAAc,EACd,mBAAmB,GAGpB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAG7C,gGAAgG;AAChG,MAAM,UAAU,GAAG,CAAC,CAAC;AAErB,2EAA2E;AAC3E,MAAM,qBAAqB,GAAG,EAAE,CAAC;AAEjC,MAAM,MAAM,GAAG;IACb,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,KAAK,EAAE;YACL,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YACzB,WAAW,EACT,yFAAyF;gBACzF,uFAAuF;SAC1F;QACD,IAAI,EAAE;YACJ,IAAI,EAAE,QAAQ;YACd,WAAW,EACT,0FAA0F;gBAC1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;IAC3E,WAAW,EAAE,MAA4C;IACzD,GAAG;CACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scope.d.ts","sourceRoot":"","sources":["../../src/tools/scope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAA8C,KAAK,SAAS,EAAE,MAAM,eAAe,CAAC;AAC3F,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAOL,KAAK,SAAS,EAEd,KAAK,cAAc,EACpB,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"scope.d.ts","sourceRoot":"","sources":["../../src/tools/scope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAA8C,KAAK,SAAS,EAAE,MAAM,eAAe,CAAC;AAC3F,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAOL,KAAK,SAAS,EAEd,KAAK,cAAc,EACpB,MAAM,UAAU,CAAC;AAIlB,iDAAiD;AACjD,MAAM,WAAW,gBAAiB,SAAQ,SAAS;IACjD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,sEAAsE;IACtE,QAAQ,CAAC,GAAG,CAAC,EAAE,QAAQ,CAAC;CACzB;AAED,8EAA8E;AAC9E,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,OAAO,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAC9C,gEAAgE;IAChE,QAAQ,CAAC,QAAQ,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAC/C,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,SAAS,cAAc,EAAE,CAAC;CAC5C;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,OAAO,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAC9C,QAAQ,CAAC,QAAQ,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAC/C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,MAAM,SAAS,GAAG,WAAW,GAAG,cAAc,CAAC;AA0KrD,eAAO,MAAM,SAAS,EAAE,cAavB,CAAC"}
|
package/dist/tools/scope.js
CHANGED
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
import { nodesInFiles, scopeChange } from "@descryy/core";
|
|
19
19
|
import { answer, briefNode, optionalEnum, optionalInteger, optionalStringArray, ToolInputError, } from "./kit.js";
|
|
20
|
+
import { capped } from "../capped.js";
|
|
20
21
|
const TRIGGERS = ["pre-push", "pr", "nightly"];
|
|
21
22
|
const SCHEMA = {
|
|
22
23
|
type: "object",
|
|
@@ -113,9 +114,15 @@ async function run(args, ctx) {
|
|
|
113
114
|
...(budget === undefined ? {} : { budget }),
|
|
114
115
|
});
|
|
115
116
|
const affected = scoped.data.affected;
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
117
|
+
// B6 — `capped()` produces the slice and its shown/total detail together,
|
|
118
|
+
// so this reply cannot cap without carrying what it capped. Previously this
|
|
119
|
+
// sliced by hand and only ever updated the prose note (below); `truncated`
|
|
120
|
+
// and `truncatedDetail` were never set, so `render.ts` reported `null` —
|
|
121
|
+
// this tool's reply was shorter than the scope it computed and nothing on
|
|
122
|
+
// the wire said so.
|
|
123
|
+
const cap = capped(affected, limit);
|
|
124
|
+
if (cap.detail !== null) {
|
|
125
|
+
notes.push(`${cap.detail.total - cap.detail.shown} lower-scoring affected node(s) are in the scope but not ` +
|
|
119
126
|
`listed here — the reply is capped at ${limit}. Raise "limit" to see them; they were ` +
|
|
120
127
|
"analysed either way.");
|
|
121
128
|
}
|
|
@@ -130,15 +137,24 @@ async function run(args, ctx) {
|
|
|
130
137
|
...scoped,
|
|
131
138
|
data: {
|
|
132
139
|
changed: scoped.data.changed.map(shape),
|
|
133
|
-
affected: shown.map(shape),
|
|
140
|
+
affected: cap.shown.map(shape),
|
|
134
141
|
affectedTotal: affected.length,
|
|
135
142
|
droppedForBudget: scoped.data.dropped.length,
|
|
136
143
|
budget: scoped.data.budget,
|
|
137
144
|
budgetUsed: scoped.data.budgetUsed,
|
|
138
145
|
byTier,
|
|
139
146
|
},
|
|
147
|
+
// Deliberately not `scoped.truncated` (`traverse.ts`'s own flag for
|
|
148
|
+
// nodes the node *budget* dropped before they ever reached `affected`).
|
|
149
|
+
// That is a different fact — fully disclosed on its own via
|
|
150
|
+
// `droppedForBudget` and `scoped.notes` — from "this reply is shorter
|
|
151
|
+
// than the scope this tool computed," which is what `truncated` here
|
|
152
|
+
// means. Conflating the two would make `total` claim a count this tool
|
|
153
|
+
// never actually reached.
|
|
154
|
+
truncated: cap.detail !== null,
|
|
140
155
|
notes: [...scoped.notes, ...notes],
|
|
141
156
|
},
|
|
157
|
+
...(cap.detail === null ? {} : { truncatedDetail: cap.detail }),
|
|
142
158
|
...(affected.length === 0 ? { state: "empty" } : {}),
|
|
143
159
|
nameLevel: true,
|
|
144
160
|
headline: `${scoped.data.changed.length} changed symbol(s) reach ${affected.length} other node(s) ` +
|
package/dist/tools/scope.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scope.js","sourceRoot":"","sources":["../../src/tools/scope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,E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,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,4BAA4B,QAAQ,CAAC,MAAM,iBAAiB;YACzF,yCAAyC,OAAO,cAAc,MAAM,CAAC,IAAI,CAAC,MAAM,GAAG;KACtF,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,SAAS,GAAmB;IACvC,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,MAAM;IACb,IAAI,EAAE,UAAU;IAChB,OAAO,EAAE,OAAO;IAChB,KAAK,EAAE,0BAA0B;IACjC,WAAW,EACT,8FAA8F;QAC9F,yFAAyF;QACzF,8FAA8F;QAC9F,0EAA0E;IAC5E,WAAW,EAAE,MAA4C;IACzD,GAAG;CACJ,CAAC"}
|
package/dist/tools/validate.d.ts
CHANGED
|
@@ -20,8 +20,22 @@
|
|
|
20
20
|
*
|
|
21
21
|
* The declaration half runs regardless: configuration files are read straight
|
|
22
22
|
* from the repository, which needs no adapter and no resolution.
|
|
23
|
+
*
|
|
24
|
+
* ## "By default" above is load-bearing: pass `files` and a second rule runs
|
|
25
|
+
*
|
|
26
|
+
* UAT round 3, Suggestion 4. Rule 1's own precondition — the accessor has to
|
|
27
|
+
* fail on absence — made this check structurally silent on real work: a
|
|
28
|
+
* Python feature read two new third-party API keys through
|
|
29
|
+
* `os.environ.get()`, declared nowhere, and this tool said "Clean" because
|
|
30
|
+
* nothing anywhere asserted requirement. Pass `files` (the diff you are
|
|
31
|
+
* about to push, exactly the same scope `contracts`' `paths` and this tool's
|
|
32
|
+
* own `files` already narrow to elsewhere) and a second rule, gated only on
|
|
33
|
+
* "new in this diff" rather than on accessor shape, reports
|
|
34
|
+
* `NEW_READ_UNDECLARED` for any such read regardless of whether it would
|
|
35
|
+
* fail on absence — see `validation/env.ts`'s own header for why that
|
|
36
|
+
* substitution keeps precision high without an extra guard.
|
|
23
37
|
*/
|
|
24
|
-
import type { ConfigGraph, ConfigReadSite, EnvClaim, EnvEvidence, EnvFindingKind, EnvReport, RollbackFinding, RollbackReport } from "@descryy/core";
|
|
38
|
+
import type { AttributeFinding, AttributeReport, ConfigGraph, ConfigReadSite, EnvClaim, EnvEvidence, EnvFindingKind, EnvReport, MigrationIntegrityFinding, MigrationIntegrityReport, RollbackFinding, RollbackReport } from "@descryy/core";
|
|
25
39
|
import type { ResolutionLevel } from "@descryy/ir";
|
|
26
40
|
import { type ToolDefinition } from "./kit.ts";
|
|
27
41
|
/**
|
|
@@ -98,6 +112,31 @@ export interface ValidateData {
|
|
|
98
112
|
/** Named in plain words when `ran` is false. */
|
|
99
113
|
readonly blockers: readonly string[];
|
|
100
114
|
};
|
|
115
|
+
/**
|
|
116
|
+
* §"an attribute is read, and the type does not declare it" — always a
|
|
117
|
+
* defect, never a lead: this is a contradiction between two producers that
|
|
118
|
+
* must agree, provable from the graph alone.
|
|
119
|
+
*/
|
|
120
|
+
readonly attributeExistence: {
|
|
121
|
+
readonly findings: readonly AttributeFinding[];
|
|
122
|
+
readonly findingsTotal: number;
|
|
123
|
+
readonly examined: AttributeReport["examined"];
|
|
124
|
+
/** False when no READS edge onto a type-like node carried field-existence info at all. */
|
|
125
|
+
readonly ran: boolean;
|
|
126
|
+
};
|
|
127
|
+
/**
|
|
128
|
+
* §"a migration outside the migrations directory, or a broken revision
|
|
129
|
+
* chain" — both always defects, both provable from the graph alone.
|
|
130
|
+
*/
|
|
131
|
+
readonly migrationIntegrity: {
|
|
132
|
+
readonly findings: readonly MigrationIntegrityFinding[];
|
|
133
|
+
readonly findingsTotal: number;
|
|
134
|
+
readonly examined: MigrationIntegrityReport["examined"];
|
|
135
|
+
readonly migrationsDirectory: string | null;
|
|
136
|
+
/** False when no module in the graph carried migration revision attrs. */
|
|
137
|
+
readonly ran: boolean;
|
|
138
|
+
readonly withheld: MigrationIntegrityReport["withheld"];
|
|
139
|
+
};
|
|
101
140
|
}
|
|
102
141
|
export declare const validateTool: ToolDefinition;
|
|
103
142
|
//# sourceMappingURL=validate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/tools/validate.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/tools/validate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAYH,OAAO,KAAK,EACV,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,cAAc,EACd,QAAQ,EACR,WAAW,EACX,cAAc,EACd,SAAS,EACT,yBAAyB,EACzB,wBAAwB,EACxB,eAAe,EACf,cAAc,EACf,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,EAA0D,KAAK,cAAc,EAAE,MAAM,UAAU,CAAC;AAGvG;;;;;;;;;GASG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,wDAAwD;IACxD,QAAQ,CAAC,QAAQ,EAAE,SAAS,WAAW,EAAE,CAAC;IAC1C,QAAQ,CAAC,UAAU,EAAE,eAAe,CAAC;CACtC;AAED;;;;;;GAMG;AACH,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,oCAAoC;IACpC,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,yDAAyD;IACzD,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,8BAA8B;IAC9B,QAAQ,CAAC,MAAM,EAAE,SAAS,cAAc,EAAE,CAAC;IAC3C,6DAA6D;IAC7D,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;CACpC;AAED,MAAM,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CAAC;QAC/C,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;QAC/B,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC,UAAU,CAAC,CAAC;QAC/C,0FAA0F;QAC1F,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC;KACvB,CAAC;IACF;;;OAGG;IACH,QAAQ,CAAC,kBAAkB,EAAE;QAC3B,QAAQ,CAAC,QAAQ,EAAE,SAAS,yBAAyB,EAAE,CAAC;QACxD,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;QAC/B,QAAQ,CAAC,QAAQ,EAAE,wBAAwB,CAAC,UAAU,CAAC,CAAC;QACxD,QAAQ,CAAC,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;QAC5C,0EAA0E;QAC1E,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC;QACtB,QAAQ,CAAC,QAAQ,EAAE,wBAAwB,CAAC,UAAU,CAAC,CAAC;KACzD,CAAC;CACH;AA4QD,eAAO,MAAM,YAAY,EAAE,cAwB1B,CAAC"}
|
package/dist/tools/validate.js
CHANGED
|
@@ -20,8 +20,22 @@
|
|
|
20
20
|
*
|
|
21
21
|
* The declaration half runs regardless: configuration files are read straight
|
|
22
22
|
* from the repository, which needs no adapter and no resolution.
|
|
23
|
+
*
|
|
24
|
+
* ## "By default" above is load-bearing: pass `files` and a second rule runs
|
|
25
|
+
*
|
|
26
|
+
* UAT round 3, Suggestion 4. Rule 1's own precondition — the accessor has to
|
|
27
|
+
* fail on absence — made this check structurally silent on real work: a
|
|
28
|
+
* Python feature read two new third-party API keys through
|
|
29
|
+
* `os.environ.get()`, declared nowhere, and this tool said "Clean" because
|
|
30
|
+
* nothing anywhere asserted requirement. Pass `files` (the diff you are
|
|
31
|
+
* about to push, exactly the same scope `contracts`' `paths` and this tool's
|
|
32
|
+
* own `files` already narrow to elsewhere) and a second rule, gated only on
|
|
33
|
+
* "new in this diff" rather than on accessor shape, reports
|
|
34
|
+
* `NEW_READ_UNDECLARED` for any such read regardless of whether it would
|
|
35
|
+
* fail on absence — see `validation/env.ts`'s own header for why that
|
|
36
|
+
* substitution keeps precision high without an extra guard.
|
|
23
37
|
*/
|
|
24
|
-
import { buildConfigGraph, checkEnvironment, checkRollbackReadiness, scanConfigSurfaces, scanMigrations, } from "@descryy/core";
|
|
38
|
+
import { buildConfigGraph, checkAttributeExistence, checkEnvironment, checkMigrationIntegrity, checkRollbackReadiness, scanConfigSurfaces, scanMigrations, } from "@descryy/core";
|
|
25
39
|
import { optionalInteger, optionalStringArray } from "./kit.js";
|
|
26
40
|
const SCHEMA = {
|
|
27
41
|
type: "object",
|
|
@@ -30,7 +44,10 @@ const SCHEMA = {
|
|
|
30
44
|
type: "array",
|
|
31
45
|
items: { type: "string" },
|
|
32
46
|
description: "Restrict the code side to these repo-relative files — the scoped-subgraph run. " +
|
|
33
|
-
"Configuration files are always read in full, because a declaration is repository-wide."
|
|
47
|
+
"Configuration files are always read in full, because a declaration is repository-wide. " +
|
|
48
|
+
"Also enables a second, stronger env-var rule (NEW_READ_UNDECLARED): a variable read in " +
|
|
49
|
+
"one of these files and declared nowhere is reported regardless of whether the accessor " +
|
|
50
|
+
"fails on absence, catching a case the default rule structurally cannot.",
|
|
34
51
|
},
|
|
35
52
|
coverageFloor: {
|
|
36
53
|
type: "number",
|
|
@@ -69,22 +86,88 @@ async function run(args, ctx) {
|
|
|
69
86
|
...(files === undefined ? {} : { files }),
|
|
70
87
|
...(maxFindings === undefined ? {} : { maxFindings }),
|
|
71
88
|
});
|
|
89
|
+
ctx.progress("Checking attribute reads against declared types");
|
|
90
|
+
const attributeExistence = checkAttributeExistence(provider, {
|
|
91
|
+
...(files === undefined ? {} : { files }),
|
|
92
|
+
...(maxFindings === undefined ? {} : { maxFindings }),
|
|
93
|
+
});
|
|
94
|
+
ctx.progress("Checking migration location and revision chain");
|
|
95
|
+
const migrationIntegrity = checkMigrationIntegrity(provider, {
|
|
96
|
+
...(files === undefined ? {} : { files }),
|
|
97
|
+
...(maxFindings === undefined ? {} : { maxFindings }),
|
|
98
|
+
});
|
|
72
99
|
const report = checked.data;
|
|
73
|
-
const defects = report.findings.filter((f) => f.claim === "defect").length
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
100
|
+
const defects = report.findings.filter((f) => f.claim === "defect").length +
|
|
101
|
+
attributeExistence.data.findings.length +
|
|
102
|
+
migrationIntegrity.data.findings.length;
|
|
103
|
+
const leads = report.findings.length - report.findings.filter((f) => f.claim === "defect").length;
|
|
104
|
+
// Nothing was compared at all: no configuration files, no reads, no
|
|
105
|
+
// migration, no attribute read, no migration revision. Any one of them
|
|
106
|
+
// alone is a real answer; none of them is not.
|
|
107
|
+
const nothingToCheck = report.surfaces.length === 0 &&
|
|
108
|
+
!report.readsAvailable &&
|
|
109
|
+
!rollback.data.ran &&
|
|
110
|
+
!attributeExistence.data.ran &&
|
|
111
|
+
!migrationIntegrity.data.ran;
|
|
112
|
+
// UAT round 3, Suggestion 5, audited into this tool too: a `files` scope
|
|
113
|
+
// matching zero FILE nodes in the graph is not a clean result — it means
|
|
114
|
+
// none of the named files were ever read into the graph at all (wrong
|
|
115
|
+
// path, or never parsed), which is a different claim from "read them and
|
|
116
|
+
// they are fine." `filesWithReads + filesWithoutReads` is every FILE node
|
|
117
|
+
// the read side considered under the scope; zero of them existing is the
|
|
118
|
+
// same collapse `contracts(paths: [...])` had, one level down.
|
|
119
|
+
const filesMatchedNothing = files !== undefined && report.reads.filesWithReads + report.reads.filesWithoutReads === 0;
|
|
78
120
|
// MK-7: the leading clause a caller reads first, graded on the axis that
|
|
79
121
|
// actually matters — `claim`. A lead or a rollback finding is worth a look;
|
|
80
122
|
// a defect is the thing this tool exists to catch. Never blur the two into
|
|
81
123
|
// one count, the exact failure `EnvFindingReport.claim`'s own doc names.
|
|
82
124
|
const otherFindings = leads + rollback.data.findings.length;
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
125
|
+
// A "Clean" verdict resting entirely on a files scope that matched nothing
|
|
126
|
+
// is the exact collapse Suggestion 5 names: it would read as "checked your
|
|
127
|
+
// files, they're fine" when in fact none of them were ever read at all.
|
|
128
|
+
// Only the pure-Clean case is downgraded — real findings from the
|
|
129
|
+
// unscoped documentation-drift or rollback checks still deserve to be seen.
|
|
130
|
+
const falseClean = filesMatchedNothing && defects === 0 && otherFindings === 0;
|
|
131
|
+
const verdict = falseClean
|
|
132
|
+
? "not checked"
|
|
133
|
+
: defects > 0
|
|
134
|
+
? `${defects} defect(s) found`
|
|
135
|
+
: otherFindings > 0
|
|
136
|
+
? `No defects; ${otherFindings} lead(s)/rollback finding(s) to review`
|
|
137
|
+
: "Clean";
|
|
138
|
+
const scopeNotes = filesMatchedNothing
|
|
139
|
+
? [
|
|
140
|
+
`0 of the ${(files ?? []).length} named file(s) matched a FILE node this graph's read side ` +
|
|
141
|
+
"considered — either the path is wrong, or the file was never read into the graph. The " +
|
|
142
|
+
"environment-read half of this report has nothing to say about them; it is not evidence " +
|
|
143
|
+
"they are clean.",
|
|
144
|
+
]
|
|
145
|
+
: [];
|
|
146
|
+
// Hand-off from Lane 2 (B6): render.ts now refuses to relay a `truncated`
|
|
147
|
+
// answer with no `truncatedDetail`. `result.truncated` below is one boolean
|
|
148
|
+
// folded from five independently-truncatable sources — env findings,
|
|
149
|
+
// rollback findings, attribute-existence findings, migration-integrity
|
|
150
|
+
// findings, and configGraph's own dependent-variable enumeration — so no
|
|
151
|
+
// single shown/total pair can describe all of them exactly. `shown`/`total`
|
|
152
|
+
// cover the four finding lists a maxFindings cap actually acts on;
|
|
153
|
+
// configGraph's truncation has no findings list of its own and stays
|
|
154
|
+
// disclosed only in prose, as it already was.
|
|
155
|
+
const shown = report.findings.length +
|
|
156
|
+
rollback.data.findings.length +
|
|
157
|
+
attributeExistence.data.findings.length +
|
|
158
|
+
migrationIntegrity.data.findings.length;
|
|
159
|
+
const total = report.findingsTotal +
|
|
160
|
+
rollback.data.findingsTotal +
|
|
161
|
+
attributeExistence.data.findingsTotal +
|
|
162
|
+
migrationIntegrity.data.findingsTotal;
|
|
163
|
+
const truncated = checked.truncated ||
|
|
164
|
+
rollback.truncated ||
|
|
165
|
+
attributeExistence.truncated ||
|
|
166
|
+
migrationIntegrity.truncated ||
|
|
167
|
+
configGraph.truncated;
|
|
168
|
+
const truncatedDetail = truncated
|
|
169
|
+
? { shown, total: Math.max(total, shown), more: null }
|
|
170
|
+
: undefined;
|
|
88
171
|
return {
|
|
89
172
|
result: {
|
|
90
173
|
...checked,
|
|
@@ -129,29 +212,61 @@ async function run(args, ctx) {
|
|
|
129
212
|
ran: rollback.data.ran,
|
|
130
213
|
blockers: rollback.data.blockers,
|
|
131
214
|
},
|
|
215
|
+
attributeExistence: {
|
|
216
|
+
findings: attributeExistence.data.findings,
|
|
217
|
+
findingsTotal: attributeExistence.data.findingsTotal,
|
|
218
|
+
examined: attributeExistence.data.examined,
|
|
219
|
+
ran: attributeExistence.data.ran,
|
|
220
|
+
},
|
|
221
|
+
migrationIntegrity: {
|
|
222
|
+
findings: migrationIntegrity.data.findings,
|
|
223
|
+
findingsTotal: migrationIntegrity.data.findingsTotal,
|
|
224
|
+
examined: migrationIntegrity.data.examined,
|
|
225
|
+
migrationsDirectory: migrationIntegrity.data.migrationsDirectory,
|
|
226
|
+
ran: migrationIntegrity.data.ran,
|
|
227
|
+
withheld: migrationIntegrity.data.withheld,
|
|
228
|
+
},
|
|
132
229
|
},
|
|
133
|
-
//
|
|
134
|
-
// because
|
|
230
|
+
// Every check's disclosures reach the reader. Dropping one half's notes
|
|
231
|
+
// because another had something to say is the silent-degradation
|
|
135
232
|
// failure rule 7 exists to prevent.
|
|
136
|
-
notes: [
|
|
137
|
-
|
|
233
|
+
notes: [
|
|
234
|
+
...scopeNotes,
|
|
235
|
+
...checked.notes,
|
|
236
|
+
...rollback.notes,
|
|
237
|
+
...attributeExistence.notes,
|
|
238
|
+
...migrationIntegrity.notes,
|
|
239
|
+
...configGraph.notes,
|
|
240
|
+
],
|
|
241
|
+
truncated,
|
|
138
242
|
stamp: {
|
|
139
243
|
...checked.stamp,
|
|
140
|
-
resolutionFloor: Math.min(checked.stamp.resolutionFloor, rollback.stamp.resolutionFloor, configGraph.stamp.resolutionFloor),
|
|
244
|
+
resolutionFloor: Math.min(checked.stamp.resolutionFloor, rollback.stamp.resolutionFloor, attributeExistence.stamp.resolutionFloor, migrationIntegrity.stamp.resolutionFloor, configGraph.stamp.resolutionFloor),
|
|
141
245
|
},
|
|
142
246
|
},
|
|
143
247
|
// A missing environment variable is §11A.5's canonical name-level fact —
|
|
144
248
|
// the variable exists or it does not — which is the one claim R2 supports at
|
|
145
249
|
// class A. The shape of its value is never asserted here.
|
|
146
250
|
nameLevel: true,
|
|
147
|
-
...(
|
|
251
|
+
...(truncatedDetail === undefined ? {} : { truncatedDetail }),
|
|
252
|
+
...(nothingToCheck
|
|
253
|
+
? { state: "refused" }
|
|
254
|
+
: falseClean
|
|
255
|
+
? { state: "empty" }
|
|
256
|
+
: {}),
|
|
148
257
|
headline: nothingToCheck
|
|
149
|
-
? "No configuration files, environment reads or
|
|
150
|
-
"nothing to check."
|
|
151
|
-
:
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
`${
|
|
258
|
+
? "No configuration files, environment reads, migrations or attribute reads were found, so " +
|
|
259
|
+
"there was nothing to check."
|
|
260
|
+
: falseClean
|
|
261
|
+
? `0 of the ${(files ?? []).length} named file(s) matched anything on the read side. Not ` +
|
|
262
|
+
"checked, not clean."
|
|
263
|
+
: `${verdict}. ${report.surfaces.length} configuration file(s) declare ` +
|
|
264
|
+
`${countDeclared(report.surfaces)} variable(s); ` +
|
|
265
|
+
`${report.reads.required} variable(s) are read through an accessor that fails when unset; ` +
|
|
266
|
+
`${rollback.data.examined.operations} destructive migration operation(s) examined; ` +
|
|
267
|
+
`${attributeExistence.data.examined.readEdgesExamined} attribute read(s) checked against ` +
|
|
268
|
+
`a declared type; ${migrationIntegrity.data.examined.modulesWithRevision} migration(s) ` +
|
|
269
|
+
"checked for location and revision-chain integrity.",
|
|
155
270
|
};
|
|
156
271
|
}
|
|
157
272
|
function countDeclared(surfaces) {
|
|
@@ -167,9 +282,17 @@ export const validateTool = {
|
|
|
167
282
|
"declares. Reports a variable only when the code reads it with no fallback and no " +
|
|
168
283
|
"configuration file declares it, and only when the repository's declaration surface is " +
|
|
169
284
|
"complete enough for that absence to mean something — a variable supplied by a secrets " +
|
|
170
|
-
"manager or a platform is disclosed with a count, never reported as missing.
|
|
171
|
-
"
|
|
172
|
-
"
|
|
285
|
+
"manager or a platform is disclosed with a count, never reported as missing. Pass \"files\" " +
|
|
286
|
+
"(the diff you are about to push) to also catch a variable your change reads that no " +
|
|
287
|
+
"declaration surface declares, regardless of whether the accessor fails on absence — the " +
|
|
288
|
+
"usual shape on a codebase where almost no read is required. Also reports variables set in " +
|
|
289
|
+
"one configuration file and documented in no example file, stated as a lead rather than a " +
|
|
290
|
+
"defect. Two further checks, both always defects because both are provable from the graph " +
|
|
291
|
+
"alone: an attribute read on a value whose declared type does not name it (from a READS " +
|
|
292
|
+
"edge's attrs.unresolvedFields), and a migration whose location or declared parent revision " +
|
|
293
|
+
"disagrees with the rest of the project's migrations (from attrs.migrationRevision, " +
|
|
294
|
+
"migrationDownRevision and migrationDir). Both are silent wherever the producer supplied no " +
|
|
295
|
+
"signal — absence of the attrs key is never read as a clean result.",
|
|
173
296
|
inputSchema: SCHEMA,
|
|
174
297
|
run,
|
|
175
298
|
};
|